:root, .theme-snapshot[data-theme="light"] {
  color-scheme: light;
  --page: #f7f9fc;
  --card: rgba(255, 255, 255, .9);
  --text: #252830;
  --muted: #898d96;
  --field: #f7f8fa;
  --field-border: #e9ebef;
  --field-focus: #92969f;
  --card-border: rgba(255, 255, 255, .95);
  --button: #3b82f6;
  --button-hover: #2563eb;
  --button-text: #fff;
  --shadow: 0 28px 80px -20px rgba(39, 52, 78, .2), 0 4px 16px rgba(39, 52, 78, .035);
  --ring: rgba(102, 152, 230, .13);
  --dot: rgba(80, 134, 218, .2);
  --glow-opacity: .34;
}

:root[data-theme="dark"], .theme-snapshot[data-theme="dark"] {
  color-scheme: dark;
  --page: #111419;
  --card: rgba(29, 33, 40, .94);
  --text: #eff0f3;
  --muted: #969ca8;
  --field: #171b21;
  --field-border: #30353e;
  --field-focus: #7d8592;
  --card-border: rgba(255, 255, 255, .075);
  --button: #3b82f6;
  --button-hover: #2563eb;
  --button-text: #fff;
  --shadow: 0 32px 90px -16px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .2);
  --ring: rgba(105, 157, 248, .12);
  --dot: rgba(115, 162, 241, .22);
  --glow-opacity: .17;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-weight: 400; -webkit-font-smoothing: antialiased; }
body :where(h1, h2, h3, strong, b, .brand-name) { font-weight: 600; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--text); outline-offset: 5px; }
svg { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }

