* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Microsoft YaHei", BlinkMacSystemFont, sans-serif; background: #f0f2f5; color: #1f2937; }
.hidden { display: none !important; }
button { cursor: pointer; border: none; border-radius: 6px; padding: 8px 16px; font-size: 14px; transition: .15s; }
button.primary { background: #2563eb; color: #fff; }
button.primary:hover { background: #1d4ed8; }
button.ghost { background: #f3f4f6; color: #374151; }
button.ghost:hover { background: #e5e7eb; }
button.danger { background: #fee2e2; color: #dc2626; }
button.danger:hover { background: #fecaca; }
input, select, textarea {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; width: 100%; font-family: inherit; background:#fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px #dbeafe; }
textarea { resize: vertical; min-height: 64px; }

/* 登录 */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#2563eb,#7c3aed); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; width: 340px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-box h1 { text-align: center; color: #2563eb; font-size: 22px; }
.login-box .sub { text-align: center; color: #6b7280; margin: 6px 0 24px; font-size: 13px; }
.login-box input { margin-bottom: 12px; }
.login-box button { width: 100%; padding: 11px; font-size: 15px; margin-top: 4px; }
.err { color: #ef4444; text-align: center; margin-top: 10px; font-size: 13px; min-height: 18px; }

/* 头部 */
.app header { background: #fff; padding: 0 24px; display: flex; align-items: center; height: 56px; box-shadow: 0 2px 8px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 10; }
.app .logo { font-weight: 700; color: #2563eb; font-size: 18px; margin-right: 32px; white-space: nowrap; }
.app nav { display: flex; gap: 4px; flex: 1; }
.nav-btn { background: transparent; color: #6b7280; padding: 8px 16px; }
.nav-btn:hover { color: #2563eb; }
.nav-btn.active { color: #2563eb; background: #eff6ff; font-weight: 600; }
.app .user { display: flex; align-items: center; gap: 12px; color: #374151; font-size: 14px; }
.app .user .logout { background: #f3f4f6; color: #374151; padding: 6px 12px; }

/* 主体 */
.tab { padding: 24px; max-width: 1100px; margin: 0 auto; }
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; }
.toolbar input, .toolbar select { width: auto; flex: 1; }
.toolbar button { white-space: nowrap; }

table { width: 100%; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-collapse: collapse; }
thead { background: #f9fafb; }
th, td { padding: 12px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid #f0f0f0; }
th { color: #6b7280; font-weight: 600; }
tbody tr:hover { background: #fafbff; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 5px 10px; font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-重要 { background: #fef3c7; color: #b45309; }
.tag-普通 { background: #e0e7ff; color: #4338ca; }
.tag-潜在 { background: #dcfce7; color: #15803d; }
.status-待回访 { background: #fee2e2; color: #dc2626; }
.status-已回访 { background: #dcfce7; color: #16a34a; }
.status-无需回访 { background: #f3f4f6; color: #6b7280; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; padding: 24px; border-radius: 10px; width: 420px; max-width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-box h3 { margin-bottom: 16px; color: #111827; }
.modal-box input, .modal-box select, .modal-box textarea { margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* 统计卡片 */
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; }
.stat-card { background: #fff; border-radius: 10px; padding: 22px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat-card .num { font-size: 30px; font-weight: 700; color: #2563eb; }
.stat-card .label { color: #6b7280; font-size: 14px; margin-top: 4px; }
.stat-card.alt .num { color: #7c3aed; }
.stat-card.warn .num { color: #dc2626; }
.stat-card.ok .num { color: #16a34a; }

.empty { text-align: center; color: #9ca3af; padding: 40px; }

/* 表单网格 */
.modal-box.wide { width: 560px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.form-grid > div { margin-bottom: 0; }
.modal-box.wide textarea { margin-top: 12px; }

/* 提示条 */
.tip { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.tip.warn { background: #fef3c7; border-color: #fde68a; color: #92400e; }

/* 周边客户地图 */
.nearby-wrap { display: grid; grid-template-columns: 1fr 360px; gap: 16px; }
.map { height: 520px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.nearby-list { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); align-self: start; }

/* 客户弹窗内选点地图 */
.pick-wrap { margin-top: 12px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; background: #fafbff; }
.pick-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.pick-bar input { flex: 1; }
.pick-tip { color: #9ca3af; font-size: 12px; white-space: nowrap; }
.pick-map { height: 280px; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.pick-result { max-height: 180px; overflow-y: auto; margin-top: 8px; }
.pick-item { background: #fff; border: 1px solid #eef0f3; border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; transition: .15s; }
.pick-item:hover { border-color: #2563eb; background: #eff6ff; }
.pick-item b { display: block; font-size: 14px; color: #1f2937; }
.pick-item span { display: block; font-size: 12px; color: #6b7280; margin-top: 2px; }
.pick-empty { text-align: center; color: #9ca3af; padding: 20px; font-size: 13px; }

@media (max-width: 900px) {
  .nearby-wrap { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .nav-btn { padding: 8px 10px; font-size: 13px; }
}
