:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff4ff;
  --pos: #16a34a;
  --neg: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 8px 40px rgba(16, 24, 40, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ===== 背景 ===== */
.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(37, 99, 235, 0.06), transparent 60%),
    linear-gradient(180deg, #f7f8fa, #f2f3f5);
}

/* ===== 通用 ===== */
.wrap { max-width: 1040px; margin: 0 auto; padding: 56px 24px 72px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; letter-spacing: 3px; color: var(--accent);
  background: var(--accent-soft); padding: 6px 14px; border-radius: 999px; font-weight: 600;
}

/* ===== 首页 ===== */
.hero { text-align: center; margin-bottom: 44px; }
.hero h1 {
  font-size: clamp(30px, 5vw, 44px); font-weight: 700; letter-spacing: 1px;
  color: var(--text); margin-top: 18px; line-height: 1.2;
}
.hero-sub { color: var(--muted); margin-top: 12px; font-size: 15px; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .wrap { padding: 36px 16px calc(56px + env(safe-area-inset-bottom)); }
}

.member-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.member-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d7dce5; }

.avatar {
  flex: none; width: 76px; height: 76px; border-radius: 50%; overflow: hidden;
  background: var(--accent-soft); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar .ph { font-size: 28px; color: #9ca3af; }

.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-title { font-size: 13px; color: var(--accent); margin-top: 2px; }
.member-motto { font-size: 13px; color: var(--muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.member-arrow { flex: none; color: #c2c8d1; font-size: 20px; transition: color .18s ease, transform .18s ease; }
.member-card:hover .member-arrow { color: var(--accent); transform: translateX(3px); }

.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 0; }

.footer { text-align: center; color: #9ca3af; font-size: 13px; margin-top: 52px; }
.footer a { color: var(--accent); opacity: .7; }
.footer a:hover { opacity: 1; }

/* ===== 员工名片页 ===== */
body.card-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px 16px; }
.card-stage { width: 100%; max-width: 420px; }
.profile-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.pc-photo { position: relative; aspect-ratio: 4 / 3; background: var(--accent-soft); }
.pc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-photo .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 80px; color: #c7d2fe; }

.pc-body { padding: 26px 28px 30px; text-align: center; }
.pc-name { font-size: 28px; font-weight: 700; letter-spacing: 1px; }
.pc-title { margin-top: 6px; font-size: 14px; color: var(--accent); }
.pc-motto { margin-top: 12px; font-size: 14px; color: var(--muted); }

.pc-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; font-size: 14px; color: var(--muted); }
.pc-back:hover { color: var(--accent); }

.not-found { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 40px 24px; box-shadow: var(--shadow); }
.not-found h2 { font-size: 22px; }
.not-found p { color: var(--muted); margin: 12px 0 22px; }

/* ===== 管理后台 ===== */
body.admin { min-height: 100vh; }
.admin-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 34px 30px; box-shadow: var(--shadow-lg); }
.login-box h1 { font-size: 24px; font-weight: 700; }
.login-box .sub { color: var(--muted); font-size: 13px; margin: 8px 0 24px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text); font-weight: 500; margin-bottom: 7px; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); background: #fff;
  color: var(--text); font-size: 15px; padding: 11px 14px; border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.field textarea { resize: vertical; min-height: 66px; }
.field .hint { font-size: 12px; color: #9ca3af; margin-top: 5px; }
.field .req { color: var(--neg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 600;
  background: var(--accent); color: #fff;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { background: #f9fafb; border-color: #d7dce5; }
.btn.danger { background: #fff; border: 1px solid #fecaca; color: var(--neg); }
.btn.danger:hover { background: #fef2f2; }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn.block { width: 100%; }

.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 8px 0 24px; }
.admin-top h1 { font-size: 26px; font-weight: 700; }
.admin-top .actions { display: flex; gap: 10px; align-items: center; }

.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-item {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.admin-item .thumb {
  flex: none; width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 20px;
}
.admin-item .info { flex: 1; min-width: 0; }
.admin-item .n { font-weight: 600; font-size: 15px; }
.admin-item .u { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-item .ops { display: flex; gap: 8px; flex: none; }

/* ===== 模态框 ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 28px;
  box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 21px; font-weight: 700; margin-bottom: 22px; }

.img-pick { display: flex; gap: 14px; align-items: center; }
.img-pick .preview {
  flex: none; width: 88px; height: 88px; border-radius: 12px; object-fit: cover;
  background: #f9fafb; border: 1px dashed #cbd2dc;
  display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 12px; text-align: center;
  overflow: hidden;
}
.img-pick .preview img { width: 100%; height: 100%; object-fit: cover; }
.img-pick input[type="file"] { display: none; }

.modal .form-actions { display: flex; gap: 10px; margin-top: 24px; }
.modal .form-actions .btn { flex: 1; }

.uploading { opacity: .55; pointer-events: none; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: #111827; color: #fff; border-radius: 10px;
  padding: 11px 18px; font-size: 13px;
  opacity: 0; transition: opacity .25s ease, transform .25s ease; z-index: 999;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }
