/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #34a853;
  --danger: #ea4335;
  --warn: #f29900;
  --text: #202124;
  --text-sub: #5f6368;
  --border: #dadce0;
  --bg: #f1f3f4;
  --card: #ffffff;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* 移动端：使用动态视口高度，避免地址栏遮挡 */
@supports (height: 100dvh) {
  .login-view { min-height: 100dvh; }
  .app-view { min-height: 100dvh; }
}

[hidden] { display: none !important; }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: #f8f9fa; }
.btn:active { background: #f1f3f4; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { opacity: .9; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { opacity: .9; }
.btn.ghost { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.25); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; padding: 10px; font-size: 15px; }
.btn.link { border: none; background: none; color: var(--primary); padding: 3px 6px; font-size: 13px; }
.btn.link:hover { background: rgba(26,115,232,.08); border-radius: 4px; }
.btn.link.danger { color: var(--danger); }
.btn.link.danger:hover { background: rgba(234,67,53,.08); }

/* ========== 表单 ========== */
.inp,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.inp:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 4px; }
.field label em { color: var(--danger); font-style: normal; }
.field textarea { resize: vertical; }
select.inp { cursor: pointer; }

/* ========== 登录 ========== */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 55%, #0d3f80 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 36px 32px 28px;
  width: 380px;
  max-width: 100%;
  box-shadow: 0 12px 48px rgba(0,0,0,.22);
}
.login-card h1 { font-size: 21px; text-align: center; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--text-sub); font-size: 13px; margin-bottom: 24px; }
.login-card .btn.block { margin-top: 8px; }
.login-msg { margin-top: 12px; font-size: 13px; color: var(--danger); text-align: center; min-height: 20px; }

/* ========== 主视图 ========== */
.app-view { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 1px 6px rgba(0,0,0,.12);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.who { font-size: 13px; opacity: .95; margin-right: 4px; }
.who b { font-weight: 600; }
.who .role-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.22);
  font-size: 12px;
}

