/* ==========================================================
   客户管理系统 · 样式表
   浅色为主，兼容企业微信内置浏览器（移动端优先）
   ========================================================== */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e6eaf1;
  --border-strong: #d6dde8;
  --text: #141c28;
  --text-2: #4b5a6d;
  --muted: #7b8a9e;
  --primary: #2f6bff;
  --primary-dark: #1f4fd8;
  --primary-soft: #ecf1ff;
  --success: #0f9d58;
  --success-soft: #e8f6ee;
  --warn: #d98b0b;
  --warn-soft: #fdf3e0;
  --danger: #d93a3f;
  --danger-soft: #fdecec;
  --purple: #7c5cff;
  --teal: #0aa2a2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(17, 30, 51, .04), 0 6px 18px rgba(17, 30, 51, .05);
  --shadow-lg: 0 10px 40px rgba(17, 30, 51, .14);
  --sidebar-w: 214px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd7e3; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 启动态 ---------------- */
.boot-wrap { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.boot { text-align: center; color: var(--muted); }
.boot-logo {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  background: linear-gradient(135deg, #2f6bff, #7c5cff);
  color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(47, 107, 255, .28);
}
.boot-text { font-size: 13px; }

/* ---------------- 骨架 ---------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #2f6bff, #7c5cff);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: -2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--text-2); font-size: 14px; cursor: pointer;
  border: 0; background: transparent; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.nav-item svg { flex: 0 0 18px; opacity: .85; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; padding: 0 6px; border-radius: 10px; line-height: 17px; height: 17px;
}

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.me { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px; cursor: pointer; }
.me:hover { background: var(--surface-2); }
.me-name { font-size: 13px; font-weight: 600; }
.me-role { font-size: 11px; color: var(--muted); }
.me-out { margin-left: auto; color: var(--muted); font-size: 12px; padding: 4px; }
.me-out:hover { color: var(--danger); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none;
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  align-items: center; gap: 10px;
}
.topbar-title { font-weight: 650; font-size: 16px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.page { padding: 22px 26px 40px; max-width: 1340px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 680; letter-spacing: -.2px; margin: 0; }
.page-desc { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.page-head .spacer { flex: 1; }

.bottom-nav { display: none; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px 18px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 650; font-size: 14.5px; }
.card-head .spacer { flex: 1; }
.card-more { font-size: 12.5px; color: var(--muted); cursor: pointer; }
.card-more:hover { color: var(--primary); }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-12 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #c2ccdb; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(47, 107, 255, .22); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: #f3c9cb; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 7px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-2);
  color: var(--text-2); border: 1px solid var(--border); white-space: nowrap;
}
.badge-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-a { background: #fdecec; color: #c92a2e; border-color: #f8d7d8; }
.badge-b { background: #fdf3e0; color: #b4760a; border-color: #f7e5c6; }
.badge-c { background: #eef2f8; color: #56657a; border-color: #e0e7f0; }
.badge-d { background: #f3f4f6; color: #8b96a5; border-color: #e8eaee; }
.badge-green { background: var(--success-soft); color: var(--success); border-color: #cfeade; }
.badge-blue { background: var(--primary-soft); color: var(--primary-dark); border-color: #d8e3ff; }
.badge-orange { background: var(--warn-soft); color: var(--warn); border-color: #f6e3bf; }
.badge-red { background: var(--danger-soft); color: var(--danger); border-color: #f6d5d6; }
.badge-gray { background: #f2f4f7; color: #7b8a9e; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-2); margin: 0 4px 4px 0;
}

.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .3px;
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hr { height: 1px; background: var(--border); margin: 14px 0; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 13px; }
.field-label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; font-weight: 550; }
.field-label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 78px; padding: 9px 11px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 107, 255, .12); }
.input::placeholder, .textarea::placeholder { color: #a9b4c4; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 8l3-3.5' stroke='%237b8a9e' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 26px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.search-box { position: relative; flex: 1; min-width: 160px; }
.search-box .input { padding-left: 32px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .select { width: auto; min-width: 106px; height: 34px; }

.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 29px; padding: 0 12px; border-radius: 15px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.chip .n { opacity: .7; font-size: 11.5px; }

/* ---------------- 指标卡 ---------------- */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.stat-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.stat-value { font-size: 23px; font-weight: 680; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.stat-foot { font-size: 11.5px; color: var(--muted); }
.stat-accent { color: var(--primary); }
.stat-green { color: var(--success); }
.stat-warn { color: var(--warn); }

/* ---------------- 列表 ---------------- */
.list-row {
  display: grid; align-items: center; gap: 12px;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.row-main { min-width: 0; }
.row-title { font-weight: 600; font-size: 13.8px; display: flex; align-items: center; gap: 6px; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cust-row { grid-template-columns: minmax(0, 1fr) 96px 104px 132px 30px; }
.cust-head {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px 104px 132px 30px;
  gap: 12px; padding: 9px 18px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--muted); font-weight: 600;
}

/* ---------------- 空状态 ---------------- */
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-icon {
  width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 14px;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  display: flex; align-items: center; justify-content: center; color: #b9c4d3;
}
.empty-title { font-weight: 600; color: var(--text-2); margin-bottom: 3px; }
.empty-desc { font-size: 12.5px; }

.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------------- 商机看板 ---------------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 12px; }
.kcol {
  flex: 0 0 252px; width: 252px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px;
  display: flex; flex-direction: column; max-height: calc(100vh - 240px);
}
.kcol-head { display: flex; align-items: center; gap: 7px; padding: 2px 4px 9px; }
.kcol-name { font-weight: 650; font-size: 13px; }
.kcol-n { font-size: 11.5px; color: var(--muted); background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 0 6px; }
.kcol-amt { margin-left: auto; font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.kcol-body { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 4px; }
.kcard {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 11px; box-shadow: 0 1px 2px rgba(17, 30, 51, .04); cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.kcard:hover { box-shadow: 0 4px 14px rgba(17, 30, 51, .1); transform: translateY(-1px); }
.kcard-title { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kcard-meta { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kcard-amt { font-size: 14.5px; font-weight: 680; color: var(--text); margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.kcol-add { border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); border-radius: 9px; height: 32px; font-size: 12.5px; cursor: pointer; }
.kcol-add:hover { border-color: var(--primary); color: var(--primary); background: #fff; }

/* ---------------- 时间线 ---------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -21px; top: 4px; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid var(--primary);
}
.tl-dot.gray { border-color: #c3ccd9; }
.tl-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tl-name { font-weight: 600; font-size: 13px; }
.tl-time { font-size: 11.5px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.tl-body { font-size: 13px; color: var(--text-2); margin-top: 5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.tl-plan {
  margin-top: 6px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px; color: var(--text-2);
}

/* ---------------- 图表 ---------------- */
.chart-wrap { padding: 4px 2px 0; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 5px; }

.bar-item { display: grid; grid-template-columns: 88px 1fr 68px; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; }
.bar-track { height: 8px; border-radius: 5px; background: #eef1f6; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #4f84ff, #2f6bff); }
.bar-val { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 抽屉 / 弹层 ---------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(17, 26, 40, .42);
  display: flex; z-index: 300; animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.overlay.center { align-items: center; justify-content: center; padding: 18px; }

.drawer {
  margin-left: auto; width: 520px; max-width: 100%; height: 100%;
  background: var(--surface); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: slideIn .22s cubic-bezier(.22, .8, .3, 1);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; gap: 10px; padding: 15px 18px;
  border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.drawer-title { font-weight: 650; font-size: 15px; }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.drawer-foot {
  padding: 12px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--border);
  display: flex; gap: 9px; justify-content: flex-end; background: var(--surface); flex: 0 0 auto;
}

.modal {
  background: var(--surface); border-radius: 16px; width: 400px; max-width: 100%;
  box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.22, .8, .3, 1);
  padding: 20px;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-weight: 650; font-size: 16px; margin-bottom: 6px; }
.modal-desc { color: var(--text-2); font-size: 13px; line-height: 1.7; }
.modal-foot { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }

/* ---------------- Toast ---------------- */
.toast-root {
  position: fixed; left: 50%; top: 22px; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 90vw;
}
.toast {
  background: #1b2432; color: #fff; padding: 9px 15px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(17, 30, 51, .24);
  animation: toastIn .2s ease; max-width: 100%;
}
.toast.err { background: #b3262b; }
.toast.ok { background: #0f7a45; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------- 登录 ---------------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-side {
  background: radial-gradient(1200px 600px at 10% 0%, #3f7bff 0%, #2f5fe0 42%, #1d3fae 100%);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-side::after {
  content: ""; position: absolute; right: -120px; bottom: -160px; width: 460px; height: 460px;
  border-radius: 50%; background: rgba(255, 255, 255, .08);
}
.login-side::before {
  content: ""; position: absolute; right: 40px; top: -80px; width: 240px; height: 240px;
  border-radius: 50%; background: rgba(255, 255, 255, .06);
}
.login-brand { display: flex; align-items: center; gap: 11px; position: relative; }
.login-headline { font-size: 30px; font-weight: 700; line-height: 1.35; letter-spacing: -.5px; position: relative; }
.login-sub { opacity: .82; margin-top: 12px; font-size: 14px; max-width: 400px; line-height: 1.8; position: relative; }
.login-points { margin-top: 30px; display: flex; flex-direction: column; gap: 11px; position: relative; }
.login-point { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; opacity: .93; }
.login-point svg { flex: 0 0 16px; margin-top: 2px; opacity: .9; }
.login-foot { font-size: 12px; opacity: .6; position: relative; }

.login-main { display: flex; align-items: center; justify-content: center; padding: 30px; background: var(--surface); }
.login-box { width: 100%; max-width: 344px; }
.login-title { font-size: 22px; font-weight: 700; margin: 0 0 5px; }
.login-tip { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-err {
  background: var(--danger-soft); color: var(--danger); border: 1px solid #f6d5d6;
  padding: 8px 11px; border-radius: 8px; font-size: 12.5px; margin-bottom: 13px;
}
.demo-accounts { margin-top: 22px; border-top: 1px dashed var(--border); padding-top: 15px; }
.demo-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.demo-list { display: flex; flex-wrap: wrap; gap: 7px; }
.demo-item {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px;
  padding: 5px 9px; font-size: 12px; cursor: pointer; color: var(--text-2);
}
.demo-item:hover { border-color: var(--primary); color: var(--primary); }

/* ---------------- 详情页 ---------------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 14px; align-items: start; }
.kv { display: grid; grid-template-columns: 76px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }

.profile-head { display: flex; gap: 14px; align-items: flex-start; }
.profile-logo {
  width: 52px; height: 52px; border-radius: 14px; flex: 0 0 auto;
  background: linear-gradient(135deg, #eef3ff, #e3ecff); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
  border: 1px solid #dbe5ff;
}
.profile-name { font-size: 18px; font-weight: 680; letter-spacing: -.2px; }
.profile-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tab {
  padding: 9px 13px; font-size: 13.5px; color: var(--text-2); cursor: pointer;
  border: 0; background: transparent; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab .n { font-size: 11.5px; color: var(--muted); margin-left: 3px; }

.mini-opp {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.mini-opp:last-child { border-bottom: 0; }
.mini-opp-name { font-size: 13px; font-weight: 600; }
.mini-opp-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.stage-pill { height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; }

.contact-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.contact-card:last-child { border-bottom: 0; }
.contact-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.contact-meta { font-size: 11.5px; color: var(--muted); }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 5px; border-radius: 6px; display: inline-flex;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------------- 设置 ---------------- */
.setting-row {
  display: flex; gap: 16px; align-items: flex-start; padding: 15px 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: 0; }
.setting-main { flex: 1; min-width: 0; }
.setting-name { font-size: 13.5px; font-weight: 600; }
.setting-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.65; }
.code-block {
  background: #f7f9fc; border: 1px solid var(--border); border-radius: 9px;
  padding: 11px 13px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; color: var(--text-2); overflow-x: auto; white-space: pre; line-height: 1.7;
}

/* ---------------- 移动端 ---------------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-12 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { display: flex; }
  .page { padding: 14px 14px calc(84px + var(--safe-b)); }

  /* 手机端标题交给顶栏，页面里不再重复 */
  .page-head { gap: 9px; margin-bottom: 12px; }
  .page-head > div:first-child { display: none; }
  .page-head .spacer { display: none; }
  .page-head > .btn:not(.btn-ghost) { flex: 1; }
  .page-title, .page-desc { display: none; }

  .toolbar { gap: 8px; }
  .toolbar .search-box { flex: 1 1 100%; }
  .toolbar .select { flex: 1 1 0; min-width: 0; }

  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-b);
  }
  .bottom-item {
    flex: 1; padding: 7px 0 8px; border: 0; background: transparent;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); font-size: 10.5px; cursor: pointer;
  }
  .bottom-item.active { color: var(--primary); }
  .bottom-item svg { width: 21px; height: 21px; }

  .cust-head { display: none; }
  .cust-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
  .cust-row .hide-sm { display: none; }
  .list-row { padding: 12px 14px; }
  .card-head { padding: 12px 14px; }
  .card-pad { padding: 14px; }
  .page-title { font-size: 19px; }
  .stat-value { font-size: 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row { grid-template-columns: 1fr; }

  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-main { min-height: 100vh; align-items: flex-start; padding: 48px 24px 30px; }
  .login-box { max-width: 100%; }

  .drawer { width: 100%; height: 92%; margin-top: auto; border-radius: 16px 16px 0 0; animation: sheetUp .24s cubic-bezier(.22, .8, .3, 1); }
  .overlay { align-items: flex-end; }
  @keyframes sheetUp { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
  .drawer-foot { padding-bottom: calc(14px + var(--safe-b)); }
  .kcol { flex: 0 0 232px; width: 232px; max-height: none; }
  .kanban { padding-bottom: 4px; }
}

@media (max-width: 420px) {
  /* 指标卡保持两列，避免一屏只放得下两张卡 */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat { padding: 12px 13px; }
  .stat-value { font-size: 19px; }
}

/* 打印 */
@media print {
  .sidebar, .topbar, .bottom-nav { display: none !important; }
  .page { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
