.login-shell {
  --color-primary: #1677ff;
  --color-primary-dark: #0f66d8;
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-text: #1f2329;
  --color-text-secondary: #646a73;
  --color-border: #e5e7eb;
  --color-border-strong: #d8dce3;
  --radius-control: 8px;
  --radius-panel: 12px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding:
    max(24px, env(safe-area-inset-top, 0px))
    max(16px, calc(env(safe-area-inset-right, 0px) + 12px))
    max(24px, env(safe-area-inset-bottom, 0px))
    max(16px, calc(env(safe-area-inset-left, 0px) + 12px));
  place-items: center;
  overflow-y: auto;
  background: #f5f7fa;
}

.login-panel {
  width: min(100%, 420px);
  padding: 36px 32px 30px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 32px rgba(31, 35, 41, 0.08);
}

.login-mark {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 0 16px;
  place-items: center;
  border-radius: 10px;
  background: #edf5ff;
  color: #1677ff;
}

.login-mark svg {
  width: 23px;
  height: 23px;
}

.login-panel h1 {
  margin: 0;
  color: #1f2329;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.login-panel > p:not(.login-footnote) {
  margin: 7px 0 26px;
  color: #646a73;
  font-size: 14px;
  line-height: 1.5;
}

.login-shell .field-label {
  display: block;
  margin: 18px 0 8px;
  color: #373c43;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.login-shell .text-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #d8dce3;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2329;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-shell .text-input::placeholder {
  color: #a6abb3;
}

.login-shell .text-input:hover {
  border-color: #b9c0ca;
}

.login-shell .text-input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.login-shell .password-field {
  position: relative;
}

.login-shell .password-field .text-input {
  padding-right: 48px;
}

.login-shell .password-toggle {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #7b828c;
}

.login-shell .password-toggle:active {
  background: #f2f3f5;
}

.login-shell .captcha-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

.login-shell .captcha-field .text-input {
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.login-shell .captcha-image {
  display: grid;
  height: 48px;
  padding: 0;
  overflow: hidden;
  place-items: center;
  border: 1px solid #d8dce3;
  border-radius: 8px;
  background: #f5f7fa;
}

.login-shell .captcha-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-shell .captcha-refresh {
  display: block;
  min-height: 34px;
  margin: 5px 0 0 auto;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #1677ff;
  font-size: 12px;
}

.login-shell .primary-button.login-button {
  width: 100%;
  min-height: 48px;
  margin-top: 22px;
  border: 1px solid #1677ff;
  border-radius: 8px;
  background: #1677ff;
  color: #ffffff;
  font-size: 15px;
  font-weight: 650;
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.login-shell .primary-button.login-button:hover:not(:disabled) {
  border-color: #0f66d8;
  background: #0f66d8;
}

.login-shell .primary-button.login-button:active:not(:disabled) {
  border-color: #0958bd;
  background: #0958bd;
}

.login-shell .primary-button.login-button:disabled {
  border-color: #8dbdff;
  background: #8dbdff;
  cursor: not-allowed;
  opacity: 1;
}

.login-shell .form-error,
.login-shell .inline-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #ffd1cc;
  border-radius: 8px;
  background: #fff2f0;
  color: #c9362b;
  font-size: 13px;
  line-height: 1.45;
}

.login-footnote {
  margin: 18px 0 0 !important;
  color: #8a9099 !important;
  text-align: center;
  font-size: 12px !important;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .login-shell {
    display: block;
    padding:
      max(36px, calc(env(safe-area-inset-top, 0px) + 24px))
      max(16px, calc(env(safe-area-inset-right, 0px) + 12px))
      max(24px, calc(env(safe-area-inset-bottom, 0px) + 16px))
      max(16px, calc(env(safe-area-inset-left, 0px) + 12px));
    background: #ffffff;
  }

  .login-panel {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-mark {
    margin-bottom: 15px;
  }

  .login-panel > p:not(.login-footnote) {
    margin-bottom: 25px;
  }

  .login-shell .text-input {
    font-size: 16px;
  }
}

@media (max-width: 359px) {
  .login-shell .captcha-field {
    grid-template-columns: minmax(0, 1fr) 118px;
    gap: 8px;
  }
}

@media (max-height: 640px) {
  .login-shell,
  .keyboard-open .login-shell {
    display: block;
    padding-top: max(14px, env(safe-area-inset-top, 0px));
    padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  }

  .login-panel {
    margin: 0 auto;
    padding-top: 22px;
    padding-bottom: 22px;
  }

  .login-mark {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
  }

  .login-panel > p:not(.login-footnote) {
    margin-bottom: 14px;
  }

  .field-label {
    margin-top: 10px;
  }

  .login-shell .primary-button.login-button {
    margin-top: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell .text-input,
  .login-shell .primary-button.login-button {
    transition: none;
  }
}
