:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --ink: #111827;
  --ink2: #374151;
  --muted: #8a94a6;
  --line: #e8ebf0;
  --pri: #2563eb;
  --pri-soft: #eef3ff;
  --late: #e11d48;
  --late-soft: #fff1f3;
  --ok: #0f9d58;
  --ok-soft: #eafaf1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
button, input, select { font-family: inherit; font-size: 15px; }
input, select {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 11px 12px; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
input::placeholder { color: #b6bdc9; }

.screen { display: block; }
.hidden { display: none !important; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px;
  background: #f1f3f7; color: var(--ink2); font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--pri); color: #fff; }
.btn.primary:active { background: #1d4fd8; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink2); }
.btn.danger { color: var(--late); border-color: #f6c6ce; }
.btn.block { width: 100%; padding: 12px; }
.btn:disabled { opacity: .55; }

.icon-btn {
  background: transparent; border: 0; color: inherit; font-size: 17px; padding: 6px 10px;
  border-radius: 8px; cursor: pointer;
}
.icon-btn.wide { font-size: 14px; font-weight: 600; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: #334155; color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ---------- 登录 ---------- */
#login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(170deg, #0f172a 0%, #1e293b 45%, #f2f4f7 45.1%); }
.login-wrap { width: 100%; max-width: 380px; }
.brand { text-align: center; margin-bottom: 22px; }
.logo {
  width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 16px;
  background: rgba(255, 255, 255, .12); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; border: 1px solid rgba(255, 255, 255, .18);
}
.brand h1 { color: #fff; font-size: 21px; margin: 0 0 6px; letter-spacing: .5px; }
.brand .sub { color: rgba(255, 255, 255, .55); font-size: 13px; margin: 0; }
.login-form { background: #fff; padding: 22px; border-radius: 18px; box-shadow: var(--shadow); }
.login-form label { display: block; margin-bottom: 14px; }
.login-form label > span, .login-form label { font-size: 13px; color: var(--ink2); font-weight: 600; }
.login-form label input { margin-top: 6px; }
.err { color: var(--late); font-size: 13px; margin: 10px 0 0; min-height: 18px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: #0f172a; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: .5px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar .icon-btn { color: rgba(255, 255, 255, .8); }

#app, #detail {
  max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--bg);
  padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
}

/* ---------- 搜索 / 筛选 ---------- */
.toolbar { padding: 12px 14px 4px; }
.search-row { display: flex; gap: 8px; }
.search-row input { background: #fff; }
.search-row .btn { white-space: nowrap; padding: 10px 14px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; border: 1px solid var(--line); background: #fff; color: var(--ink2);
  padding: 6px 13px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.chip.on { background: var(--pri); border-color: var(--pri); color: #fff; font-weight: 600; }
.cnt { background: rgba(225, 29, 72, .12); color: var(--late); border-radius: 999px; padding: 0 6px; font-size: 12px; margin-left: 2px; }
.chip.on .cnt { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- 客户卡片 ---------- */
.list { padding: 8px 14px 0; display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  cursor: pointer; border: 1px solid transparent; transition: transform .12s, border-color .12s;
}
.card:active { transform: scale(.988); border-color: #dbe3ef; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cn { font-size: 16px; font-weight: 700; line-height: 1.35; word-break: break-all; }
.pill { flex: 0 0 auto; font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 600; background: #eef1f6; color: #556075; }
.pill.s0 { background: #f1f5f9; color: #475569; }
.pill.s1 { background: #eff6ff; color: #1d4ed8; }
.pill.s2 { background: #ecfeff; color: #0e7490; }
.pill.s3 { background: #fef3c7; color: #92400e; }
.pill.s4 { background: #f3e8ff; color: #7e22ce; }
.pill.s5 { background: var(--ok-soft); color: var(--ok); }
.meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 7px; background: #f4f6fa; color: #4b5563; }
.tag.late { background: var(--late-soft); color: var(--late); font-weight: 600; }
.tag.done { background: var(--ok-soft); color: var(--ok); text-decoration: line-through; opacity: .85; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.who { color: var(--ink2); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 70px 24px; }
.empty-icon { font-size: 34px; margin-bottom: 10px; }

/* ---------- 详情 ---------- */
.detail-body { padding: 14px; }
.d-head { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.d-head h2 { font-size: 19px; margin: 0 0 6px; line-height: 1.35; }
.d-sub { color: var(--muted); font-size: 13px; }

.stepper { display: flex; align-items: center; gap: 2px; margin-top: 12px; }
.step {
  flex: 1; text-align: center; font-size: 11px; color: #9aa3b2; padding: 7px 2px; border-radius: 8px; background: #f5f7fa;
  cursor: pointer; font-weight: 600; line-height: 1.2;
}
.step.on { background: var(--pri); color: #fff; }
.step.past { background: #dbeafe; color: #1d4ed8; }
.d-tip { font-size: 12px; color: var(--muted); margin-top: 8px; }

.sec { background: #fff; border-radius: var(--radius); padding: 16px; margin-top: 12px; box-shadow: var(--shadow); }
.block-title { font-size: 14px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cnt-n { font-size: 12px; font-weight: 600; color: var(--muted); background: #f1f3f7; border-radius: 999px; padding: 1px 8px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid #f2f4f8; font-size: 14px; }
.kv:last-child { border-bottom: 0; padding-bottom: 0; }
.kv span { color: var(--muted); flex: 0 0 auto; }
.kv b { font-weight: 600; text-align: right; word-break: break-all; }
.kv b.miss { color: #c2c9d4; font-weight: 500; }

.todo { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid #f2f4f8; }
.todo:last-of-type { border-bottom: 0; }
.cb { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%; border: 1.5px solid #d3d9e3; background: #fff; margin-top: 2px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px; color: transparent; }
.cb.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.tt { flex: 1; min-width: 0; }
.t1 { font-size: 14.5px; font-weight: 500; word-break: break-all; }
.t1.done { color: var(--muted); text-decoration: line-through; }
.t2 { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.t2 .late { color: var(--late); font-weight: 600; }
.del { border: 0; background: transparent; color: #c7cedb; font-size: 16px; padding: 0 2px; cursor: pointer; }
.todo-add { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.todo-add .arow { display: flex; gap: 8px; }
.todo-add .arow > * { flex: 1; }
.todo-add .arow .btn { flex: 0 0 auto; }

.tl { position: relative; padding-left: 16px; margin-top: 10px; }
.tl::before { content: ''; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 1px; background: var(--line); }
.tli { position: relative; padding: 0 0 14px; font-size: 13px; color: var(--ink2); }
.tli::before { content: ''; position: absolute; left: -16px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: #c9d1de; }
.tli.first::before { background: var(--pri); }
.tli .tm { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* ---------- 弹层 ---------- */
.sheet { position: fixed; inset: 0; background: var(--bg); overflow-y: auto; z-index: 20; }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; padding: 0; overflow-y: auto; }
.modal-card { background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); max-height: 92vh; overflow-y: auto; }
.modal-card h2 { font-size: 17px; margin: 0 0 14px; }
.modal-card h3 { font-size: 14px; margin: 0 0 10px; color: var(--ink2); }
.form label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--ink2); font-weight: 600; }
.form label i { color: var(--late); font-style: normal; }
.form label input, .form label select { margin-top: 6px; }
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.hint { font-size: 12.5px; color: var(--ok); min-height: 16px; margin: 8px 0 0; }
.me-info { font-size: 14px; color: var(--ink2); }
.me-info b { color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 26px); transform: translateX(-50%);
  background: rgba(17, 24, 39, .92); color: #fff; font-size: 13.5px; padding: 10px 18px; border-radius: 999px;
  z-index: 50; max-width: 86vw; text-align: center; animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- 产品进度 / 团队 ---------- */
.pill.late { background: var(--late-soft); color: var(--late); }
.pbadge { font-size: 12px; padding: 3px 9px; border-radius: 8px; font-weight: 600; background: #eef1f6; color: #556075; }
.pbadge.s0 { background: #f1f5f9; color: #475569; }
.pbadge.s1 { background: #eff6ff; color: #1d4ed8; }
.pbadge.s2 { background: #ecfeff; color: #0e7490; }
.pbadge.s3 { background: #e0e7ff; color: #3730a3; }
.pbadge.s4 { background: #fef3c7; color: #92400e; }
.pbadge.s5 { background: #f3e8ff; color: #7e22ce; }
.pbadge.ok { background: var(--ok-soft); color: var(--ok); }
.pbadge.no { background: var(--late-soft); color: var(--late); }
.pbadges { gap: 8px; }
.footline { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

.prod { border-top: 1px solid #f1f3f7; padding-top: 14px; margin-top: 14px; }
.prod:first-of-type { border-top: 0; padding-top: 0; margin-top: 6px; }
.prod-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.prod-name { font-weight: 700; font-size: 14.5px; }
.prod-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.link { background: none; border: 0; color: var(--pri); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.stage-row { display: flex; gap: 4px; overflow-x: auto; margin: 10px -2px 2px; padding: 2px; scrollbar-width: none; }
.stage-row::-webkit-scrollbar { display: none; }
.sbtn {
  flex: 0 0 auto; min-width: 42px; font-size: 11px; padding: 6px 5px; border-radius: 8px;
  border: 1px solid var(--line); background: #f6f8fb; color: #8b94a4; font-weight: 600; cursor: pointer;
}
.sbtn.past { background: #e8f0fe; color: #2563eb; border-color: #d7e3fb; }
.sbtn.on { color: #fff; border-color: transparent; }
.sbtn.on.s0 { background: #475569; }
.sbtn.on.s1 { background: #0284c7; }
.sbtn.on.s2 { background: #0e7490; }
.sbtn.on.s3 { background: #2563eb; }
.sbtn.on.s4 { background: #b45309; }
.sbtn.on.s5 { background: #7e22ce; }
.sbtn.on.ok { background: #0f9d58; }
.sbtn.on.no { background: #e11d48; }
.none { color: var(--muted); font-size: 13px; padding: 10px 0; }
.miss { color: #b9c0cc; }
.mini-add { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.mini-add input, .mini-add select { padding: 8px 10px; font-size: 13.5px; border-radius: 8px; }
.btn.tiny { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.arow { display: flex; gap: 6px; align-items: center; }
.arow > * { flex: 1; min-width: 0; }
.arow .btn { flex: 0 0 auto; }
.form-sub { font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; font-weight: 600; }
.role-badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--pri-soft); color: var(--pri); margin-left: 6px; vertical-align: middle; }
.role-badge.member { background: #f1f3f7; color: #64748b; }
.role-badge.me { background: #fef3c7; color: #92400e; }
.orglist { display: flex; flex-wrap: wrap; gap: 8px; }
.org-chip { background: #f4f6fa; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.org-chip .x { border: 0; background: none; color: #a3abb8; font-size: 14px; cursor: pointer; padding: 0 2px; }
.memberlist { display: flex; flex-direction: column; }
.member-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f2f4f8; }
.m-name { font-weight: 600; font-size: 14px; }
.m-orgs { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.check-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px 10px; background: #f7f9fc; border-radius: 9px; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--pri); }
.check span { font-weight: 500; color: var(--ink2); }

/* ---------- 资料照片墙 ---------- */
.photowall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.ptile {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #f6f8fb; padding: 0; cursor: pointer;
}
.ptile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ptile .pdoc {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #9aa6b8; font-size: 15px; letter-spacing: 1px;
}
.ptile .pkind {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: left;
  background: linear-gradient(transparent, rgba(15, 23, 42, .8));
  color: #fff; font-size: 11.5px; padding: 14px 7px 5px;
}
.ptile.add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1.5px dashed #cfd8e5; background: #fafbfd; color: #94a3b8;
}
.ptile.add span { font-size: 22px; line-height: 1; }
.ptile.add em { font-style: normal; font-size: 12px; }
.ptile.add.busy { opacity: .6; }
.up-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.up-bar select { flex: 1; min-width: 0; padding: 8px 10px; font-size: 13.5px; border-radius: 8px; }
.hint2 { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
@media (min-width: 720px) { .photowall { grid-template-columns: repeat(4, 1fr); } }

/* ---------- 全屏查看 ---------- */
.viewer { position: fixed; inset: 0; background: #0b1220; z-index: 60; display: flex; flex-direction: column; }
.v-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; color: #fff;
}
.v-name { font-size: 13px; color: rgba(255, 255, 255, .78); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-bar .icon-btn { color: #fff; flex: 0 0 auto; }
.v-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 0 10px; min-height: 0; }
.v-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.v-body iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 8px; }
.v-none { color: rgba(255, 255, 255, .72); font-size: 14px; text-align: center; padding: 30px 20px; }
.v-foot { display: flex; gap: 10px; padding: 10px 14px calc(env(safe-area-inset-bottom) + 14px); }
.v-foot .btn { flex: 1; text-align: center; line-height: 1.4; }
.v-foot .btn.danger { color: #ff8199; border-color: rgba(255, 129, 153, .45); background: transparent; }

@media (min-width: 700px) {
  body { background: #e9edf3; }
  #app, #detail { box-shadow: 0 0 0 1px rgba(16, 24, 40, .06); }
}

/* ---------- 通知铃铛 / 通知列表 ---------- */
.bell { position: relative; }
.bell .dot {
  position: absolute; top: -2px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: #ef4444; color: #fff; font-size: 10.5px; line-height: 16px;
  text-align: center; font-weight: 600;
}
.notif-list { max-height: 58vh; overflow: auto; margin: 4px 0 10px; }
.nrow { padding: 9px 10px; border-bottom: 1px solid #eef1f6; cursor: pointer; }
.nrow.unread { background: #f4f8ff; }
.nrow .nt1 { font-size: 13.5px; color: #1f2937; line-height: 1.45; }
.nrow .nt2 { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- 流水列表 ---------- */
.streamlist { margin-top: 8px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eef1f6; }
.sico {
  flex: 0 0 40px; height: 40px; border-radius: 8px; background: #eef3fb; color: #4b5f7c;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: .5px;
}
.srow .f-main { flex: 1; min-width: 0; }
.srow .f-name { font-size: 13.5px; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .f-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.srow .f-acts { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.srow .f-acts .link { font-size: 12.5px; }
.srow .f-acts .del {
  width: 24px; height: 24px; border-radius: 50%; border: 0; background: #fdecef;
  color: #e2566f; font-size: 14px; line-height: 1;
}
.up-row { margin-top: 10px; }

/* ---------- 电话可点拨打 ---------- */
.kv .tel { color: var(--pri); text-decoration: none; font-weight: 600; }

/* ---------- 删除确认弹窗 ---------- */
.confirm-card { max-width: 360px; }
.cf-desc { font-size: 13.5px; color: #4b5563; line-height: 1.6; margin: 6px 0 14px; }
.btn.danger-fill { background: #e2566f; border-color: #e2566f; color: #fff; }

/* ---------- 阶段按钮：不可点的置灰 ---------- */
.sbtn.locked { opacity: .38; }
.sbtn { cursor: pointer; }
.sbtn.locked { cursor: not-allowed; }
.sbtn.on { opacity: 1; }

/* 可点的下一步：淡蓝提示边框 */
.sbtn.next { border-color: var(--pri); color: var(--pri); background: var(--pri-soft); box-shadow: inset 0 0 0 1px rgba(37,99,235,.25); }

/* 超期通知标记 */
.tag-late { display:inline-block; margin-right:4px; padding:0 5px; border-radius:4px; background:#fdecef; color:#d63b5c; font-size:11px; }
.nrow.late { background:#fff8f9; }
.nrow.late.unread { background:#fff1f4; }

/* 签约天数 */
.kv .sign-n { font-style: normal; color: var(--pri); margin-left: 8px; font-size: 12.5px; }

/* 总管：可任意调整的其它阶段用虚线框标出 */
.sbtn.boss { border-style: dashed; border-color: #b8c7e6; color: #64748b; background: #f8fafd; }
