:root {
  --auth-bg: #eef2f4;
  --auth-surface: #ffffff;
  --auth-surface-soft: #f6f8f9;
  --auth-line: #d9e0e4;
  --auth-line-strong: #bec9cf;
  --auth-text: #182126;
  --auth-text-soft: #58666d;
  --auth-text-faint: #7a878d;
  --auth-brand: #172126;
  --auth-brand-soft: #243239;
  --auth-primary: #2164d8;
  --auth-primary-dark: #174ea8;
  --auth-primary-soft: #eaf2ff;
  --auth-success: #087f5b;
  --auth-success-soft: #e7f6f0;
  --auth-danger: #b4233a;
  --auth-danger-soft: #fdecef;
  --auth-warning: #9a5a14;
  --auth-warning-soft: #fff3df;
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  background: var(--auth-bg);
  color: var(--auth-text);
  font-size: 14px;
  line-height: 1.5;
}

button,
input {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.66;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(33, 100, 216, 0.22);
  outline-offset: 2px;
}

a {
  color: var(--auth-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.hidden {
  display: none !important;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(300px, 0.78fr) minmax(480px, 1.22fr);
}

.auth-brand-panel {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 64px);
  background: var(--auth-brand);
  color: #ffffff;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand-mark {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: var(--auth-brand-soft);
  color: #8fb7ff;
}

.auth-brand-mark svg {
  width: 24px;
  height: 24px;
}

.auth-brand-copy strong,
.auth-brand-copy span {
  display: block;
}

.auth-brand-copy strong {
  font-size: 17px;
  font-weight: 750;
}

.auth-brand-copy span {
  margin-top: 1px;
  color: #aab8bf;
  font-size: 12px;
}

.auth-brand-message {
  max-width: 430px;
  padding: 28px 0;
}

.auth-brand-message h1 {
  max-width: 380px;
  margin: 0 0 14px;
  font-size: 38px;
  font-weight: 760;
  line-height: 1.16;
  letter-spacing: 0;
}

.auth-brand-message p {
  max-width: 380px;
  margin: 0;
  color: #b7c3c9;
  font-size: 15px;
  line-height: 1.8;
}

.auth-security-note {
  display: flex;
  max-width: 420px;
  align-items: flex-start;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #9eacb3;
  font-size: 12px;
}

.auth-security-note svg {
  margin-top: 1px;
  color: #65c7a4;
}

.auth-main {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-card {
  width: min(100%, 430px);
  padding: 34px;
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  background: var(--auth-surface);
  box-shadow: 0 16px 44px rgba(25, 39, 46, 0.1);
}

.auth-card-header {
  margin-bottom: 26px;
}

.auth-card-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: 0;
}

.auth-card-header p {
  margin: 7px 0 0;
  color: var(--auth-text-soft);
}

.auth-user-context {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: -8px 0 22px;
  padding: 11px 12px;
  border: 1px solid var(--auth-line);
  border-radius: 6px;
  background: var(--auth-surface-soft);
}

.auth-user-avatar {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--auth-primary-soft);
  color: var(--auth-primary);
  font-weight: 750;
}

.auth-user-copy {
  min-width: 0;
}

.auth-user-copy strong,
.auth-user-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-copy strong {
  font-size: 13px;
}

.auth-user-copy span {
  margin-top: 1px;
  color: var(--auth-text-soft);
  font-size: 12px;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
}

.auth-alert svg {
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.auth-alert.error {
  border-color: #f2c5cd;
  background: var(--auth-danger-soft);
  color: var(--auth-danger);
}

.auth-alert.success {
  border-color: #b9e1d2;
  background: var(--auth-success-soft);
  color: var(--auth-success);
}

.auth-alert.info {
  border-color: #c7dafb;
  background: var(--auth-primary-soft);
  color: var(--auth-primary-dark);
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field label {
  color: var(--auth-text);
  font-size: 13px;
  font-weight: 650;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  min-height: 44px;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 13px;
  z-index: 1;
  color: var(--auth-text-faint);
  pointer-events: none;
}

.auth-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 42px 10px 42px;
  border: 1px solid var(--auth-line-strong);
  border-radius: 6px;
  outline: 0;
  background: #ffffff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.auth-input.no-trailing-action {
  padding-right: 13px;
}

.auth-input:hover {
  border-color: #a8b6bd;
}

.auth-input:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px rgba(33, 100, 216, 0.12);
}

.auth-input[aria-invalid="true"] {
  border-color: var(--auth-danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 58, 0.1);
}

.password-toggle {
  position: absolute;
  right: 5px;
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--auth-text-soft);
}

.password-toggle:hover {
  background: var(--auth-surface-soft);
  color: var(--auth-text);
}

.auth-field-help {
  margin: 0;
  color: var(--auth-text-faint);
  font-size: 12px;
}

.password-checks {
  display: grid;
  gap: 6px;
  margin: -5px 0 0;
  padding: 0;
  color: var(--auth-text-faint);
  font-size: 12px;
  list-style: none;
}

.password-checks li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.password-checks svg {
  width: 14px;
  height: 14px;
}

.password-checks li.valid {
  color: var(--auth-success);
}

.auth-submit {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 3px;
  padding: 10px 16px;
  border: 1px solid var(--auth-primary);
  border-radius: 6px;
  background: var(--auth-primary);
  color: #ffffff;
  font-weight: 700;
  transition: background 140ms ease, border-color 140ms ease;
}

.auth-submit:hover:not(:disabled) {
  border-color: var(--auth-primary-dark);
  background: var(--auth-primary-dark);
}

.auth-submit .loading-icon {
  animation: auth-spin 800ms linear infinite;
}

.auth-secondary-action {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.auth-text-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--auth-text-soft);
  font-size: 13px;
}

.auth-text-button:hover {
  color: var(--auth-primary);
}

.auth-card-footer {
  margin: 24px 0 0;
  padding-top: 17px;
  border-top: 1px solid var(--auth-line);
  color: var(--auth-text-faint);
  font-size: 12px;
  text-align: center;
}

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

@media (max-width: 820px) {
  .auth-shell {
    display: block;
  }

  .auth-brand-panel {
    min-height: auto;
    padding: 22px 24px;
  }

  .auth-brand-panel::after,
  .auth-brand-message,
  .auth-security-note {
    display: none;
  }

  .auth-main {
    min-height: calc(100vh - 88px);
    align-items: flex-start;
    padding: 32px 18px;
  }
}

@media (max-width: 480px) {
  .auth-main {
    padding: 22px 12px;
  }

  .auth-card {
    padding: 25px 20px;
    box-shadow: 0 10px 28px rgba(25, 39, 46, 0.08);
  }

  .auth-card-header h2 {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
