* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(34, 135, 110, 0.24), transparent 34%),
    radial-gradient(circle at right center, rgba(22, 102, 136, 0.16), transparent 30%),
    linear-gradient(135deg, #eaf3f1 0%, #d9e8e4 42%, #edf4f6 100%);
  color: #18313a;
}

@keyframes spinner {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes loginShellIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

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

.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 28px;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(320px, 0.9fr);
  width: min(820px, 100%);
  min-height: min(560px, calc(100vh - 56px));
  border: 1px solid rgba(99, 129, 136, 0.18);
  border-radius: 24px;
  overflow: hidden;
  background: rgba(248, 252, 252, 0.72);
  box-shadow: 0 28px 60px rgba(27, 55, 66, 0.18);
  backdrop-filter: blur(18px);
  animation: loginShellIn 0.45s ease-out;
}

.login-brand-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  background:
    linear-gradient(160deg, rgba(13, 62, 76, 0.96) 0%, rgba(17, 87, 92, 0.92) 52%, rgba(28, 122, 104, 0.9) 100%);
  color: #f5fbfa;
}

.login-brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 44%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.06), transparent 42%);
  pointer-events: none;
}

.login-brand-panel > * {
  position: relative;
  z-index: 1;
}

.login-logo-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.login-logo-mark {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.login-logo-mark img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.login-logo-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-logo-overline {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(229, 245, 242, 0.76);
}

.login-logo-title {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
}

.login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 44px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 250, 249, 0.98) 100%);
}

.login-panel {
  justify-content: flex-start;
}

.login-form-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login .title {
  margin: 0;
  color: #173039;
  font-size: 34px;
  line-height: 1.02;
  font-weight: 800;
}

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-field label {
  color: #375258;
  font-size: 13px;
  font-weight: 700;
}

.login input {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid #c9d7db;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #14313a;
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login input::placeholder {
  color: #8a9da3;
}

.login input:focus {
  outline: none;
  border-color: #1f8d80;
  box-shadow: 0 0 0 4px rgba(31, 141, 128, 0.14);
  background: #ffffff;
}

.mfa-code-input {
  width: 100%;
  min-height: 64px;
  padding: 0 18px;
  border: 1px solid #c9d7db;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: #14313a;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
}

.mfa-code-input:focus {
  outline: none;
  border-color: #1f8d80;
  box-shadow: 0 0 0 4px rgba(31, 141, 128, 0.14);
  background: #ffffff;
}

.login-panel-copy {
  color: #5d757b;
  font-size: 14px;
  line-height: 1.5;
}

.mfa-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
}

.mfa-qr-wrap a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 1px solid #d4dfe3;
  border-radius: 18px;
  background: #ffffff;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.mfa-qr-wrap a:hover,
.mfa-qr-wrap a:focus {
  border-color: #9bbec0;
  box-shadow: 0 12px 28px rgba(19, 48, 57, 0.12);
}

.mfa-qr-wrap a:active {
  transform: scale(0.98);
}

.mfa-secret-code {
  padding: 12px 14px;
  border: 1px dashed #c8d7db;
  border-radius: 14px;
  background: #f8fbfb;
  color: #29464d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  word-break: break-all;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.mfa-secret-code:hover,
.mfa-secret-code:focus {
  border-color: #95b8ba;
  background: #f1f8f8;
  color: #173039;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, #1e9484 0%, #187869 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 26px rgba(24, 120, 105, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.login button .state {
  position: relative;
  z-index: 1;
}

.login button .spinner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-top-color: rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  opacity: 0;
  animation: spinner 0.7s linear infinite;
  transition: opacity 0.2s ease;
}

.login:not(.loading) button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(24, 120, 105, 0.24);
  filter: brightness(1.02);
}

.login:not(.loading) button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(31, 141, 128, 0.16), 0 18px 32px rgba(24, 120, 105, 0.2);
}

.login.loading button {
  color: transparent;
  pointer-events: none;
}

.login.loading button .spinner {
  opacity: 1;
}

.login.pass button {
  background: linear-gradient(180deg, #66b93f 0%, #4b962a 100%);
  box-shadow: 0 16px 30px rgba(75, 150, 42, 0.22);
  color: #ffffff;
}

.login.fail button {
  background: linear-gradient(180deg, #d85757 0%, #b83e3e 100%);
  box-shadow: 0 16px 30px rgba(184, 62, 62, 0.2);
  color: #ffffff;
}

.login button.pass,
.login button.is-pass {
  background: linear-gradient(180deg, #66b93f 0%, #4b962a 100%);
  box-shadow: 0 16px 30px rgba(75, 150, 42, 0.22);
  color: #ffffff;
}

.login button.fail,
.login button.is-fail {
  background: linear-gradient(180deg, #d85757 0%, #b83e3e 100%);
  box-shadow: 0 16px 30px rgba(184, 62, 62, 0.2);
  color: #ffffff;
}

.login.pass button .spinner,
.login.fail button .spinner {
  opacity: 0;
}

.login.pass button .state,
.login.fail button .state {
  opacity: 1;
}

.login-notice {
  min-height: 20px;
  color: #6f8488;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.login-notice.is-working {
  color: #49656b;
}

.login-notice.is-success {
  color: #3f7f2a;
}

.login-notice.is-error {
  color: #b44545;
}

@media (max-width: 900px) {
  .wrapper {
    padding: 14px;
  }

  .login-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-brand-panel {
    min-height: 180px;
    padding: 26px 22px 22px;
  }

  .login {
    padding: 28px 22px 24px;
  }
}

@media (max-width: 560px) {
  .wrapper {
    align-items: stretch;
    min-height: 100vh;
    padding: 0;
  }

  .login-shell {
    width: 100%;
    min-height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

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

  .login {
    gap: 20px;
    padding: 24px 18px 22px;
  }

  .login .title {
    font-size: 28px;
  }

  .login input,
  .login button {
    min-height: 54px;
  }
}
