:root {
  --primary: #3eb6fb;
  --primary-strong: #2a9de9;
  --secondary: #0ec4cb;
  --body: #4e4e4e;
  --muted: #777;
  --separator: #e1e5eb;
  --danger: #cf2637;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(to bottom, #ffffff 0px, #ffffff 45px, rgba(255,255,255,0.92) 70px, rgba(255,255,255,0.75) 95px, rgba(255,255,255,0.45) 125px, rgba(255,255,255,0.18) 160px, rgba(255,255,255,0) 210px),
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.78), transparent 24%),
    radial-gradient(circle at 78% 8%, rgba(62, 182, 251, 0.26), transparent 30%),
    linear-gradient(165deg, #e7fbff 0%, #9ce6ff 34%, #3eb6fb 68%, #2a9de9 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.loading-overlay-central {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.loading-overlay-central.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.loading-spinner-central {
  position: relative;
  width: 50px;
  height: 50px;
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.loading-overlay-central.active .loading-spinner-central {
  opacity: 1;
  visibility: visible;
}

.loading-box-central {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: linear-gradient(135deg, #23c7ef, #7b37f2);
  animation: preloader-box-rotate 0.5s linear infinite;
  box-shadow: 0 12px 28px rgba(78, 43, 180, 0.22);
}

.loading-shadow-central {
  position: absolute;
  top: 59px;
  left: 0;
  width: 50px;
  height: 5px;
  opacity: 0.1;
  border-radius: 50%;
  background-color: #000;
  animation: preloader-shadow-scale 0.5s linear infinite;
}

@keyframes preloader-box-rotate {
  17% {
    border-bottom-right-radius: 3px;
  }

  25% {
    transform: translateY(9px) rotate(22.5deg);
  }

  50% {
    transform: translateY(18px) scale(1, 0.9) rotate(45deg);
    border-bottom-right-radius: 40px;
  }

  75% {
    transform: translateY(9px) rotate(67.5deg);
  }

  100% {
    transform: translateY(0) rotate(90deg);
  }
}

@keyframes preloader-shadow-scale {
  50% {
    transform: scale(1.2, 1);
  }
}

a:hover {
  text-decoration: underline;
  color: var(--primary-strong);
}

#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: calc(28px + var(--safe-top)) 28px calc(28px + var(--safe-bottom));
  background:
    linear-gradient(to bottom, #ffffff 0px, #ffffff 45px, rgba(255,255,255,0.92) 70px, rgba(255,255,255,0.75) 95px, rgba(255,255,255,0.45) 125px, rgba(255,255,255,0.18) 160px, rgba(255,255,255,0) 210px),
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.78), transparent 24%),
    radial-gradient(circle at 78% 8%, rgba(62, 182, 251, 0.26), transparent 30%),
    linear-gradient(165deg, #e7fbff 0%, #9ce6ff 34%, #3eb6fb 68%, #2a9de9 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#splash-screen.splash-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  width: min(100%, 320px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
  animation: splash-content-enter 0.7s ease both;
}

.splash-logo-wrap {
  width: min(100%, 240px);
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-logo {
  width: min(100%, 210px);
  max-height: 56px;
  height: auto;
  display: block;
  object-fit: contain;
}

.splash-copy {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.splash-copy strong {
  color: #fff;
  font-size: 1.18rem;
  line-height: 1.2;
}

.splash-copy span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
}

.splash-progress {
  width: 142px;
  height: 4px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
}

.splash-progress span {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: #fff;
  animation: splash-progress-slide 1.2s ease-in-out infinite;
}

.splash-footnote {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: calc(22px + var(--safe-bottom));
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.76rem;
  font-weight: 600;
  text-align: center;
}

@keyframes splash-content-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes splash-progress-slide {
  0% {
    transform: translateX(-115%);
  }

  55% {
    transform: translateX(58%);
  }

  100% {
    transform: translateX(245%);
  }
}

.login-shell {
  width: 100%;
  max-width: 420px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(20px, calc(20px + var(--safe-top)))
    max(18px, calc(18px + var(--safe-right)))
    max(20px, calc(24px + var(--safe-bottom)))
    max(18px, calc(18px + var(--safe-left)));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.login-panel {
  width: 100%;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  padding: 40px 35px 30px;
  position: relative;
  z-index: 1;
}

.login-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #3eb6fb, #2a9de9);
}

.login-brand {
  text-align: center;
  margin-bottom: 35px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-hero-logo {
  width: min(60%, 220px);
  max-width: 220px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.login-brand p {
  color: var(--muted);
  font-size: 15px;
}

.social-section {
  text-align: center;
}

.social-login {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin: 25px 0;
}

.social-button {
  width: 55px;
  height: 55px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  transition: 0.3s;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.social-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.social-button-google {
  background: #db4437;
}

.social-button-facebook {
  background: #4267b2;
}

.social-button-microsoft {
  background: #2f2f2f;
}

.social-login.is-hidden,
.or-email-trigger.is-hidden {
  display: none;
}

.or-email-trigger {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  margin: 15px auto 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 8px 20px rgba(62, 182, 251, 0.24);
  transition: 0.2s ease;
}

.or-email-trigger:hover {
  color: #fff;
  background: var(--primary-strong);
  transform: translateY(-1px);
}

.login-form {
  display: none;
  animation: fade 0.4s ease;
  flex-direction: column;
}

.login-form.is-visible {
  display: flex;
}

.login-inline-back {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #f2f8fd;
  color: var(--primary-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(18, 46, 76, 0.08);
  z-index: 2;
}

.login-inline-back.is-hidden {
  display: none;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.field > span:first-child {
  color: #555;
  font-weight: 500;
}

.field-control {
  position: relative;
  min-height: 0;
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
}

.field-control > i:first-child {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
}

.field-control input,
.field-control select {
  width: 100%;
  min-width: 0;
  padding: 14px 14px 14px 45px;
  border: 1px solid var(--separator);
  border-radius: 10px;
  font-size: 15px;
  transition: 0.3s;
  background: #fff;
  color: var(--body);
  outline: none;
}

.field-control input:focus,
.field-control select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(62, 182, 251, 0.2);
}

.field-control.is-invalid input,
.field-control.is-invalid select {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(207, 38, 55, 0.2);
}

.field-control input::placeholder {
  color: #a9b0b4;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa1a7;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: transparent;
}

.password-toggle:hover {
  background: #f3f5f7;
}

.login-options {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 25px;
  font-size: 14px;
}

.remember-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  min-width: 0;
  line-height: 1;
}

.remember-option input {
  accent-color: var(--primary);
  margin: 0;
}

.login-options > a {
  margin-left: auto;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.login-submit {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
  width: 100%;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(62, 182, 251, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-submit:hover {
  background: var(--primary-strong);
  transform: translateY(-2px);
}

.login-submit.is-loading {
  pointer-events: none;
}

.form-feedback {
  min-height: 0;
  color: var(--danger);
  font-size: 14px;
  text-align: center;
}

.form-feedback:empty {
  display: none;
}

.form-feedback.is-success {
  color: var(--secondary);
}

.auth-footnote {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 14px;
  border-radius: 16px;
  background: #f4f9fd;
  border: 1px solid #dceaf6;
}

.auth-footnote-button {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  box-shadow: 0 8px 20px rgba(62, 182, 251, 0.24);
}

.auth-footnote-button:hover {
  color: #fff;
  background: var(--primary-strong);
  text-decoration: none;
}

.floating-element {
  position: absolute;
  background: rgba(62, 182, 251, 0.1);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

.element-1 {
  width: 120px;
  height: 120px;
  top: calc(50% - 260px);
  right: -20px;
}

.element-2 {
  width: 80px;
  height: 80px;
  bottom: calc(50% - 260px);
  left: -10px;
}

.wave-loader {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 18px;
  gap: 2px;
}

.wave-loader span {
  width: 4px;
  height: 10px;
  background: #fff;
  border-radius: 2px;
  animation: login-wave 1s infinite ease-in-out;
}

.wave-loader span:nth-child(1) {
  animation-delay: 0s;
}

.wave-loader span:nth-child(2) {
  animation-delay: 0.1s;
}

.wave-loader span:nth-child(3) {
  animation-delay: 0.2s;
}

.wave-loader span:nth-child(4) {
  animation-delay: 0.3s;
}

.wave-loader span:nth-child(5) {
  animation-delay: 0.4s;
}

@keyframes login-wave {
  0%, 40%, 100% {
    transform: scaleY(0.4);
  }

  20% {
    transform: scaleY(1);
  }
}

@media (max-width: 480px) {
  body {
    background-position: center top;
  }

  .login-shell {
    width: 100%;
    align-items: flex-start;
    padding-top: max(18px, calc(18px + var(--safe-top)));
    padding-left: max(18px, calc(18px + var(--safe-left)));
    padding-right: max(18px, calc(18px + var(--safe-right)));
  }

  .login-panel {
    border-radius: 18px;
    padding: 28px 22px 24px;
    margin: auto 0;
  }

  .login-brand {
    margin-bottom: 28px;
    gap: 8px;
  }

  .login-hero-logo {
    width: min(68%, 200px);
  }

  .login-brand p {
    font-size: 14px;
    line-height: 1.4;
  }

  .login-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .social-login {
    gap: 12px;
    margin: 22px 0;
  }

  .social-button {
    width: 52px;
    height: 52px;
    font-size: 20px;
  }

  .field {
    margin-bottom: 18px;
  }

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

  .auth-footnote {
    margin-top: 16px;
    line-height: 1.45;
  }

  .element-1 {
    width: 92px;
    height: 92px;
    top: 8px;
    right: -22px;
  }

  .element-2 {
    width: 64px;
    height: 64px;
    bottom: 12px;
    left: -16px;
  }
}

@media (max-width: 360px) {
  .login-shell {
    padding-left: max(16px, calc(16px + var(--safe-left)));
    padding-right: max(16px, calc(16px + var(--safe-right)));
  }

  .login-panel {
    padding: 24px 18px 22px;
  }

  .login-brand {
    margin-bottom: 24px;
  }

  .login-hero-logo {
    width: min(74%, 188px);
  }

  .social-login {
    gap: 10px;
  }

  .social-button {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
}

@media (max-width: 390px) {
  .login-shell {
    max-width: 100%;
    padding-left: max(20px, calc(20px + var(--safe-left)));
    padding-right: max(20px, calc(20px + var(--safe-right)));
  }

  .login-panel {
    border-radius: 20px;
    padding-left: 20px;
    padding-right: 20px;
  }
}