.login-page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
  color: var(--text);
  background: var(--page);
  transition: background-color .5s ease, color .5s ease;
}
.login-background { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.background-glow { position: absolute; border-radius: 50%; filter: blur(68px); opacity: var(--glow-opacity); transition: opacity .5s ease; }
.background-glow-one { width: 510px; height: 510px; top: -150px; left: -60px; background: radial-gradient(circle, #9bc4ff, #c3dcff 48%, transparent 72%); }
.background-glow-two { width: 620px; height: 620px; bottom: -270px; right: -70px; background: radial-gradient(circle, #92b8ff, #bbd5ff 45%, transparent 72%); }
.background-ring { position: absolute; width: 560px; height: 560px; border: 1px solid var(--ring); border-radius: 50%; transition: border-color .5s ease; }
.background-ring::after { position: absolute; content: ""; inset: 38px; border: 1px solid var(--ring); border-radius: inherit; transition: border-color .5s ease; }
.background-ring-one { left: -265px; top: 22%; }
.background-ring-two { right: -200px; bottom: -240px; width: 660px; height: 660px; }
.background-dots { position: absolute; top: 22%; right: 11%; width: 160px; height: 120px; background-image: radial-gradient(var(--dot) 1px, transparent 1px); background-size: 15px 15px; -webkit-mask-image: linear-gradient(145deg, #000, transparent 90%); mask-image: linear-gradient(145deg, #000, transparent 90%); }

.login-header { position: absolute; top: 30px; left: 40px; right: 40px; display: flex; align-items: center; justify-content: space-between; gap: 20px; z-index: 1; }
.login-brand { display: inline-flex; align-items: center; min-width: 0; gap: 16px; color: var(--text); text-decoration: none; }
.brand-logo { display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 6px 8px; background: #fff; border-radius: 9px; }
.brand-logo img { display: block; max-width: 110px; height: 30px; object-fit: contain; }
.brand-divider { width: 1px; height: 22px; background: var(--field-border); flex-shrink: 0; }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: .5px; max-width: 240px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.theme-toggle { height: 40px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; border: 1px solid var(--field-border); border-radius: 20px; background: var(--card); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, .025); transition: transform .2s, background-color .2s; font-size: 12px; }
.theme-toggle:hover { transform: translateY(-2px); }
.theme-toggle:disabled { cursor: default; }
.theme-icons { position: relative; display: block; width: 17px; height: 17px; flex-shrink: 0; }
.theme-icon { position: absolute; inset: 0; width: 17px; height: 17px; transition: opacity .45s ease, transform .55s cubic-bezier(.22, 1, .36, 1); }
.theme-icon-sun { opacity: 0; transform: rotate(-100deg) scale(.4); }
.theme-icon-moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: rotate(100deg) scale(.4); }
[data-theme="dark"] .theme-icon-sun { opacity: 1; transform: rotate(0) scale(1); }

/* Keep the previous theme above the page while a circular opening expands. */
.theme-snapshot { position: fixed; inset: 0; z-index: 1000; overflow: hidden; pointer-events: none; }
.theme-snapshot *, .theme-snapshot *::before, .theme-snapshot *::after { transition: none !important; animation: none !important; }
.theme-snapshot[data-theme="light"] .theme-icon-moon { opacity: 1; transform: rotate(0) scale(1); }
.theme-snapshot[data-theme="light"] .theme-icon-sun { opacity: 0; transform: rotate(-100deg) scale(.4); }
:root.theme-reveal .login-page,
:root.theme-reveal .login-card,
:root.theme-reveal .theme-toggle,
:root.theme-reveal .input-wrap,
:root.theme-reveal .input-wrap input,
:root.theme-reveal .input-wrap > svg,
:root.theme-reveal .login-submit,
:root.theme-reveal .background-glow,
:root.theme-reveal .background-ring,
:root.theme-reveal .background-ring::after { transition: none; }

.login-main { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 100vh; min-height: 100svh; padding: 104px 24px; }
.login-card { width: 420px; max-width: 100%; padding: 34px 38px 38px; border: 1px solid var(--card-border); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); transition: background-color .5s ease, box-shadow .5s ease, border-color .5s ease; }
.login-form { display: flex; flex-direction: column; gap: 19px; }
.form-field label { display: block; margin: 0 0 9px; font-size: 12px; font-weight: 500; line-height: 1.4; }
.input-wrap { position: relative; display: flex; align-items: center; min-width: 0; height: 49px; border: 1px solid var(--field-border); border-radius: 10px; background: var(--field); transition: border-color .2s, box-shadow .2s, background-color .2s; }
.input-wrap:focus-within { border-color: var(--field-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 6%, transparent); }
.input-wrap > svg { width: 17px; height: 17px; margin-left: 15px; color: var(--muted); }
.input-wrap input { width: 100%; min-width: 0; height: 100%; padding: 0 14px 0 11px; color: var(--text); border: 0; border-radius: inherit; outline: 0; background: transparent; font-size: 13px; }
.input-wrap input::placeholder { color: var(--muted); opacity: .8; }
.input-wrap input:-webkit-autofill { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 100px var(--field) inset; caret-color: var(--text); }
.password-toggle { display: flex; align-items: center; justify-content: center; align-self: stretch; width: 43px; flex-shrink: 0; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.password-toggle:hover { color: var(--text); }
.password-toggle svg { width: 18px; height: 18px; }
.eye-slash { display: none; }
.password-toggle[aria-pressed="true"] .eye-slash { display: block; }
.captcha-row { display: flex; gap: 11px; }
.captcha-row .input-wrap { flex: 1; }
.captcha-row .input-wrap > svg { flex-shrink: 0; }
.captcha-help { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.captcha-refresh { width: 130px; height: 50px; flex-shrink: 0; padding: 0; overflow: hidden; border: 1px solid var(--field-border); border-radius: 8px; background: #fff; transition: opacity .2s; }
.captcha-refresh:hover { opacity: .78; }
.captcha-refresh img { width: 100%; height: 100%; display: block; object-fit: contain; }
.login-submit { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 49px; margin-top: 6px; padding: 0 20px; border: 1px solid transparent; border-radius: 10px; color: var(--button-text); background: var(--button); font-size: 13px; font-weight: 500; letter-spacing: .5px; box-shadow: 0 6px 14px rgba(0, 0, 0, .09); transition: transform .2s, background-color .2s, box-shadow .2s; }
.login-submit:hover:not(:disabled) { transform: translateY(-2px); background: var(--button-hover); box-shadow: 0 9px 20px rgba(0, 0, 0, .14); }
.login-submit:active:not(:disabled) { transform: translateY(0); }
.login-submit:disabled { cursor: wait; opacity: .78; }
.login-submit.is-incomplete { cursor: not-allowed; opacity: .5; box-shadow: none; }
.submit-arrow { position: absolute; right: 18px; width: 17px; height: 17px; }
.submit-spinner { display: none; width: 15px; height: 15px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: login-spin .8s linear infinite; }
.login-submit[aria-busy="true"] .submit-arrow { display: none; }
.login-submit[aria-busy="true"] .submit-spinner { display: block; }
.login-error { margin: -2px 0 -4px; padding: 10px 12px; border: 1px solid rgba(211, 77, 77, .2); border-radius: 8px; background: rgba(211, 77, 77, .06); color: #c54a4a; font-size: 12px; line-height: 1.6; }
[data-theme="dark"] .login-error { color: #f19c9c; }
.login-footer { position: absolute; bottom: 26px; left: 24px; right: 24px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); font-size: 11px; line-height: 1.7; text-align: center; }

@keyframes login-spin { to { transform: rotate(360deg); } }
@media (min-width: 1600px) { .background-glow-one { left: 7%; } .background-glow-two { right: 4%; } }
@media (max-width: 600px) {
  .login-header { top: 22px; left: 20px; right: 20px; gap: 14px; }
  .login-brand { gap: 10px; }
  .brand-logo { padding: 4px 5px; border-radius: 7px; }
  .brand-logo img { height: 26px; max-width: 85px; }
  .brand-name { max-width: 145px; font-size: 14px; letter-spacing: 0; }
  .brand-divider { height: 18px; }
  .theme-toggle { width: 36px; height: 36px; padding: 0; }
  #theme-label { display: none; }
  .login-main { padding: 82px 20px; }
  .login-card { padding: 26px 26px 28px; border-radius: 20px; }
  .login-form { gap: 17px; }
  .input-wrap, .login-submit { height: 47px; }
  .captcha-refresh { width: 122px; height: 47px; }
  .background-dots { right: -50px; top: 15%; }
  .background-ring-one { left: -450px; }
  .login-footer { bottom: 23px; font-size: 10px; }
}
@media (max-width: 360px) { .brand-name { max-width: 100px; } .login-card { padding-left: 22px; padding-right: 22px; } .captcha-refresh { width: 104px; height: 40px; } }
@media (max-height: 760px) and (min-width: 601px) {
  .login-main { padding-top: 82px; padding-bottom: 82px; }
  .login-card { padding-top: 26px; padding-bottom: 28px; }
  .login-form { gap: 17px; }
  .input-wrap, .login-submit { height: 47px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
