:root {
  --login-bg: #f5f8fc;
  --login-grid: rgba(63, 109, 196, 0.08);
  --login-card: rgba(255, 255, 255, 0.96);
  --login-text: #1b2438;
  --login-muted: #7b8aa5;
  --login-line: rgba(141, 159, 191, 0.24);
  --login-border: #d8e0ec;
  --login-input-bg: #f7f9fc;
  --login-primary: #2f5ed9;
  --login-primary-strong: #234dc0;
  --login-shadow: 0 18px 45px rgba(59, 89, 152, 0.12);
}

html[data-theme="dark"] {
  --login-bg: #0f1728;
  --login-grid: rgba(115, 148, 219, 0.09);
  --login-card: rgba(18, 28, 47, 0.94);
  --login-text: #f3f7ff;
  --login-muted: #93a4c3;
  --login-line: rgba(147, 164, 195, 0.16);
  --login-border: rgba(147, 164, 195, 0.18);
  --login-input-bg: #111d31;
  --login-primary: #4d7cff;
  --login-primary-strong: #3f6df0;
  --login-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

html,
body.login-page-body {
  min-height: 100%;
}

body.login-page-body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--login-text);
  background-color: var(--login-bg);
  background-image:
    linear-gradient(var(--login-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--login-grid) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(84, 119, 214, 0.08), transparent 42%);
  background-size: 44px 44px, 44px 44px, 100% 100%;
}

body.login-page-body.is-ready .login-card {
  animation: loginCardFlipIn 0.68s cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-origin: center center;
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

body.login-page-body.is-leaving .login-card {
  animation: loginCardFlipOut 0.42s cubic-bezier(0.55, 0.06, 0.68, 0.19) both;
  transform-origin: center center;
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--login-border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--login-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

html[data-theme="dark"] .theme-toggle {
  background: rgba(17, 29, 49, 0.82);
}

.theme-toggle:hover {
  border-color: rgba(47, 94, 217, 0.32);
}

.theme-toggle--floating {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
}

.theme-toggle__icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-icon {
  display: none;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

html[data-theme="light"] .theme-icon--sun {
  display: inline-block;
}

html[data-theme="dark"] .theme-icon--moon {
  display: inline-block;
}

.login-stage-simple {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-stage-simple__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: #7386aa;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-stage-simple__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--login-primary);
}

.login-panel {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1400px;
}

.login-card {
  width: 100%;
  max-width: 464px;
  padding: 42px 44px 28px;
  border-radius: 24px;
  background: var(--login-card);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--login-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.login-card__header {
  text-align: center;
}

.login-card__logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 244, 255, 0.94) 100%);
  border: 1px solid rgba(47, 94, 217, 0.14);
  box-shadow: 0 12px 24px rgba(47, 94, 217, 0.16);
}

.login-card__logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

html[data-theme="dark"] .login-card__logo {
  background: linear-gradient(180deg, rgba(228, 236, 255, 0.98) 0%, rgba(197, 213, 255, 0.92) 100%);
  border-color: rgba(125, 159, 255, 0.26);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.login-card__header h2 {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 800;
  color: var(--login-text);
}

.login-card__header p {
  margin: 0;
  color: var(--login-muted);
  font-size: 1.02rem;
}

.login-card__version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin-top: 14px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(47, 94, 217, 0.08);
  color: var(--login-primary);
  font-size: 12px;
  font-weight: 700;
}

.login-form {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--login-line);
}

.modern-field + .modern-field {
  margin-top: 18px;
}

.modern-field label {
  display: block;
  margin-bottom: 10px;
  color: #7082a1;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modern-field__control {
  position: relative;
}

