/* =========================================================================
 * 登录页（独立样式，不依赖 styles.css）
 * -------------------------------------------------------------------------
 * 桌面：左侧深色品牌区 + 右侧白色登录卡（46 / 54 分栏）
 * 手机：品牌区折叠成顶部深色卡，表单铺满，输入框 16px 起（iOS 不会自动放大），
 *       底部吃 safe-area-inset-bottom，按钮 52px 高方便拇指
 * ========================================================================= */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --border: #e5e8ee;
  --border-strong: #d4d9e3;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #9096a1;
  --brand: #2563eb;
  --brand-2: #3b82f6;
  --danger: #d92d20;
  --navy: #0b1426;
  --radius: 12px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, p { margin: 0; }

/* ------------------------------- 布局 ------------------------------- */

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 46% 1fr;
}

/* ---------------------------- 左侧品牌区 ---------------------------- */

.brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 44px 48px 40px;
  color: #fff;
  background:
    radial-gradient(900px 520px at 12% -6%, rgba(59, 130, 246, .55), transparent 62%),
    radial-gradient(680px 460px at 96% 106%, rgba(124, 92, 255, .38), transparent 60%),
    linear-gradient(158deg, #0b1426 0%, #101d36 48%, #0a1222 100%);
}

/* 细网格纹理：让深色块不显得平 */
.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(120% 90% at 30% 10%, #000 40%, transparent 82%);
  pointer-events: none;
}

.brand-glow {
  position: absolute;
  width: 460px;
  height: 460px;
  right: -170px;
  top: 16%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 150, 255, .32), transparent 68%);
  filter: blur(10px);
  pointer-events: none;
}

.brand-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  box-shadow: 0 6px 16px rgba(37, 99, 235, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
}

.brand-name {
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
}

.brand-main { position: relative; z-index: 1; }

.brand-main h1 {
  font-size: clamp(30px, 3.2vw, 42px);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 14px;
}

.brand-main h1 span {
  background: linear-gradient(100deg, #8ab4ff, #c9d9ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, .62);
  margin-bottom: 30px;
}

.brand-chart {
  width: 100%;
  max-width: 340px;
  height: 96px;
  display: block;
  margin-bottom: 26px;
  opacity: .95;
}

.brand-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 11px;
  font-size: 13px;
  color: rgba(255, 255, 255, .66);
}

.brand-points li {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-points li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #5b8cff;
  box-shadow: 0 0 0 4px rgba(91, 140, 255, .16);
  flex: none;
}

.brand-points b { color: #fff; font-weight: 600; }

.brand-foot {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: rgba(255, 255, 255, .34);
  letter-spacing: .04em;
}

/* ----------------------------- 右侧表单区 ----------------------------- */

.panel {
  display: grid;
  place-items: center;
  padding: 48px 32px;
  background:
    radial-gradient(760px 420px at 78% -10%, rgba(37, 99, 235, .07), transparent 62%),
    var(--bg);
}

.panel-inner {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 32px 30px;
  box-shadow:
    0 1px 2px rgba(16, 24, 40, .04),
    0 18px 44px -22px rgba(16, 24, 40, .22);
}

/* 手机上才出现的品牌条 */
.mobile-brand { display: none; }

.panel-head h2 {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.panel-head p {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 13px;
}

/* ------------------------------- 表单 ------------------------------- */

#loginForm { margin-top: 26px; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
  letter-spacing: .01em;
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fbfcfd;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
  appearance: none;
}

.field input::placeholder { color: var(--text-3); }

.field input:hover { border-color: #c2c9d6; }

.field input:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

/* 浏览器自动填充：保持白底黑字，别变成一片淡黄 */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fbfcfd inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
}

/* 密码框 + 显示/隐藏按钮 */
.pwd-wrap { position: relative; }

.pwd-wrap input { padding-right: 48px; }

.pwd-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: color .15s, background .15s;
}

.pwd-toggle:hover { color: var(--text-2); background: #f1f3f7; }

.pwd-toggle svg { width: 19px; height: 19px; display: block; }

.pwd-toggle .eye-off { display: none; }

.pwd-toggle[aria-pressed="true"] .eye-open { display: none; }

.pwd-toggle[aria-pressed="true"] .eye-off { display: block; }

/* 错误提示 */
.form-msg {
  margin: 2px 0 14px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fef3f2;
  border: 1px solid #fbd9d5;
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}

/* 提交按钮 */
.submit {
  position: relative;
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgba(37, 99, 235, .68), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: filter .15s, transform .06s, box-shadow .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.submit:hover { filter: brightness(1.05); }

.submit:active { transform: translateY(1px); }

.submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .28), 0 10px 22px -10px rgba(37, 99, 235, .68);
}

.submit:disabled { cursor: progress; filter: saturate(.9) brightness(.98); }

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  display: none;
  animation: spin .7s linear infinite;
}

.submit.is-loading .spinner { display: inline-block; }

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

/* 错误抖动：给「密码错了」一个不用读字的反馈 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-6px); }
  36% { transform: translateX(5px); }
  54% { transform: translateX(-4px); }
  72% { transform: translateX(3px); }
}

.panel-inner.is-shaking { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }

.panel-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #f0f2f6;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.7;
}

/* 入场：卡片轻轻上浮，不要弹跳 */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-inner { animation: riseIn .45s cubic-bezier(.2, .7, .3, 1) both; }

/* ------------------------------- 手机端 ------------------------------- */

@media (max-width: 860px) {
  .auth {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  /* 左侧整块深色面板收起来，信息由 .mobile-brand 承担 */
  .brand { display: none; }

  .panel {
    place-items: center;
    align-content: center;
    padding:
      calc(18px + env(safe-area-inset-top))
      18px
      calc(24px + env(safe-area-inset-bottom));
    background:
      radial-gradient(520px 300px at 50% -8%, rgba(37, 99, 235, .10), transparent 70%),
      var(--bg);
  }

  .panel-inner {
    max-width: 460px;
    padding: 22px 18px 20px;
    border-radius: 18px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -22px -18px 20px;
    padding: 16px 18px;
    border-radius: 18px 18px 0 0;
    color: #fff;
    background:
      radial-gradient(320px 180px at 10% -30%, rgba(59, 130, 246, .55), transparent 70%),
      linear-gradient(150deg, #0b1426, #14243f);
  }

  .mobile-brand .brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 12px;
  }

  .mobile-brand strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .01em;
  }

  .mobile-brand small {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, .55);
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .panel-head h2 { font-size: 21px; }

  /* 16px 起：iOS 聚焦时不会自动放大页面 */
  .field input { height: 50px; font-size: 16px; }

  .field label { font-size: 12px; }

  .submit { height: 52px; font-size: 16px; border-radius: 13px; }

  .pwd-toggle { width: 40px; height: 40px; }
}

/* 小屏（iPhone SE / 320 宽）再收一点间距，保证一屏能看到按钮 */
@media (max-width: 380px) {
  .panel { padding-left: 14px; padding-right: 14px; }
  .panel-inner { padding: 18px 14px 16px; }
  .mobile-brand { margin: -18px -14px 16px; padding: 14px; }
  .panel-head h2 { font-size: 19px; }
  #loginForm { margin-top: 20px; }
  .field { margin-bottom: 14px; }
}

/* 横屏矮屏：允许滚动，别把按钮顶出视口 */
@media (max-height: 480px) and (max-width: 860px) {
  .panel { place-items: start center; }
}

@media (prefers-reduced-motion: reduce) {
  .panel-inner, .panel-inner.is-shaking, .spinner { animation: none !important; }
  * { transition-duration: .01ms !important; }
}
