/* ============================================================
   IECC 社员信息确认 · 样式
   沿用社团官网的视觉：白底、浅灰分组、#0071e3 蓝、PingFang SC
   ============================================================ */

:root {
  --gray-50: #fbfbfd;
  --gray-100: #f5f5f7;
  --gray-200: #e8e8ed;
  --gray-300: #d2d2d7;
  --gray-400: #a1a1a6;
  --gray-600: #6e6e73;
  --gray-800: #1d1d1f;
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.08);
  --green: #1a9c50;
  --green-soft: rgba(26, 156, 80, 0.1);
  --orange: #c2740a;
  --orange-soft: rgba(194, 116, 10, 0.12);
  --red: #d0021b;
  --red-soft: rgba(208, 2, 27, 0.08);
  --radius: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --font: "PingFang SC", "苹方", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { display: block; }
.hidden { display: none !important; }

/* ---------- 页面骨架 ---------- */
.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 64px;
}
.wrap.admin { max-width: 860px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 22px 0 20px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--gray-600);
}
.topbar img { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; }
.topbar .spacer { flex: 1; }

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 30px 26px;
}

h1 {
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.2;
  margin-bottom: 22px;
}

/* ---------- 搜索 ---------- */
.search {
  width: 100%;
  padding: 13px 16px;
  font-size: 16px;
  background: var(--gray-100);
  border: 1px solid transparent;
  border-radius: 14px;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
  margin-bottom: 16px;
}
.search:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search::placeholder { color: var(--gray-400); }

/* ---------- 名字列表 ---------- */
.name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 9px;
}

.name {
  padding: 14px 8px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.2px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  transition: transform 0.14s var(--ease), border-color 0.2s, background 0.2s, color 0.2s;
}
.name:hover { border-color: var(--accent); color: var(--accent); }
.name:active { transform: scale(0.96); }
.name.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.name-none {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  font-size: 14px;
  color: var(--gray-400);
  text-align: center;
  border-top: 1px solid var(--gray-200);
}

.empty { padding: 28px 0; text-align: center; color: var(--gray-400); font-size: 14px; }

/* ---------- 第二页：两个选项 ---------- */
.who {
  font-size: 14px;
  color: var(--gray-400);
  margin-bottom: 6px;
}
.who b { font-size: 22px; font-weight: 600; color: var(--gray-800); letter-spacing: -0.4px; }

/* 左边表格 + 右边证件照 */
.info-wrap {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: 2px 0 22px;
}
.info {
  flex: 1;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  overflow: hidden;
}