.modern-field__icon,
.modern-field__action {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.modern-field__icon {
  left: 16px;
  color: #93a4c3;
  font-size: 16px;
}

.modern-field__action {
  right: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #93a4c3;
  cursor: pointer;
}

.modern-input.form-control {
  height: 50px;
  padding: 0 48px 0 48px;
  border-radius: 14px;
  border: 1px solid var(--login-border);
  background: var(--login-input-bg);
  color: var(--login-text);
  font-size: 15px;
  font-weight: 500;
  box-shadow: none;
  transition: all 0.2s ease;
}

.modern-input.form-control::placeholder {
  color: #9bacc7;
}

.modern-input.form-control:focus {
  border-color: rgba(47, 94, 217, 0.42);
  box-shadow: 0 0 0 4px rgba(47, 94, 217, 0.1);
  background: var(--login-card);
  color: var(--login-text);
}

.modern-field__hint {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.modern-field__hint--center {
  justify-content: center;
}

.modern-field__hint--timer {
  justify-content: flex-start;
}

.forgot-timer {
  color: #e35d5d;
  font-size: 13px;
  font-weight: 700;
}

.login-link.btn {
  padding: 0;
  border: 0;
  color: var(--login-primary) !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
}

.login-form__footer {
  margin-top: 26px;
}

.login-submit.btn {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--login-primary) 0%, var(--login-primary-strong) 100%) !important;
  color: #fff !important;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(47, 94, 217, 0.26) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-submit.btn:hover,
.login-submit.btn:focus {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(47, 94, 217, 0.3) !important;
}

.login-stage-simple__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 24px;
  color: #97a6bf;
  font-size: 13px;
  flex-wrap: wrap;
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(15, 23, 40, 0.34);
  color: #fff;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.swal2-container.swal2-backdrop-show {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.swal2-popup {
  border-radius: 24px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: var(--login-text) !important;
  border: 1px solid rgba(216, 224, 236, 0.9) !important;
  box-shadow: 0 22px 50px rgba(23, 35, 68, 0.16) !important;
}

.swal2-title {
  color: var(--login-text) !important;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  font-weight: 800 !important;
}

.swal2-html-container,
.swal2-content {
  color: var(--login-muted) !important;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

.swal2-styled:focus {
  box-shadow: 0 0 0 4px rgba(47, 94, 217, 0.18) !important;
}

.swal2-icon.swal2-success [class^="swal2-success-line"],
.swal2-icon.swal2-success [class*=" swal2-success-line"] {
  background-color: #67c587 !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
  border-color: rgba(103, 197, 135, 0.32) !important;
}

.swal2-icon.swal2-error {
  border-color: rgba(229, 92, 92, 0.28) !important;
}

.swal2-icon.swal2-error [class^="swal2-x-mark-line"],
.swal2-icon.swal2-error [class*=" swal2-x-mark-line"] {
  background-color: #e55c5c !important;
}

.swal2-timer-progress-bar {
  background: linear-gradient(90deg, var(--login-primary) 0%, var(--login-primary-strong) 100%) !important;
}

@keyframes loginCardFlipIn {
  from {
    opacity: 0;
    transform: perspective(1400px) rotateY(-78deg) scale(0.96);
  }
  to {
    opacity: 1;
    transform: perspective(1400px) rotateY(0deg) scale(1);
  }
}

@keyframes loginCardFlipOut {
  from {
    opacity: 1;
    transform: perspective(1400px) rotateY(0deg) scale(1);
  }
  to {
    opacity: 0;
    transform: perspective(1400px) rotateY(78deg) scale(0.96);
  }
}

html[data-theme="dark"] .swal2-popup {
  background: rgba(18, 28, 47, 0.96) !important;
  color: #f3f7ff !important;
  border-color: rgba(147, 164, 195, 0.2) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42) !important;
}

html[data-theme="dark"] .swal2-title {
  color: #f3f7ff !important;
}

html[data-theme="dark"] .swal2-html-container,
html[data-theme="dark"] .swal2-content {
  color: #9fb0ce !important;
}

html[data-theme="dark"] .swal2-icon.swal2-success .swal2-success-ring {
  border-color: rgba(112, 214, 147, 0.26) !important;
}

html[data-theme="dark"] .swal2-validation-message {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #dbe7ff !important;
}

@media (max-width: 575.98px) {
  .login-shell {
    padding: 24px 14px;
  }

  .theme-toggle--floating {
    top: 14px;
    right: 14px;
  }

  .login-stage-simple__eyebrow {
    font-size: 11px;
    letter-spacing: 0.1em;
    margin-bottom: 18px;
  }

  .login-card {
    padding: 30px 20px 22px;
    border-radius: 20px;
  }

  .login-card__header h2 {
    font-size: 1.75rem;
  }

  .login-stage-simple__footer {
    gap: 10px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.login-page-body.is-ready .login-card,
  body.login-page-body.is-leaving .login-card {
    animation: none !important;
  }
}
