:root {
  --login-bg: #f6fafa;
  --login-text: #0f172a;
  --login-muted: #6b7280;
  --login-soft: #f8fbfb;
  --login-border: rgba(15, 23, 42, 0.08);
  --login-border-strong: #e5e7eb;
  --login-primary: #20c6b7;
  --login-primary-2: #12a594;
  --login-primary-hover: #28d4c4;
  --login-focus: rgba(24, 182, 163, 0.14);
  --login-danger: #b91c1c;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--login-bg);
}

body.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--login-text);
  font-family: "Microsoft YaHei", "PingFang SC", "Inter", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(32, 198, 183, 0.16), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(18, 165, 148, 0.12), transparent 26%),
    radial-gradient(circle at 18% 88%, rgba(32, 198, 183, 0.1), transparent 26%),
    linear-gradient(135deg, #f7fbfb 0%, #f2faf8 48%, #ffffff 100%);
  overflow-x: hidden;
}

body.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.032) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.48));
}

button,
input {
  font: inherit;
}

.login-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 44px 20px 28px;
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 32px;
  text-align: center;
}

.login-logo {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 8px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 253, 251, 0.96));
  box-shadow:
    0 16px 36px rgba(15, 23, 42, 0.09),
    0 0 0 1px rgba(15, 23, 42, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.login-logo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  object-fit: cover;
}

.login-brand h1 {
  margin: 0;
  color: var(--login-text);
  font-size: 38px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0;
}

.login-brand p {
  margin: 0;
  color: var(--login-muted);
  font-size: 14px;
  line-height: 1.5;
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(440px, 100%);
  padding: 36px 38px;
  border: 1px solid var(--login-border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.login-message-stack {
  display: grid;
  gap: 8px;
}

.login-message {
  padding: 10px 12px;
  border-radius: 12px;
  color: #14532d;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  font-size: 13px;
  line-height: 1.45;
}

.login-message.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.login-message.warning {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.login-field {
  display: grid;
  gap: 8px;
}

.login-field label {
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.login-input-icon {
  position: absolute;
  left: 15px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #94a3b8;
  pointer-events: none;
}

.login-input-icon svg,
.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-input {
  width: 100%;
  height: 50px;
  border: 1px solid var(--login-border-strong);
  border-radius: 15px;
  outline: none;
  padding: 0 48px;
  color: var(--login-text);
  background: #ffffff;
  font-size: 16px;
  line-height: 50px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-input::placeholder {
  color: #9ca3af;
}

.login-input:focus {
  border-color: var(--login-primary);
  box-shadow: 0 0 0 3px var(--login-focus);
}

.password-toggle {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 13px;
  color: #94a3b8;
  background: transparent;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.password-toggle:hover {
  color: #0f766e;
  background: #eefdfb;
}

.login-inline-error {
  margin-top: -2px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--login-danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
  font-size: 13px;
  line-height: 1.45;
}

.login-inline-error[hidden] {
  display: none !important;
}

.login-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  margin-top: 4px;
  border: 0;
  border-radius: 15px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--login-primary) 0%, var(--login-primary-2) 100%);
  box-shadow: 0 14px 28px rgba(18, 165, 148, 0.22);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.login-submit:hover {
  background: linear-gradient(135deg, var(--login-primary-hover) 0%, #10a090 100%);
  box-shadow: 0 16px 32px rgba(18, 165, 148, 0.26);
}

.login-submit:active {
  transform: translateY(1px);
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.82;
}

.login-submit.is-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: login-spin 0.8s linear infinite;
}

.login-footer {
  margin-top: 28px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

body.change-password-page {
  overflow-y: auto;
}

.change-password-card {
  gap: 16px;
  padding: 32px 36px;
}

.change-password-head {
  display: grid;
  gap: 6px;
  margin-bottom: 2px;
}

.change-password-head h2 {
  margin: 0;
  color: var(--login-text);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

.change-password-head p {
  margin: 0;
  color: var(--login-muted);
  font-size: 14px;
  line-height: 1.55;
}

.login-message.success {
  color: #14532d;
  background: #dcfce7;
  border-color: #bbf7d0;
}

.change-password-inline-error {
  margin-top: 0;
}

.change-password-submit {
  margin-top: 0;
}

.change-password-actions {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.change-password-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  color: #0f766e;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.18s ease, background 0.18s ease;
}

.change-password-link:hover,
.change-password-link:focus-visible {
  color: #0f5f59;
  background: #eefdfb;
  outline: none;
}

@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .login-shell {
    justify-content: flex-start;
    width: 100%;
    max-width: 420px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 44px 18px 24px;
    overflow-y: visible;
  }

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

  .login-logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .login-logo img {
    border-radius: 16px;
  }

  .login-brand h1 {
    font-size: 28px;
    line-height: 1.2;
  }

  .login-brand p {
    font-size: 13px;
  }

  .login-card {
    width: 100%;
    padding: 24px 20px;
    border-radius: 22px;
  }

  .login-input,
  .login-submit {
    height: 48px;
    font-size: 16px;
  }

  .password-toggle {
    width: 42px;
    height: 42px;
  }

  .login-footer {
    margin-top: 22px;
    font-size: 12px;
  }

  .change-password-card {
    gap: 14px;
    padding: 24px 20px;
    border-radius: 22px;
  }

  .change-password-head h2 {
    font-size: 22px;
  }

  .change-password-head p {
    font-size: 13px;
  }

  .change-password-actions {
    margin-top: 0;
  }
}

@media (max-height: 520px) {
  .login-shell {
    justify-content: flex-start;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .login-brand {
    margin-bottom: 16px;
    gap: 5px;
  }

  .login-logo {
    width: 44px;
    height: 44px;
    margin-bottom: 4px;
  }

  .login-brand h1 {
    font-size: 24px;
  }

  .login-card {
    padding: 20px;
  }
}