/* 证件照（一寸 25×35mm，比例 1 : 1.4） */
.photo-box {
  flex: none;
  width: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.photo-frame {
  position: relative;
  width: 128px;
  aspect-ratio: 1 / 1.4;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  border: 1.5px dashed var(--gray-300);
  border-radius: 10px;
  background: var(--gray-50);
  color: var(--gray-300);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.photo-frame:active { transform: scale(0.98); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-frame .person-icon { width: 46%; height: 46%; flex: none; }
.photo-tip { font-size: 13px; font-weight: 500; color: currentColor; }
.photo-frame .photo-tip.swap {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 400;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 980px;
}
.photo-box.filled .photo-frame { border-style: solid; border-color: var(--gray-200); }
.photo-box.missing .photo-frame { border-color: var(--red); background: var(--red-soft); color: var(--red); }

/* 电脑上：表格比较长，让证件照居中、并且大一点，看着更平衡 */
@media (min-width: 641px) {
  .info-wrap { gap: 22px; }
  .photo-box { width: 152px; align-self: center; }
  .photo-frame { width: 152px; }
  .photo-tip { font-size: 14px; }
}

.info-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 15px;
}
.info-row:last-child { border-bottom: none; }
.info-k { flex: none; width: 4.5em; color: var(--gray-400); font-size: 14px; }
.info-v { flex: 1; min-width: 0; word-break: break-word; }
.info-row.empty .info-v { color: var(--gray-400); }
.info-row.changed .info-v { color: var(--accent); font-weight: 500; }
.info-row.missing { background: var(--red-soft); }
.info-row.missing .info-k { color: var(--red); }
.info-act { flex: none; }
.info-row.editing { background: var(--gray-50); }
/* 编辑时：第一行是字段名 + 按钮，输入框/选项换到第二行，宽度更充裕 */
.info-row.editing { flex-wrap: wrap; }
.info-row.editing .info-k { flex: 1; }
.info-row.editing .info-act { order: 2; margin-left: auto; }
.info-row.editing .info-v { order: 3; flex: 1 1 100%; }
.edit {
  width: 100%;
  padding: 9px 12px;
  font-size: 15px;
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 10px;
  outline: none;
}
/* 点选式（性别 / 组别） */
.picker { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  padding: 8px 16px;
  font-size: 14px;
  color: var(--gray-600);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 980px;
  transition: all 0.18s var(--ease);
}
.pick:hover { border-color: var(--accent); color: var(--accent); }
.pick:active { transform: scale(0.96); }
.pick.on {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.25);
}
.mini {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 980px;
  white-space: nowrap;
}
.mini:active { transform: scale(0.96); }
.mini.off { background: var(--gray-100); color: var(--gray-400); }
.mini.plain { background: transparent; color: var(--gray-400); }
.warn { color: var(--red); }
.dialog .warn { margin-bottom: 8px; }

.opt {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 20px 22px;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: 16px;
  transition: all 0.18s var(--ease);
}
.opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.opt:active { transform: scale(0.985); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.opt-note {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  font-weight: 400;
  color: var(--gray-400);
}

/* 二次确认 */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.overlay.open { display: flex; }
.dialog {
  width: 100%;
  max-width: 380px;
  padding: 26px 24px 20px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  animation: pop 0.28s var(--ease);
}
.dialog h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.4px; margin-bottom: 10px; }
.dialog p { font-size: 14px; line-height: 1.7; color: var(--gray-600); }
.dialog-actions { display: flex; gap: 10px; margin-top: 22px; }
.dialog-actions button {
  flex: 1;
  padding: 13px;
  font-size: 15px;
  font-weight: 500;
  border-radius: 980px;
  transition: transform 0.16s var(--ease);
}
.dialog-actions button:active { transform: scale(0.97); }
.btn-plain { background: var(--gray-100); color: var(--gray-800); }
.btn-dark { background: var(--gray-800); color: #fff; }

/* 有问题的项目：多选 + 每项一个输入框 */
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.field {
  padding: 13px 6px;
  font-size: 15px;
  font-weight: 500;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  transition: all 0.16s var(--ease);
}
.field:hover { border-color: var(--accent); color: var(--accent); }
.field:active { transform: scale(0.96); }
.field.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.issue-row { margin-top: 12px; }
.issue-row .tag {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--gray-400);
}
.issue-input {
  width: 100%;
  padding: 13px 15px;
  font-size: 16px;
  background: var(--gray-100);
  border: 1px solid transparent;
  border-radius: 12px;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}
.issue-input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.issue-input::placeholder { color: var(--gray-400); }

.submit {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 16px;
  font-size: 17px;
  font-weight: 500;
  color: #fff;
  background: var(--gray-800);
  border-radius: 980px;
  transition: transform 0.18s var(--ease), opacity 0.2s;
}
.submit:active { transform: scale(0.97); }
.submit[disabled] { opacity: 0.35; }

.back {
  display: inline-flex;
  align-items: center;
  margin: -6px 0 14px -6px;
  padding: 6px 8px;
  font-size: 15px;
  color: var(--accent);
}

/* ---------- 完成 ---------- */
.done { text-align: center; padding: 56px 26px; }
.done .tick {
  width: 68px; height: 68px; margin: 0 auto 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; color: #fff;
  background: var(--green);
}
.done h1 { margin-bottom: 6px; }
.done p { color: var(--gray-400); font-size: 14px; }
.link { margin-top: 22px; font-size: 15px; color: var(--accent); }

/* 排查信息（?debug=1） */
.debug {
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--gray-400);
  text-align: center;
  word-break: break-all;
}

/* ---------- 管理端 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 16px 14px;
}
.stat b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -1px; }
.stat span { font-size: 12px; color: var(--gray-400); }

.chips { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  flex: none;
  padding: 9px 16px;
  font-size: 14px;
  background: #fff;
  border-radius: 980px;
  color: var(--gray-600);
  transition: all 0.18s var(--ease);
}
.chip.on { background: var(--gray-800); color: #fff; }

.list { display: grid; gap: 10px; }

.row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.row .info { flex: 1; min-width: 0; }
.row .nm { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
.row .cl { font-size: 13px; color: var(--gray-400); margin-top: 2px; }
.row .cl2 { font-size: 12px; color: var(--gray-400); margin-top: 3px; line-height: 1.6; }
.row .msg {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.row .time { font-size: 12px; color: var(--gray-400); }

.badge {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 980px;
  white-space: nowrap;
}
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.issue { background: var(--orange-soft); color: var(--orange); }
.badge.none { background: var(--gray-100); color: var(--gray-400); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.5px; }
.ghost {
  padding: 9px 16px;
  font-size: 14px;
  color: var(--accent);
  background: #fff;
  border-radius: 980px;
  box-shadow: var(--shadow-sm);
}
.list-foot { margin-top: 20px; text-align: center; }
.mini {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 980px;
}

/* ---------- 提示条 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
#toast div {
  background: rgba(29, 29, 31, 0.94);
  color: #fff;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 980px;
  animation: pop 0.3s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 12px 48px; }
  .card { padding: 24px 18px; border-radius: 18px; }
  .name-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .name { padding: 13px 6px; font-size: 15px; }
  .opt { padding: 18px; font-size: 15px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 22px; }
  .row { padding: 14px 16px; }
  .done { padding: 44px 18px; }

  /* 手机上证件照窄一点，给左边的信息让位置 */
  .info-wrap { gap: 10px; }
  .photo-box, .photo-frame { width: 104px; }
  .photo-tip { font-size: 12px; }
  .photo-frame .person-icon { width: 42%; height: 42%; }
  .info-row { gap: 10px; padding: 11px 12px; font-size: 14px; }
  .info-k { width: 3.6em; font-size: 13px; }
  .mini { padding: 5px 10px; font-size: 12px; }
}
