:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --border: #e5eaf2;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --down: #dc2626;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid; place-items: center;
  background: radial-gradient(900px 420px at 15% -10%, #dce8ff 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 30px 30px 22px;
  box-shadow: 0 18px 46px rgba(30, 58, 95, .11);
  text-align: center;
}
.brand-mark {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px;
  background: linear-gradient(140deg, #2563eb, #0ea5e9); color: #fff;
  font-size: 24px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .28);
}
h1 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.sub { margin: 4px 0 16px; color: var(--muted); font-size: 12.5px; }
.secure-note {
  background: var(--primary-soft); border: 1px solid #dbeafe; color: #1d4ed8;
  border-radius: 10px; padding: 9px 12px; font-size: 12px; line-height: 1.5;
  margin-bottom: 18px; text-align: left;
  display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline;
}
.secure-note span { color: #3b6fc4; }

.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-bottom: 13px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
/* 16px 可避免 iOS Safari 聚焦时自动放大页面 */
input[type="text"], input[type="password"] {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 13px; min-height: 48px; outline: none; transition: .16s;
  appearance: none; -webkit-appearance: none;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 66px; }
.toggle-pw {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--primary);
  font-family: inherit; font-size: 12.5px; font-weight: 650;
  padding: 10px 12px; min-height: 40px; cursor: pointer; border-radius: 8px;
  touch-action: manipulation;
}
.toggle-pw:active { background: var(--primary-soft); }

.remember {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 4px 2px 14px; cursor: pointer; font-size: 13px; font-weight: 600;
  touch-action: manipulation;
}
.remember input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkmark {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid #cbd5e1; background: #fff; position: relative; transition: .16s;
}
.remember input:checked + .checkmark { background: var(--primary); border-color: var(--primary); }
.remember input:checked + .checkmark::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.remember input:focus-visible + .checkmark { box-shadow: 0 0 0 3px rgba(37, 99, 235, .2); }
.remember-text { display: flex; flex-direction: column; line-height: 1.35; }
.remember-text small { color: var(--faint); font-size: 11px; font-weight: 400; margin-top: 2px; }

.btn {
  width: 100%; font-family: inherit; font-size: 15px; font-weight: 650;
  color: #fff; background: var(--primary); border: 1px solid var(--primary);
  border-radius: 12px; padding: 13px; min-height: 50px; cursor: pointer;
  transition: .16s; touch-action: manipulation;
}
.btn:active { background: #1d4ed8; transform: scale(.99); }
.btn:disabled { opacity: .65; cursor: wait; }
.login-error {
  background: #fdecec; border: 1px solid #fecaca; color: var(--down);
  border-radius: 9px; padding: 10px 11px; font-size: 12.5px; text-align: left;
  margin-bottom: 12px; animation: shake .28s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.mobile-tips {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 16px;
}
.mobile-tips span {
  font-size: 11px; color: var(--muted); background: #f8fafc;
  border: 1px solid var(--border); border-radius: 20px; padding: 3px 9px;
}
.foot { margin: 14px 0 0; color: var(--faint); font-size: 11.5px; }

@media (max-width: 480px) {
  body { padding-left: 16px; padding-right: 16px; align-items: start; }
  .login-wrap { max-width: 100%; margin-top: max(8px, env(safe-area-inset-top)); }
  .login-card { padding: 26px 20px 20px; border-radius: 18px; }
  .brand-mark { width: 48px; height: 48px; font-size: 22px; }
  h1 { font-size: 21px; }
}
@media (max-height: 620px) {
  body { align-items: start; }
  .login-card { padding-top: 18px; }
  .brand-mark { margin-bottom: 8px; }
  .sub { margin-bottom: 10px; }
  .secure-note { margin-bottom: 12px; }
}
