:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #6b7686;
  --border: #e3e8ef;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--primary); }

/* ---------- login ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--card); padding: 36px 32px; border-radius: 14px; box-shadow: var(--shadow);
  width: 320px; text-align: center;
}
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card .subtitle { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login-card label { display: block; text-align: left; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.login-card input { width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.login-card button { width: 100%; padding: 11px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 15px; margin-top: 6px; }
.login-card button:hover { background: var(--primary-d); }
.login-card button:disabled { opacity: .6; cursor: default; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); padding: 0 20px; height: 56px; box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 17px; font-weight: 700; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.user-info { color: var(--muted); margin-right: 6px; font-size: 13px; }

/* ---------- buttons ---------- */
.btn { padding: 7px 14px; border: 1px solid var(--border); background: #fff; border-radius: 8px; font-size: 13px; color: var(--text); }
.btn:hover { background: #f7f9fc; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #f0f2f6; }
.btn.danger { color: var(--danger); border-color: #f3c6c6; }
.btn.sm { padding: 4px 9px; font-size: 12px; }

/* ---------- layout ---------- */
.container { max-width: 1320px; margin: 18px auto; padding: 0 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filter { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 13px; }
.filter.grow { flex: 1; min-width: 180px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stat-chip { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 5px 14px; font-size: 12px; color: var(--muted); }
.stat-chip b { color: var(--text); font-size: 14px; }

/* ---------- table ---------- */
.table-wrap { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 11px 14px; font-size: 12px; color: var(--muted); background: #fafbfd; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7f9fc; }
tbody tr:last-child td { border-bottom: none; }
.cust-name { font-weight: 600; }
.muted { color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- status badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge.pending { background: #eef1f5; color: #69748a; }
.badge.useful { background: #fef3e2; color: #b45309; }
.badge.qualified { background: #e7f0ff; color: #1d4ed8; }
.badge.won { background: #e6f4ea; color: #1a7f37; }
.badge.useless { background: #fdeaea; color: #c02626; }
.role-badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #eef1f5; color: #69748a; margin-left: 4px; }
.role-badge.admin { background: #fff1e6; color: #c2620a; }
.role-badge.director { background: #f3e8ff; color: #7c3aed; }
.role-badge.leader { background: #e7f0ff; color: #1d4ed8; }

.chk-list { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.chk input { width: auto; margin: 0; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 16px; overflow-y: auto; }
.modal-box { background: var(--card); border-radius: 14px; width: 460px; max-width: 100%; box-shadow: 0 20px 50px rgba(16,24,40,.25); }
.modal-box.wide { width: min(1080px, 94vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; margin: 0; }
.modal-close { border: none; background: none; font-size: 18px; color: var(--muted); }
.modal-body { padding: 20px; }
.modal-body label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.modal-body input, .modal-body select, .modal-body textarea {
  width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.modal-body textarea { resize: vertical; min-height: 60px; }
.form-row { display: flex; gap: 12px; }
.form-row label { flex: 1; }

/* detail panel */
.detail-cols { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2.4fr); gap: 24px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text); margin: 4px 0 10px; border-left: 3px solid var(--primary); padding-left: 8px; }
.timeline { max-height: 340px; overflow-y: auto; }
.tl-item { padding: 9px 0; border-bottom: 1px dashed var(--border); }
.tl-item:last-child { border-bottom: none; }
.tl-meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.tl-content { margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.tl-del { font-size: 11px; color: var(--danger); border: none; background: none; padding: 0; }
.readonly-note { font-size: 12px; color: var(--muted); background: #f7f9fc; padding: 8px 10px; border-radius: 8px; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* 每日跟进里的当日沟通输入框：更高更宽 */
.fu-big { min-height: 120px; }
/* 点评依附在跟进条目下，缩进显示 */
.cm-nest { margin: 8px 0 0 16px; padding-left: 12px; border-left: 2px solid #dbe6fb; }
.cm-item { padding: 6px 0; }
.cm-item .tl-content { font-size: 13px; }
.link-btn { border: none; background: none; color: var(--primary); font-size: 12px; padding: 4px 0 0; cursor: pointer; }
.cm-input { margin-top: 6px; }
.cm-input textarea { min-height: 50px; }
/* 聊天截图缩略图 / 预览 / 灯箱 */
.fu-thumb { width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; vertical-align: middle; }
.fu-shot { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.fu-preview { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 300; display: flex; justify-content: center; align-items: flex-start; padding: 24px; overflow: auto; }
.lightbox img { max-width: min(900px, 95vw); height: auto; display: block; cursor: zoom-in; border-radius: 4px; }
.lightbox img.zoom { max-width: none; width: auto; cursor: zoom-out; }
.lightbox-close { position: fixed; top: 16px; right: 24px; font-size: 20px; color: #fff; background: rgba(0,0,0,.5); border: none; border-radius: 50%; width: 40px; height: 40px; cursor: pointer; z-index: 301; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 登录页"记住我" */
.remember { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; text-align: left; }
.remember input { width: auto; margin: 0; }

.hidden { display: none !important; }
.error { color: var(--danger); font-size: 12px; min-height: 16px; margin-bottom: 8px; }

/* admin table */
.admin-tools { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.admin-table td, .admin-table th { font-size: 13px; padding: 8px 10px; }

/* toast */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #1f2733; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 200; box-shadow: var(--shadow); }

@media (max-width: 720px) {
  .detail-cols { grid-template-columns: 1fr; }
  .modal-box.wide { width: 100%; }
  thead th:nth-child(4), tbody td:nth-child(4),
  thead th:nth-child(5), tbody td:nth-child(5) { display: none; }
}
