/* ===== 登录页 ===== */
.auth-body {
  background: #fbfcfe;
  min-height: 100vh;
  display: flex;
  /* 内容超出一屏时不要裁掉顶部：用 safe center 让溢出方向可滚动 */
  align-items: safe center;
  justify-content: center;
  padding: 32px 16px;
  position: relative;
  overflow-y: auto;
}

.auth-bg {
  position: fixed;
  inset: 0;
  background-image: url('../assets/bg-auth.svg');
  background-size: cover;
  background-position: center;
  z-index: 0;
}

.auth-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.auth-card {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 30px 26px;
  box-shadow: 0 10px 40px rgba(21, 44, 84, 0.09), 0 2px 8px rgba(21, 44, 84, 0.04);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.auth-brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.3;
}

.auth-brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-title {
  font-size: 22px;
  font-weight: 650;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.auth-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 22px;
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .input { height: 42px; font-size: 14px; }

.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 42px; }

.pwd-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 7px;
  display: grid;
  place-items: center;
}

.pwd-toggle:hover { background: var(--bg-hover); }
.pwd-toggle .icon { width: 16px; height: 16px; stroke: var(--text-muted); stroke-width: 1.7; fill: none; }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-top: -2px;
}

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.auth-link {
  color: var(--accent);
  font-weight: 500;
}

.auth-link:hover { text-decoration: underline; }

.auth-error {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #f6d5d2;
  border-radius: var(--radius);
  padding: 0 12px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.18s ease;
  line-height: 1.55;
}

.auth-error.show {
  max-height: 90px;
  opacity: 1;
  padding: 10px 12px;
}

.auth-submit {
  height: 44px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 10px;
  margin-top: 2px;
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-foot {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-foot .input { height: 38px; font-size: 12.5px; font-family: var(--mono); }

.auth-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 10px 0 0;
}

.auth-copyright {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, #f1f3f6 25%, #e9ecf1 37%, #f1f3f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: 6px;
  color: transparent !important;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.sk-line { height: 12px; border-radius: 5px; }

/* 全局加载条 */
.loadbar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, #1a73e8, #6fa4fb);
  z-index: 100;
  transition: width 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.loadbar.active { opacity: 1; }

/* 空/错误状态 */
.state-box {
  padding: 44px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

.state-box .icon {
  width: 28px;
  height: 28px;
  stroke: #c4cad3;
  stroke-width: 1.5;
  fill: none;
  margin-bottom: 10px;
}

.state-box strong {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

/* 只读/无权限提示 */
.perm-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--warning-soft);
  border: 1px solid #f6e0bb;
  color: #8a5600;
  font-size: 12.5px;
  line-height: 1.6;
  margin: 0 20px 16px;
}

.perm-note .icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  margin-top: 2px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

/* ===== 注册页：字段提示 ===== */
.req { color: var(--danger); font-weight: 600; }
.opt { color: var(--text-muted); font-weight: 400; font-size: 11.5px; }

.field-hint {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  min-height: 0;
}

.field-hint.err { color: var(--danger); }
.field-hint.ok { color: var(--success); }

.auth-form .input + .field-hint:empty { display: none; }

/* ===== 密码强度 ===== */
.pwd-strength {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.pwd-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}

.pwd-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width 0.25s ease, background 0.25s ease;
}

.pwd-label {
  font-size: 11px;
  font-weight: 500;
  min-width: 28px;
  text-align: right;
  color: var(--text-muted);
}

/* ===== 注册成功 ===== */
.auth-success {
  text-align: center;
  padding: 12px 0 4px;
}

.auth-success .ok-icon {
  width: 52px;
  height: 52px;
  color: var(--success);
  margin-bottom: 14px;
}

.auth-success h2 {
  font-size: 18px;
  font-weight: 650;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.auth-success p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ===== 底部链接 ===== */
.auth-foot-links {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ===== 邀请码展示卡片（控制台用） ===== */
.aff-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

.aff-code-box {
  flex: 0 0 auto;
  padding: 14px 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eaf2fe, #f4f8ff);
  border: 1px dashed #b9d1f3;
  text-align: center;
}

.aff-code-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.aff-code-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-active);
  user-select: all;
}

.aff-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aff-stat-row {
  display: flex;
  gap: 24px;
}

.aff-stat .n {
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.aff-stat .l {
  font-size: 11.5px;
  color: var(--text-muted);
}

.aff-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.aff-link-row .input {
  font-family: var(--mono);
  font-size: 12px;
  height: 32px;
}

@media (max-width: 640px) {
  .aff-card { flex-direction: column; align-items: stretch; }
  .aff-code-box { align-self: center; }
  .aff-link-row { flex-direction: column; align-items: stretch; }
}

/* ===== 兜底：窄视口或内容超高时，顶部对齐并允许滚动 =====
   部分浏览器不支持 align-items: safe center，这里用媒体查询兜底 */
@media (max-height: 760px) {
  .auth-body {
    align-items: flex-start;
    padding-top: 20px;
    padding-bottom: 40px;
  }
}

/* 移动端同理 */
@media (max-width: 640px) {
  .auth-body {
    align-items: flex-start;
    padding-top: 20px;
    padding-bottom: 32px;
  }
}
