:root {
  --primary: #8377e5;
  --primary-dark: #6659d1;
  --text: #28273a;
  --muted: #737386;
  --line: #e5e4ef;
  --surface: #ffffff;
  --danger: #d93d4f;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: #f5f5fa;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { min-height: 100dvh; }
button, input { font: inherit; }
button { cursor: pointer; }

.login-shell {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(440px, .85fr);
  min-height: 100dvh;
  background: var(--surface);
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: clamp(32px, 5vw, 72px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 18% 88%, rgba(255,255,255,.18), transparent 30%),
    linear-gradient(145deg, #7468d9 0%, #9489ed 56%, #b5aff6 100%);
}

.brand-top { display: flex; align-items: center; gap: 14px; font-size: 19px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 14px;
  background: rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
.brand-mark svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.brand-message { position: relative; z-index: 2; margin-top: clamp(90px, 15vh, 170px); max-width: 600px; }
.brand-eyebrow { display: block; margin-bottom: 20px; font-size: 13px; font-weight: 700; letter-spacing: .18em; opacity: .72; }
.brand-message h1 { margin: 0; font-size: clamp(42px, 5vw, 68px); line-height: 1.16; letter-spacing: -.04em; }
.brand-message p { margin: 26px 0 0; max-width: 470px; font-size: 18px; line-height: 1.7; color: rgba(255,255,255,.8); }

.brand-visual { position: absolute; right: -30px; bottom: -20px; width: min(38vw, 520px); aspect-ratio: 1; }
.brand-visual img { position: absolute; right: 9%; bottom: 1%; z-index: 2; width: 42%; filter: drop-shadow(0 24px 34px rgba(58,43,143,.28)); }
.orbit { position: absolute; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; }
.orbit-one { inset: 8%; }
.orbit-two { inset: 27%; background: rgba(255,255,255,.08); }

.form-panel { display: grid; place-items: center; min-height: 100dvh; padding: 48px clamp(36px, 7vw, 110px); background: #fbfbfe; }
.login-card { width: min(100%, 440px); }
.login-card header { margin-bottom: 38px; }
.login-card header > span { display: inline-flex; padding: 7px 12px; border-radius: 999px; color: var(--primary-dark); background: #eeecff; font-size: 13px; font-weight: 650; }
.login-card h2 { margin: 18px 0 8px; font-size: 36px; line-height: 1.25; letter-spacing: -.02em; }
.login-card header p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.6; }

.field { display: block; margin-top: 22px; }
.field > span { display: block; margin-bottom: 9px; font-size: 14px; font-weight: 650; }
.input-wrap { position: relative; display: flex; align-items: center; height: 54px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .18s ease, box-shadow .18s ease; }
.input-wrap:focus-within { border-color: #aaa7bd; box-shadow: 0 0 0 3px rgba(48,49,58,.05); }
.input-wrap > svg { flex: 0 0 auto; width: 20px; margin-left: 16px; fill: none; stroke: #858496; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.input-wrap input { width: 100%; height: 100%; padding: 0 14px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 16px; }
.input-wrap input::placeholder { color: #aaa9b5; }
.input-wrap input:-webkit-autofill,
.input-wrap input:-webkit-autofill:hover,
.input-wrap input:-webkit-autofill:focus { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 1000px #fff inset; transition: background-color 9999s ease-out; }
.password-toggle { display: grid; place-items: center; flex: 0 0 48px; height: 48px; margin-right: 3px; border: 0; border-radius: 12px; color: #77768a; background: transparent; }
.password-toggle:hover { color: var(--primary-dark); background: #f3f1ff; }
.password-toggle:focus-visible, .login-button:focus-visible { outline: 3px solid rgba(102,89,209,.32); outline-offset: 2px; }
.password-toggle svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.field-error { display: block; min-height: 18px; padding-top: 6px; color: var(--danger); font-size: 13px; }
.field.has-error .input-wrap { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(217,61,79,.08); }

.login-error { display: none; margin: 4px 0 16px; padding: 12px 14px; border: 1px solid #f5c8ce; border-radius: 12px; color: #a82d3d; background: #fff3f4; font-size: 14px; line-height: 1.5; }
.login-error.show { display: block; }
.login-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 54px; margin-top: 4px; border: 0; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); box-shadow: 0 12px 28px rgba(102,89,209,.24); font-size: 16px; font-weight: 700; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.login-button:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(102,89,209,.3); }
.login-button:active { transform: translateY(0) scale(.99); }
.login-button:disabled { cursor: wait; opacity: .68; transform: none; }
.login-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-button.loading svg { display: none; }
.login-button.loading::after { content: ""; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.42); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }

.security-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 18px 0 0; color: #8a8997; font-size: 13px; }
.security-note svg { width: 17px; fill: none; stroke: #58a36a; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

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

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 260px; padding: 28px 30px; }
  .brand-message { margin-top: 52px; }
  .brand-message h1 { font-size: 36px; }
  .brand-message p { margin-top: 14px; font-size: 15px; }
  .brand-visual { right: -10px; width: 280px; opacity: .75; }
  .form-panel { min-height: auto; padding: 48px 24px 64px; }
}

@media (max-width: 520px) {
  .brand-message h1 { font-size: 31px; }
  .brand-message p { max-width: 280px; }
  .brand-visual { opacity: .42; }
  .login-card h2 { font-size: 30px; }
}

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