:root {
  /* 浅色苹果配色 */
  --bg: #eef1f8;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --border: rgba(255, 255, 255, 0.7);
  --hairline: rgba(0, 0, 0, 0.06);
  --text: #1d1d1f;
  --text2: #3a3a3c;
  --mut: #6e6e73;
  --primary: #007AFF;
  --primary-d: #0066d6;
  --ok: #34c759;
  --warn: #ff9f0a;
  --bad: #ff3b30;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 8px 30px rgba(31, 38, 135, 0.10);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color: var(--text);
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
  position: relative;
  letter-spacing: .1px;
}

/* 浅色柔光背景：低饱和蓝紫橙绿，缓慢漂移，白玻璃卡片可透出淡淡彩光 */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(38% 38% at 15% 20%, rgba(0, 122, 255, 0.20), transparent 60%),
    radial-gradient(40% 40% at 86% 14%, rgba(175, 82, 222, 0.16), transparent 60%),
    radial-gradient(45% 45% at 76% 86%, rgba(255, 149, 0, 0.13), transparent 60%),
    radial-gradient(40% 40% at 20% 86%, rgba(52, 199, 89, 0.13), transparent 60%);
  filter: blur(60px);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(2.5%, -2%) scale(1.05); }
  100% { transform: translate(-2%, 2.5%) scale(1.02); }
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 18px 80px; }

/* 顶栏 */
.top {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 14px 18px; margin-bottom: 20px;
  background: var(--glass); backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.brand { font-size: 21px; font-weight: 700; letter-spacing: .3px; color: var(--text); }
.brand small { display: block; font-size: 12px; font-weight: 500; color: var(--mut); margin-top: 2px; letter-spacing: .2px; }
.spacer { flex: 1; }

input, select, textarea {
  font: inherit; color: var(--text);
  background: rgba(118, 118, 128, 0.10);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none; width: 100%;
  transition: border-color .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: rgba(60, 60, 67, 0.35); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); background: rgba(0, 122, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}
select option { color: #1d1d1f; }
#search { width: 230px; max-width: 46vw; }

/* 看板 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--glass); backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.stat .n { font-size: 27px; font-weight: 700; letter-spacing: -.5px; color: var(--text); }
.stat .l { font-size: 13px; color: var(--mut); margin-top: 4px; }

/* 工具条 */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; align-items: center; }
.toolbar select, .toolbar input { width: auto; min-width: 120px; }

/* 按钮 */
.btn {
  font: inherit; cursor: pointer; border: none; border-radius: var(--radius-sm);
  padding: 10px 18px; color: #fff; font-weight: 600; font-size: 15px;
  background: var(--primary); box-shadow: 0 2px 10px rgba(0, 122, 255, 0.30);
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--primary-d); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: rgba(118, 118, 128, 0.12); color: var(--primary); box-shadow: none; }
.btn.ghost:hover { background: rgba(118, 118, 128, 0.18); }
.btn.danger { background: var(--bad); box-shadow: 0 2px 10px rgba(255, 59, 48, 0.30); }
.btn.danger:hover { background: #e02e24; }
.btn.sm { padding: 7px 14px; font-size: 13px; border-radius: 10px; }

/* 客户卡片 */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card {
  cursor: pointer; padding: 18px; border-radius: var(--radius);
  background: var(--glass); backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.card:hover { transform: translateY(-3px); border-color: rgba(0, 122, 255, 0.45); box-shadow: 0 12px 36px rgba(31, 38, 135, 0.14); }
.card-top { display: flex; gap: 13px; align-items: center; }
.avatar {
  width: 48px; height: 48px; flex: none; border-radius: 15px;
  display: grid; place-items: center; font-size: 20px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #0A84FF, #5E5CE6);
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.30);
}
.c-name { font-size: 17px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.c-sub { font-size: 13px; color: var(--mut); margin-top: 3px; }
.c-tags { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 3px 11px; border-radius: 999px; background: rgba(118, 118, 128, 0.13); color: var(--mut); border: 1px solid rgba(0, 0, 0, 0.04); }
.c-foot { margin-top: 13px; font-size: 13px; color: var(--mut); display: flex; justify-content: space-between; gap: 10px; }

/* 状态徽章（浅底彩字） */
.badge { font-size: 12px; padding: 3px 11px; border-radius: 999px; font-weight: 600; }
.b-potential { background: rgba(0, 122, 255, 0.13); color: #007AFF; }
.b-talking   { background: rgba(255, 149, 0, 0.16); color: #c77800; }
.b-deal      { background: rgba(52, 199, 89, 0.18); color: #1a8a3c; }
.b-lost      { background: rgba(255, 59, 48, 0.15); color: #d63a30; }

.empty { text-align: center; padding: 60px 20px; color: var(--mut); font-size: 15px; }

/* 弹窗 */
.modal { display: none; position: fixed; inset: 0; z-index: 50; align-items: flex-start; justify-content: center; padding: 28px 14px; overflow-y: auto; }
.modal.open { display: flex; }
.mask { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.28); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.sheet {
  position: relative; z-index: 1; width: 100%; max-width: 660px; margin: auto;
  max-height: 90vh; overflow-y: auto;
  background: rgba(255, 255, 255, 0.74); backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid var(--border); border-radius: 24px; box-shadow: 0 24px 60px rgba(31, 38, 135, 0.20);
  padding: 24px; animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(14px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { font-size: 19px; font-weight: 700; color: var(--text); margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; }
.x { cursor: pointer; border: none; background: rgba(118, 118, 128, 0.16); color: var(--text); width: 32px; height: 32px; border-radius: 10px; font-size: 18px; line-height: 1; display: grid; place-items: center; transition: background .15s; }
.x:hover { background: rgba(118, 118, 128, 0.26); }

/* 表单 */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--mut); font-weight: 500; }
.section-title { grid-column: 1 / -1; font-size: 13px; font-weight: 700; color: var(--text2); margin: 10px 0 2px; letter-spacing: .3px; padding-top: 4px; border-top: 1px solid var(--hairline); padding-top: 14px; }
.section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.radio-row { display: flex; gap: 16px; align-items: center; padding-top: 4px; }
.radio-row label { color: var(--text); font-size: 14px; display: flex; align-items: center; gap: 6px; font-weight: 400; }
input[type="radio"] { width: auto; }

.upload-btn { display: block; width: 100%; text-align: center; padding: 13px; border-radius: var(--radius-sm); cursor: pointer;
  background: rgba(118, 118, 128, 0.10); border: 1px dashed rgba(0, 0, 0, 0.18); color: var(--text); transition: background .15s; }
.upload-btn:hover { background: rgba(0, 122, 255, 0.08); border-color: var(--primary); color: var(--primary); }
.hint { font-size: 12px; margin-top: 2px; min-height: 14px; }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--warn); }
.img-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.img-preview img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; border: 1px solid var(--hairline); cursor: pointer; }

.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

/* 详情 */
.detail-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.detail-row .k { width: 96px; flex: none; color: var(--mut); }
.detail-row .v { color: var(--text); flex: 1; word-break: break-word; }
.follow-list { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.follow-item { background: rgba(118, 118, 128, 0.08); border: 1px solid rgba(0, 0, 0, 0.05); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.follow-item .t { font-size: 12px; color: var(--mut); margin-bottom: 4px; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
  #search { width: 100%; }
  .wrap { padding: 18px 12px 70px; }
  .sheet { padding: 20px 16px; }
}
