/* JC-CRM 样式 - 响应式（手机大按钮少输入 / 桌面宽屏） */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1a66ff;
  --danger: #e54545;
  --ok: #0ca678;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #22293a;
  --muted: #7a8299;
  --border: #e3e7ef;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px;
  display: flex; flex-direction: column;
}

/* 顶栏 */
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; position: sticky; top: 0; z-index: 1000;
}
.brand { font-weight: 700; color: var(--primary); font-size: 18px; }
.nav { display: flex; gap: 8px; flex: 1; }
.nav-btn {
  border: none; background: none; font-size: 16px; padding: 8px 14px;
  border-radius: 8px; cursor: pointer; color: var(--muted);
}
.nav-btn.active { background: #e8efff; color: var(--primary); font-weight: 600; }

/* 主区 */
#main { flex: 1; max-width: 860px; width: 100%; margin: 0 auto; padding: 16px; }
.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }
h2 { font-size: 20px; margin-bottom: 12px; }

/* 卡片列表 */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; display: flex; align-items: center; gap: 12px; cursor: pointer;
}
.card:active { background: #f0f4ff; }
.card .grow { flex: 1; min-width: 0; }
.card .title { font-weight: 600; font-size: 16px; }
.card .sub { color: var(--muted); font-size: 13px; margin-top: 4px; word-break: break-all; }
.card.overdue { border-left: 4px solid var(--danger); }
.badge {
  font-size: 12px; padding: 2px 8px; border-radius: 10px;
  background: #eef1f6; color: var(--muted); flex-shrink: 0;
}
.badge.a { background: #ffe8e8; color: var(--danger); }
.badge.b { background: #fff4e0; color: #c47b00; }
.badge.c { background: #e6f7f1; color: var(--ok); }
.badge.danger { background: #ffe8e8; color: var(--danger); font-weight: 600; }
.badge.left { background: #f0f0f0; color: #999; text-decoration: line-through; }

/* 按钮 / 表单 */
.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 10px 16px; font-size: 15px; cursor: pointer;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  width: 100%; padding: 10px 12px; font-size: 15px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--card); color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input { flex: 1; }

/* 详情页 */
#customer-detail .section { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
#customer-detail .section h3 { font-size: 15px; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 72px 1fr; gap: 6px 10px; font-size: 15px; }
.kv .k { color: var(--muted); }
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.detail-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.contact-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.contact-row:last-child { border-bottom: none; }
.contact-row .grow { flex: 1; min-width: 0; }
.fu-row { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.fu-row:last-child { border-bottom: none; }
.fu-row .fu-meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fu-row .next { color: #c47b00; font-size: 13px; margin-top: 4px; }
.fu-row.done-row { opacity: .55; }

.sub-tip { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }

/* 日历 */
.cal-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-header h2 { margin: 0; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-weekdays div { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  min-height: 68px; padding: 4px 5px; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px;
}
.cal-cell:active { background: #f0f4ff; }
.cal-cell.dim { opacity: .38; }
.cal-cell.today { border: 2px solid var(--primary); }
.cal-cell .d { font-size: 12px; font-weight: 600; color: var(--muted); }
.cal-cell.today .d { color: var(--primary); }
.cal-cell .dots { display: flex; gap: 3px; flex-wrap: wrap; }
.cal-cell .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cal-cell .dot.fu { background: var(--primary); }
.cal-cell .dot.done { background: var(--ok); }
.cal-cell .dot.log { background: #c47b00; }
.cal-cell .ev { font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-cell .ev::before { content: "▸ "; color: var(--primary); }

/* 日历 */

#map { height: calc(100vh - 160px); min-height: 380px; border-radius: 12px; border: 1px solid var(--border); z-index: 1; }
#map-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#map-select-info { color: var(--muted); font-size: 14px; flex: 1; }
.map-popup { font-size: 14px; line-height: 1.6; }
.map-popup a { color: var(--primary); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2000;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card); width: 100%; max-width: 560px; max-height: 88vh;
  border-radius: 16px 16px 0 0; padding: 20px; overflow-y: auto;
}
.modal h3 { margin-bottom: 14px; font-size: 18px; }
.modal .form-row { margin-bottom: 12px; }
.modal .form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; padding: 12px; }
a.link { color: var(--primary); font-size: 13px; word-break: break-all; }

/* Toast */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: #333c52; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; z-index: 3000; max-width: 80vw;
}

/* 手机端 */
@media (max-width: 640px) {
  .topbar { padding: 8px 10px; }
  .nav-btn { padding: 10px 12px; font-size: 15px; }
  #main { padding: 12px; }
  .btn { padding: 12px 16px; }   /* 大按钮 */
  .modal-mask { align-items: flex-end; }
}
