:root {
  color-scheme: dark;
  --page: #171717;
  --surface: #212121;
  --surface-hover: #2a2a2a;
  --text: #ececec;
  --muted: #a7a7a7;
  --border: #383838;
  --accent: #10a37f;
  --accent-hover: #159b7e;
  --danger: #ff8f8f;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f4f4f4;
  --text: #212121;
  --muted: #676767;
  --border: #dedede;
  --accent: #0d8f70;
  --accent-hover: #087d62;
  --danger: #c83232;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.09);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.login-header {
  position: fixed;
  z-index: 5;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 17px;
}

.icon-button,
.password-toggle {
  display: grid;
  place-items: center;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: transparent;
  font-size: 19px;
}

.icon-button:hover,
.password-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.login-main {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 88px 24px 40px;
}

.login-panel {
  width: min(100%, 420px);
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 24px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 21px;
}

h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.login-intro {
  margin: 9px 0 28px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.field-label {
  display: block;
  margin: 0 0 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
}

.input-shell {
  display: flex;
  align-items: center;
  height: 50px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--page);
  color: var(--muted);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.input-shell > i {
  margin-left: 15px;
  font-size: 18px;
}

.input-shell input {
  min-width: 0;
  height: 100%;
  flex: 1;
  padding: 0 13px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.input-shell input::placeholder {
  color: var(--muted);
  opacity: 0.72;
}

.password-toggle {
  width: 42px;
  height: 42px;
  margin-right: 4px;
  border-radius: 10px;
  background: transparent;
  font-size: 18px;
}

.remember-option {
  display: flex;
  min-height: 24px;
  align-items: center;
  gap: 9px;
  margin: -2px 1px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.4;
  user-select: none;
}

.remember-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.remember-option span {
  flex: 1;
}

.remember-option small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.remember-option:hover span {
  color: var(--text);
}

.login-error {
  min-height: 20px;
  margin: -4px 0 9px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.55;
}

.login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  gap: 8px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 160ms ease, transform 100ms ease;
}

.login-button:hover {
  background: var(--accent-hover);
}

.login-button:active {
  transform: scale(0.99);
}

.login-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.login-button .ph-circle-notch {
  animation: spin 800ms linear infinite;
}

.login-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 11px;
}

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

@media (max-width: 520px) {
  .login-header {
    padding: 0 16px;
  }

  .login-main {
    align-items: start;
    padding: 104px 16px 28px;
  }

  .login-panel {
    padding: 28px 22px;
    border-radius: 19px;
    box-shadow: none;
  }
}

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