/* 统计 */
.stats {
  display: flex;
  gap: 10px;
  padding: 14px 20px 0;
  flex-wrap: wrap;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-width: 88px;
  flex: 1 1 88px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  border-left: 3px solid var(--primary);
}
.stat-card .n { font-size: 20px; font-weight: 700; line-height: 1.25; }
.stat-card .t { font-size: 12px; color: var(--text-sub); }
.stat-card.lv-A { border-left-color: #d93025; }
.stat-card.lv-B { border-left-color: #f29900; }
.stat-card.lv-C { border-left-color: #1a73e8; }
.stat-card.lv-D { border-left-color: #80868b; }
.stat-card.cat { border-left-color: #34a853; }
.stat-card.total { border-left-color: #202124; }
.stat-card.st { border-left-color: #a142f4; }

/* 工具栏 */
.toolbar {
  background: var(--card);
  margin: 14px 20px 0;
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.tb-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tb-row .inp { width: auto; min-width: 130px; }
.tb-row #fKeyword { flex: 1 1 210px; min-width: 180px; }

/* 内容 */
.content { padding: 14px 20px 28px; flex: 1; }
.table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.table-wrap.inner { box-shadow: none; border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; min-width: 960px; }
.table-wrap.inner table { min-width: 520px; }
thead th {
  background: #fafafa;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f3f4;
  vertical-align: middle;
  font-size: 13.5px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fbff; }
.col-ops { width: 210px; }
td.ops { white-space: nowrap; }
.name-cell { font-weight: 600; }
.muted { color: #9aa0a6; }
.empty-row { text-align: center; color: var(--text-sub); padding: 46px 10px !important; }

/* 徽标 */
.tag {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag.lv-A { background: #fce8e6; color: #c5221f; }
.tag.lv-B { background: #fef7e0; color: #b06000; }
.tag.lv-C { background: #e8f0fe; color: #1967d2; }
.tag.lv-D { background: #f1f3f4; color: #5f6368; }
.tag.st-潜在 { background: #e8f0fe; color: #1967d2; }
.tag.st-跟进中 { background: #fef7e0; color: #b06000; }
.tag.st-已成交 { background: #e6f4ea; color: #137333; }
.tag.st-已流失 { background: #fce8e6; color: #c5221f; }
.tag.cat { background: #e6f4ea; color: #137333; }
.tag.none { background: #f1f3f4; color: #80868b; }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0 4px;
  font-size: 13px;
  color: var(--text-sub);
  flex-wrap: wrap;
}

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(32,33,36,.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  width: 640px;
  max-width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,.24);
  animation: pop .16s ease-out;
}
.modal.small { width: 460px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  padding: 18px 22px 12px;
  border-bottom: 1px solid #f1f3f4;
}
.modal-head h2 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 12px 22px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #f1f3f4;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal-msg { font-size: 13px; color: var(--danger); min-height: 18px; margin-top: 4px; }
.hint { font-size: 13px; color: var(--text-sub); margin-bottom: 12px; }
.hint.warn { color: #b06000; background: #fef7e0; padding: 9px 12px; border-radius: 6px; }

.panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.panel h3 { font-size: 14px; margin-bottom: 12px; color: var(--text-sub); font-weight: 600; }

.inline-add { display: flex; gap: 8px; margin-bottom: 14px; }

.cat-list { list-style: none; max-height: 260px; overflow-y: auto; }
.cat-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 4px;
  border-bottom: 1px solid #f1f3f4;
  font-size: 14px;
}
.cat-list li:last-child { border-bottom: none; }
.cat-list .cat-count { color: var(--text-sub); font-size: 12px; margin-left: 8px; }

.follow-list { max-height: 300px; overflow-y: auto; margin-bottom: 16px; }
.follow-item {
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid var(--primary);
}
.follow-item .meta { font-size: 12px; color: var(--text-sub); margin-bottom: 4px; }
.follow-item .txt { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.follow-empty { color: var(--text-sub); font-size: 13px; text-align: center; padding: 22px 0; }

/* Toast */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #323232;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  box-shadow: 0 4px 16px rgba(0,0,0,.24);
  animation: slidein .2s ease-out;
  max-width: 340px;
  word-break: break-word;
}
.toast.ok { background: #137333; }
.toast.err { background: #c5221f; }
@keyframes slidein { from { transform: translateX(28px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== 响应式：平板 ========== */
@media (max-width: 900px) {
  .stats {
    padding: 12px 12px 0;
    gap: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  }
  .stat-card { padding: 9px 12px; min-width: 0; flex: none; }
  .stat-card .n { font-size: 18px; }
  .toolbar { margin: 12px 12px 0; padding: 12px; }
  .content { padding: 12px 12px 24px; }
  .tb-row .inp { min-width: 0; flex: 1 1 130px; }
  .tb-row .btn { flex: 1 1 auto; }
}

/* ========== 响应式：手机 / 窄屏（核心适配） ========== */
@media (max-width: 820px) {
  body { font-size: 14.5px; }

  /* ---------- 顶栏 ---------- */
  .topbar {
    height: auto;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    gap: 8px;
  }
  .brand { font-size: 16px; }
  .topbar-right { gap: 8px; }
  .who { font-size: 12.5px; margin-right: 0; }
  .who .role-tag { margin-left: 4px; font-size: 11px; }

  /* ---------- 触摸友好 ---------- */
  .btn { min-height: 42px; padding: 10px 14px; }
  .btn.sm { min-height: 38px; padding: 8px 12px; font-size: 13px; }
  .btn.link { min-height: 38px; padding: 8px 10px; }
  input, select, textarea,
  .inp,
  .field input,
  .field select,
  .field textarea {
    font-size: 16px;   /* ≥16px 防止 iOS 聚焦自动放大 */
    min-height: 44px;  /* 保证手指点击区域 */
  }

  /* ---------- 统计卡 ---------- */
  .stats { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
  .stat-card .n { font-size: 17px; }
  .stat-card .t { font-size: 11.5px; }

  /* ---------- 工具栏 ---------- */
  .toolbar { gap: 8px; }
  .tb-row { gap: 8px; }
  .tb-row #fKeyword { flex: 1 1 100%; min-width: 0; }
  .tb-row .inp { min-width: 0; flex: 1 1 calc(50% - 4px); }
  .tb-row .btn { flex: 1 1 calc(50% - 4px); }
  .tb-row #btnAdd { flex: 1 1 100%; }

  /* ---------- 表格 → 卡片 ---------- */
  .table-wrap,
  .table-wrap.inner {
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
    overflow-x: visible;
  }
  .table-wrap table,
  #custTable,
  .table-wrap.inner table {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: block; }
  .table-wrap tbody tr {
    display: block;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  .table-wrap tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: auto;
    padding: 7px 0;
    border-bottom: 1px dashed #f1f3f4;
    font-size: 14px;
    text-align: right;
    word-break: break-word;
  }
  .table-wrap tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--text-sub);
    font-size: 13px;
    text-align: left;
  }
  .table-wrap tbody tr:last-child td { border-bottom: none; }

  /* 卡片首行 = 姓名，作为标题 */
  #custBody td:first-child {
    font-size: 16.5px;
    font-weight: 600;
    padding: 0 0 9px;
    margin-bottom: 4px;
    border-bottom: 1px solid #f1f3f4;
    text-align: left;
  }
  #custBody td:first-child::before { content: none; }

  /* 操作区 */
  .table-wrap tbody td.ops {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    white-space: normal;
    padding: 10px 0 0;
    margin-top: 6px;
    border-top: 1px solid #f1f3f4;
    border-bottom: none;
  }
  .table-wrap tbody td.ops::before { content: none; }
  .table-wrap tbody td.ops .btn.link {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
  }
  .table-wrap tbody td.ops .btn.link.danger { border-color: #f3c2bd; }
  .table-wrap tbody td.ops .btn.link:active { background: #f1f3f4; }

  /* 弹窗内表格里的下拉框 */
  .table-wrap tbody td select.inp { width: auto; flex: 0 1 62%; min-width: 0; }

  /* 空状态 */
  .table-wrap tbody td.empty-row {
    display: block;
    text-align: center;
    border-bottom: none;
    padding: 34px 10px !important;
    margin-bottom: 0 !important;
  }
  .table-wrap tbody td.empty-row::before { content: none; }

  /* ---------- 弹窗：底部抽屉式 ---------- */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
  }
  .modal-head { padding: 16px 16px 10px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot {
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    box-shadow: 0 -1px 8px rgba(0,0,0,.07);
  }
  .modal-foot .btn { flex: 1 1 0; min-height: 46px; }
  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .col-ops { width: auto; }
  .panel { padding: 12px 14px; }
  .inline-add { flex-wrap: wrap; }
  .inline-add .inp { flex: 1 1 auto; }
  .inline-add .btn { flex: 0 0 auto; }
  .cat-list { max-height: none; }
  .follow-list { max-height: 46vh; }
  .cat-list li { padding: 11px 4px; }

  /* ---------- 分页 ---------- */
  .pager { flex-direction: column; gap: 10px; padding: 14px 0 6px; }
  .pager .btn { width: 100%; min-height: 44px; font-size: 14px; }

  /* ---------- 提示 ---------- */
  .toast-wrap { top: 12px; left: 12px; right: 12px; }
  .toast { max-width: none; }

  /* ---------- 登录页 ---------- */
  .login-view { padding: 16px; }
  .login-card { width: 100%; padding: 28px 20px 22px; border-radius: 14px; }
  .login-card h1 { font-size: 19px; }
  .login-sub { font-size: 12.5px; margin-bottom: 20px; }
  .btn.block { min-height: 46px; }

  /* ---------- 触屏：消除 hover 残留 ---------- */
  tbody tr:hover { background: transparent; }
  .table-wrap tbody tr:hover { background: var(--card); }
}

/* ========== 响应式：小屏手机 ========== */
@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px; }
  .stat-card { padding: 8px 10px; }
  .stat-card .n { font-size: 16px; }
  .stat-card .t { font-size: 11px; }
  .brand { font-size: 15px; }
  .topbar-right { flex-wrap: wrap; }
  .toolbar { padding: 10px; }
  .table-wrap tbody tr { padding: 11px 12px; }
}

/* ============================================================
 * 客户地址 + 地图分布
 * ============================================================ */

/* hidden 属性必须优先于组件自身的 display，避免视图切换失效 */
#mapView[hidden],
#listView[hidden],
.unlocated-wrap[hidden],
#btnClearLoc[hidden] { display: none !important; }

/* ---------- 视图切换 ---------- */
.viewtabs {
  display: flex;
  gap: 6px;
  margin: 12px 22px 0;
  border-bottom: 1px solid var(--border);
}
.vtab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 14.5px;
  color: var(--text-sub);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.vtab:hover { color: var(--text); }
.vtab.active {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

/* ---------- 分布地图 ---------- */
.map-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  overflow: hidden;
}
.map-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f3f4;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-sub); }
.legend .lg-item { display: inline-flex; align-items: center; gap: 5px; }
.legend .lg-item i {
  width: 11px; height: 11px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0,0,0,.12);
}
.legend .lg-item b { color: var(--text); }
.map-actions { display: flex; gap: 8px; }

.map-box {
  height: clamp(360px, 56vh, 700px);
  width: 100%;
  background: #eef1f5;
}
.map-note {
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text-sub);
  border-top: 1px solid #f1f3f4;
  line-height: 1.6;
}
.map-note b { color: var(--text); }
.map-note .warn-txt { color: #b06000; font-weight: 600; }

/* 未定位客户清单 */
.unlocated-wrap {
  border-top: 1px solid #f1f3f4;
  padding: 12px 14px 14px;
}
.u-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.u-head h3 { font-size: 14px; font-weight: 600; }
.u-cnt { color: #b06000; font-weight: 600; font-size: 13px; margin-left: 4px; }
.unlocated-wrap .hint { margin: 8px 0 10px; }
.unlocated-list { list-style: none; max-height: 240px; overflow-y: auto; }
.unlocated-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid #f1f3f4;
}
.unlocated-list li:last-child { border-bottom: none; }
.unlocated-list .u-main { min-width: 0; }
.unlocated-list .u-main b { font-size: 14px; }
.unlocated-list .u-addr {
  font-size: 12.5px;
  color: var(--text-sub);
  margin-top: 3px;
  word-break: break-word;
}
.unlocated-list .muted { color: #9aa0a6; }

/* 地图标记 */
.crm-pin { background: transparent; border: none; }
.crm-pin svg { display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.crm-pin-pick svg { filter: drop-shadow(0 2px 5px rgba(0,0,0,.42)); }

/* 标记弹窗（客户摘要） */
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; }
.cust-pop { min-width: 200px; }
.cust-pop .cp-name {
  font-size: 15px;
  font-weight: 600;
  padding-bottom: 7px;
  margin-bottom: 7px;
  border-bottom: 1px solid #f1f3f4;
}
.cust-pop .cp-row { display: flex; gap: 8px; line-height: 1.75; }
.cust-pop .cp-row .k { flex: 0 0 52px; color: var(--text-sub); }
.cust-pop .cp-row .v { flex: 1 1 auto; word-break: break-word; }
.cust-pop .cp-ops { margin-top: 8px; padding-top: 6px; border-top: 1px solid #f1f3f4; text-align: right; }
.leaflet-container { font-family: inherit; }

/* ---------- 客户表单：地址与选点地图 ---------- */
.addr-row { display: flex; gap: 8px; align-items: stretch; }
.addr-box { flex: 1 1 auto; min-width: 0; position: relative; }
.addr-box input { width: 100%; min-width: 0; }
.addr-row .btn { flex: 0 0 auto; white-space: nowrap; }
.lbl-sub { font-weight: 400; font-size: 12px; color: var(--text-sub); margin-left: 6px; }
.addr-hint-line { font-size: 12px; color: var(--text-sub); margin-top: 6px; line-height: 1.6; }

/* 地址联想下拉（支持键盘 / 鼠标 / 触摸） */
.addr-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1300;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  max-height: 264px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.addr-suggest.drop-up { top: auto; bottom: calc(100% + 4px); }
.addr-suggest[hidden] { display: none; }
.addr-suggest .addr-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f3f4;
  touch-action: manipulation;
}
.addr-suggest .addr-item:last-child { border-bottom: none; }
.addr-suggest .addr-item:hover,
.addr-suggest .addr-item.active { background: #eef3fd; }
.addr-suggest .addr-item .lbl { display: block; font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.addr-suggest .addr-item .meta { display: block; font-size: 11.5px; color: var(--text-sub); margin-top: 2px; }
.addr-suggest .addr-hint { padding: 10px 12px; font-size: 12.5px; color: var(--text-sub); line-height: 1.6; }
.addr-suggest .addr-hint.warn { color: #b06000; background: #fef7e0; }
.addr-suggest .addr-hint.info { color: var(--text-sub); background: #f5f7fb; }

.pick-map {
  height: 250px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 0;
}
.coord-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.coord-row .coord { font-size: 12.5px; color: var(--text-sub); display: inline-flex; align-items: center; gap: 6px; }
.coord-row .coord input {
  width: 118px;
  min-width: 0;
  padding: 7px 9px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.addr-tip { font-size: 12.5px; color: var(--text-sub); margin-top: 8px; line-height: 1.6; }
.addr-tip.warn { color: #b06000; background: #fef7e0; padding: 8px 10px; border-radius: 6px; }

/* 列表里的地址列 */
.addr-cell { max-width: 220px; word-break: break-word; }
.addr-cell .tag.none { font-size: 11px; }

/* ---------- 手机端：地图与地址录入 ---------- */
@media (max-width: 900px) {
  .viewtabs { margin: 10px 12px 0; }
  .vtab { flex: 1 1 0; text-align: center; padding: 10px 8px; font-size: 14px; }
}

@media (max-width: 820px) {
  /* 分布视图：地图占据主要高度，图例换行 */
  .map-bar { padding: 10px 12px; }
  .map-actions .btn { flex: 1 1 auto; }
  .map-box { height: clamp(300px, 48vh, 460px); min-height: 300px; }
  .map-note { padding: 10px 12px; font-size: 12px; }
  .unlocated-wrap { padding: 12px; }
  .unlocated-list { max-height: none; }
  .unlocated-list li { padding: 12px 4px; }
  .unlocated-list .btn { min-height: 38px; flex: 0 0 auto; }

  /* 弹窗内的选点地图：略矮，避免抽屉过高 */
  .pick-map { height: 210px; }
  .addr-row { flex-direction: column; align-items: stretch; }
  .addr-row .btn { min-height: 44px; }
  .coord-row { gap: 8px; }
  .coord-row .coord { flex: 1 1 calc(50% - 4px); }
  .coord-row .coord input { width: 100%; font-size: 16px; min-height: 44px; }
  .coord-row #btnClearLoc { flex: 1 1 100%; min-height: 40px; }
  .addr-tip { font-size: 12px; }

  /* 地址联想：触摸友好，限制高度避免被软键盘遮挡 */
  .addr-suggest { max-height: 46vh; }
  .addr-suggest .addr-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 44px;
    padding: 10px 12px;
  }
  .addr-suggest .addr-item .lbl { font-size: 15px; }

  /* 卡片化后地址独立成行 */
  .table-wrap tbody td.addr-cell { max-width: none; }
  .cust-pop { min-width: 0; }
  .leaflet-popup-content { margin: 12px; }
  .cust-pop .cp-row .k { flex: 0 0 46px; }
}

