:root {
  --primary: #2f6bf3;
  --primary-dark: #1d54d8;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --line: #e8eaed;
  --danger: #e5484d;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55;
}
.page {
  max-width: 640px; margin: 0 auto; padding: 0 14px calc(90px + env(safe-area-inset-bottom));
}
.header {
  max-width: 640px; margin: 0 auto; padding: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-size: 20px; font-weight: 700; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--primary); letter-spacing: 2px; }
.hdr-actions { display: flex; gap: 8px; align-items: center; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(31,35,41,.05);
}
.card h2 { margin: 0 0 12px; font-size: 17px; }
.card h3 { margin: 16px 0 8px; font-size: 15px; }
.sub { color: var(--text-2); font-size: 13px; }
.muted { color: var(--text-3); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 10px 18px; font-size: 15px; font-weight: 600;
  cursor: pointer; background: var(--primary); color: #fff; text-decoration: none;
  transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn.block { width: 100%; }
.btn.ghost { background: #eef2fe; color: var(--primary); }
.btn.plain { background: #f1f2f5; color: var(--text); }
.btn.danger { background: #fdebec; color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

input[type=text], input[type=tel], input[type=password], input[type=search], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 照片网格 */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f1f2f5; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item .del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: none; font-size: 13px; line-height: 22px;
  text-align: center; cursor: pointer; padding: 0;
}
.photo-add {
  aspect-ratio: 1; border: 1.5px dashed #c9cdd4; border-radius: 10px; background: #fafbfc;
  color: var(--text-3); font-size: 26px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-direction: column; gap: 2px;
}
.photo-add span { font-size: 11px; }
.photo-add.loading { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* 选择题 */
.q-block { margin-bottom: 14px; }
.q-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.q-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 13.5px;
  cursor: pointer; background: #fff; color: var(--text-2); user-select: none;
}
.chip.on { background: #eef2fe; border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* 列表 */
.cust-item {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border-radius: var(--radius); padding: 13px 14px; margin-bottom: 10px;
  text-decoration: none; color: var(--text); box-shadow: 0 1px 3px rgba(31,35,41,.05);
}
.avatar {
  width: 44px; height: 44px; border-radius: 12px; background: #eef2fe; color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700;
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.cust-main { flex: 1; min-width: 0; }
.cust-name { font-weight: 700; font-size: 15.5px; }
.cust-name .co { color: var(--text-2); font-weight: 500; }
.cust-meta { color: var(--text-3); font-size: 12.5px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 底部栏 */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%);
}
.bottom-bar .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 10px; }
.bottom-bar .btn { flex: 1; }

/* 详情 */
.dl { display: grid; grid-template-columns: 76px 1fr; gap: 8px 10px; font-size: 14.5px; }
.dl dt { color: var(--text-3); margin: 0; }
.dl dd { margin: 0; word-break: break-all; }
.photo-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-wall img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; cursor: zoom-in; }

/* 模板编辑器 */
.tpl-q { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; background: #fff; }
.tpl-q .q-head { display: flex; gap: 8px; margin-bottom: 8px; }
.tpl-q .q-head input[type=text] { flex: 1; }
.opt-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.opt-row input { flex: 1; padding: 8px 10px; font-size: 14px; }
.icon-btn { border: none; background: #f1f2f5; border-radius: 8px; width: 34px; height: 34px;
  font-size: 16px; cursor: pointer; color: var(--text-2); flex-shrink: 0; }
.icon-btn.del { background: #fdebec; color: var(--danger); }

/* toast / modal */
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(31,35,41,.88); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 99; display: none; max-width: 80vw; text-align: center;
}
.empty { text-align: center; color: var(--text-3); padding: 50px 0; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* 登录页 */
.login-wrap { max-width: 400px; margin: 0 auto; padding: 60px 20px; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .logo-circle {
  width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 22px;
  background: linear-gradient(135deg, #3d7bff, #1d54d8); color: #fff; font-size: 32px;
  display: flex; align-items: center; justify-content: center;
}

/* 大图预览 */
#lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 100;
  display: none; align-items: center; justify-content: center; cursor: zoom-out;
}
#lightbox img { max-width: 96vw; max-height: 96vh; object-fit: contain; }

/* PC 适配 */
@media (min-width: 700px) {
  body { font-size: 15px; }
  .page { max-width: 760px; }
  .header { max-width: 760px; }
  .bottom-bar .inner { max-width: 760px; }
}
