
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  :root {
    --bg: #f5f0e7;
    --card: #fffdfa;
    --ink: #2f2a24;
    --muted: #8a7f72;
    --line: #e8ddcc;
    --wood: #5a3f2b;
    --wood2: #3b2819;
    --amber: #c98a4b;
    --amber2: #a96c33;
    --green: #4f8a6b;
    --blue: #3f7fa6;
    --red: #b5544b;
    --shadow: 0 2px 10px rgba(74, 53, 39, .08);
    --shadow-lg: 0 12px 40px rgba(59, 40, 25, .18);
    --radius: 14px;
  }
  html, body { height: 100%; }
  body {
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
  }
  button, input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
  button { cursor: pointer; }
  h1, h2, h3, h4, p { margin: 0; }
  a { color: inherit; }

  /* ---------- 顶栏 ---------- */
  .topbar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    background: linear-gradient(120deg, #3b2819 0%, #5a3f2b 60%, #6d4c33 100%);
    color: #f8f1e6;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
    z-index: 500;
  }
  .brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .logo {
    width: 40px; height: 40px; flex: none;
    border-radius: 11px;
    background: rgba(255, 255, 255, .12);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255, 255, 255, .18);
  }
  .brand h1 { font-size: 17px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
  .brand p { font-size: 11.5px; color: #d9c7b0; margin-top: 1px; white-space: nowrap; }
  .top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 13.5px;
    transition: .18s;
    white-space: nowrap;
  }
  .btn:hover { border-color: var(--amber); color: var(--amber2); }
  .btn:active { transform: translateY(1px); }
  .btn svg { width: 15px; height: 15px; }
  .btn.primary {
    background: linear-gradient(135deg, #d59756, #b3753a);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 3px 10px rgba(179, 117, 58, .35);
  }
  .btn.primary:hover { filter: brightness(1.06); color: #fff; }
  .btn.on-dark {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .22);
    color: #f6ecdd;
  }
  .btn.on-dark:hover { background: rgba(255, 255, 255, .18); color: #fff; }
  .btn.block { width: 100%; padding: 11px; font-size: 14.5px; }
  .btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
  .btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

  /* ---------- 标签页 ---------- */
  .tabs {
    flex: none;
    display: flex;
    gap: 4px;
    padding: 0 16px;
    background: #fffdfa;
    border-bottom: 1px solid var(--line);
    z-index: 400;
  }
  .tab {
    display: flex; align-items: center; gap: 7px;
    padding: 12px 16px;
    border: none; background: none;
    color: var(--muted);
    font-size: 14px;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1px;
    transition: .15s;
  }
  .tab svg { width: 16px; height: 16px; }
  .tab:hover { color: var(--wood); }
  .tab.active { color: var(--amber2); border-bottom-color: var(--amber); font-weight: 600; }

  /* ---------- 主区域 ---------- */
  main { flex: 1; min-height: 0; position: relative; }
  .page { display: none; height: 100%; overflow-y: auto; padding: 20px; }
  .page.active { display: block; }
  #page-map { padding: 0; overflow: hidden; }

  /* ---------- 统计 ---------- */
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
  .stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 13px 16px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
  }
  .stat::after {
    content: ""; position: absolute; right: -18px; top: -18px;
    width: 62px; height: 62px; border-radius: 50%;
    background: rgba(201, 138, 75, .09);
  }
  .stat .num { font-size: 24px; font-weight: 700; color: var(--wood); line-height: 1.2; font-variant-numeric: tabular-nums; }
  .stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
  .stat:nth-child(2) .num { color: var(--green); }
  .stat:nth-child(3) .num { color: var(--blue); }
  .stat:nth-child(4) .num { color: var(--amber2); }

  /* ---------- 工具条 ---------- */
  .toolbar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    margin-bottom: 16px;
  }
  .searchbox {
    position: relative; flex: 1; min-width: 180px;
  }
  .searchbox svg {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--muted); pointer-events: none;
  }
  .searchbox input {
    width: 100%; padding: 9px 12px 9px 36px;
    border: 1px solid var(--line); border-radius: 10px;
    background: #fff; outline: none; transition: .15s;
  }
  .searchbox input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(201, 138, 75, .13); }
  select.filter {
    padding: 9px 30px 9px 12px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
    outline: none; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a7f72' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
  }
  select.filter:focus { border-color: var(--amber); }

  .sample-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #fdf6ea; border: 1px dashed #e0c79f; color: #8a6435;
    border-radius: 12px; padding: 9px 14px; margin-bottom: 14px; font-size: 13px;
    flex-wrap: wrap;
  }
  .sample-banner button {
    border: 1px solid #d9b888; background: #fff; color: #a06a2f;
    padding: 4px 10px; border-radius: 7px; font-size: 12.5px;
  }

  /* ---------- 客户卡片 ---------- */
  .cust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 13px;
  }
  .pager {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin: 16px 0 8px;
  }
  .pg-btn {
    padding: 7px 15px; border: 1px solid var(--line); border-radius: 9px;
    background: #fff; color: #6f6455; font-size: 13px;
  }
  .pg-btn:disabled { opacity: .45; }
  .pg-info { font-size: 12px; color: #8a7f72; font-variant-numeric: tabular-nums; }
  .cust-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px 12px;
    box-shadow: var(--shadow);
    position: relative;
    transition: .18s;
    border-top: 3px solid var(--type-color, var(--amber));
  }
  .cust-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(74, 53, 39, .13); }
  .cust-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .cust-name { font-size: 15.5px; font-weight: 700; line-height: 1.35; word-break: break-all; }
  .cust-sub { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--type-color, var(--amber)); display: inline-block; flex: none; }
  .badges { display: flex; gap: 5px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
  .badge {
    font-size: 11px; padding: 2.5px 8px; border-radius: 20px;
    background: #f0e9dd; color: #7a6a56; white-space: nowrap;
    border: 1px solid transparent;
  }
  .badge.lv-A { background: #fbeae7; color: #b5544b; }
  .badge.lv-B { background: #fdf0dd; color: #b3792f; }
  .badge.lv-C { background: #eeece8; color: #8a8277; }
  .badge.lv-D { background: #e9d9d5; color: #8a3f38; }
  .badge.st-已合作 { background: #e8f3ec; color: #3f7a5c; }
  .badge.st-跟进中 { background: #fdf0dd; color: #b3792f; }
  .badge.st-待开发 { background: #eaf1f7; color: #3f6d8f; }
  .badge.st-暂停 { background: #efece9; color: #8a8277; }
  .badge.noloc { background: #f6ede4; color: #a9743f; }

  .cust-info { margin-top: 10px; display: grid; gap: 4px; font-size: 13px; color: #5d5346; }
  .cust-info .row { display: flex; gap: 7px; align-items: flex-start; }
  .cust-info svg { width: 13px; height: 13px; flex: none; margin-top: 3px; color: #b3a795; }
  .cust-info .txt { word-break: break-all; }
  .cust-info a { text-decoration: none; }
  .cust-info a:hover { color: var(--amber2); }
  .last-visit { margin-top: 9px; font-size: 12px; color: #96886f; background: #faf6ee; border-radius: 7px; padding: 5px 9px; }

  .cust-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line);
  }
  .cust-actions { display: flex; gap: 6px; }
  .icon-btn {
    display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid var(--line); background: #fff; color: #6f6455;
    border-radius: 8px; padding: 5px 9px; font-size: 12.5px; transition: .15s;
  }
  .icon-btn svg { width: 13px; height: 13px; }
  .icon-btn:hover { border-color: var(--amber); color: var(--amber2); }
  .icon-btn.danger:hover { border-color: #d9a49e; color: var(--red); background: #fdf5f4; }
  .icon-btn.solid { background: #f8f1e6; border-color: #eadcc6; color: #8a6435; }

  .empty {
    text-align: center; padding: 60px 20px; color: var(--muted);
    background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  }
  .empty h3 { font-size: 16px; color: #6f6455; margin-bottom: 6px; }

  /* ---------- 地图 ---------- */
  #customerMap { position: absolute; inset: 0; background: #e8e2d6; }
  .map-legend {
    position: absolute; top: 14px; left: 14px; z-index: 500;
    background: rgba(255, 253, 250, .95);
    border: 1px solid var(--line); border-radius: 12px;
    padding: 9px 12px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 5px;
    backdrop-filter: blur(4px);
    max-width: calc(100% - 28px);
  }
  .map-legend .lg-title {
    font-size: 11.5px; color: var(--muted);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
  }
  .map-legend .lg-toggle { display: none; font-size: 10px; color: #a9977f; transition: transform .15s; }
  .map-legend .lg-row { display: flex; gap: 12px; flex-wrap: wrap; }
  .lg-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #6f6455; }
  .map-empty {
    position: absolute; inset: 0; z-index: 450;
    display: none; align-items: center; justify-content: center; flex-direction: column;
    gap: 4px; text-align: center; pointer-events: none;
    color: #7a6a56; font-size: 14px; background: rgba(245, 240, 231, .55);
  }
  .map-empty span { font-size: 12px; color: #9c8f7c; }
  .map-empty.show { display: flex; }
  .map-error {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    padding: 30px; text-align: center; color: #a06a2f; font-size: 13px; line-height: 1.7;
  }

  .leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 8px 26px rgba(59, 40, 25, .22); }
  .leaflet-popup-content { margin: 12px 14px; min-width: 190px; }
  .pop-title { font-size: 14.5px; font-weight: 700; color: #3b2819; }
  .pop-sub { font-size: 11.5px; color: #a9977f; margin: 2px 0 7px; }
  .pop-line { font-size: 12.5px; color: #5d5346; margin-top: 3px; word-break: break-all; }
  .pop-actions { display: flex; gap: 6px; margin-top: 9px; }
  .pop-actions button {
    flex: 1; padding: 5px 0; border-radius: 7px; font-size: 12px;
    border: 1px solid #eadcc6; background: #faf5ec; color: #8a6435;
  }
  .pop-actions button:hover { background: #f3e8d7; }

  .pin-dot {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .35);
    background: var(--c, #c98a4b);
  }
  .route-pin {
    width: 27px; height: 27px; border-radius: 50%;
    background: linear-gradient(135deg, #d59756, #b3753a);
    color: #fff; border: 2px solid #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  }
  .start-pin {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, #5f9b78, #3f7a5c);
    color: #fff; border: 2px solid #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  }

  /* ---------- 路线规划 ---------- */
  .route-layout { display: flex; height: 100%; }
  .route-panel {
    width: 400px; flex: none;
    background: #fbf7f0;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    padding: 16px;
  }
  .panel-block { margin-bottom: 16px; }
  .panel-block h3 {
    font-size: 13px; color: #6f6455; font-weight: 600;
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
  }
  .panel-block h3 .cnt { font-size: 11.5px; color: var(--amber2); font-weight: 600; }
  .route-panel select {
    width: 100%; padding: 9px 30px 9px 11px;
    border: 1px solid var(--line); border-radius: 9px; background: #fff;
    outline: none; appearance: none; cursor: pointer; font-size: 13px;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a7f72' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
  }
  .start-info { font-size: 12px; color: #978a76; margin-top: 6px; display: flex; align-items: center; gap: 5px; }
  .start-info svg { width: 12px; height: 12px; }

  .filter-row { display: flex; gap: 7px; margin-bottom: 8px; }
  .filter-row select { font-size: 12.5px; padding: 7px 26px 7px 9px; }
  .route-search { position: relative; margin-bottom: 8px; }
  .route-search svg {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; color: var(--muted); pointer-events: none;
  }
  .route-search input {
    width: 100%; padding: 8px 30px 8px 31px;
    border: 1px solid var(--line); border-radius: 9px;
    background: #fff; outline: none; font-size: 13px; transition: .15s;
  }
  .route-search input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(201, 138, 75, .12); }
  .route-search .search-clear {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; border: none; border-radius: 50%;
    background: #efe7db; color: #8a7b64; font-size: 14px; line-height: 1;
    align-items: center; justify-content: center;
  }
  .route-search .search-clear:hover { background: #e6d9c7; color: var(--wood); }
  .mini-actions { display: flex; gap: 8px; margin-bottom: 8px; }
  .mini-actions button {
    border: none; background: none; color: var(--amber2);
    font-size: 12px; padding: 2px 0; text-decoration: underline; text-underline-offset: 2px;
  }

  .candidate-list {
    border: 1px solid var(--line); border-radius: 11px;
    background: #fff; max-height: 260px; overflow-y: auto;
  }
  .cand {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 11px; border-bottom: 1px solid #f3ece1;
    cursor: pointer; transition: background .12s;
  }
  .cand:last-child { border-bottom: none; }
  .cand:hover { background: #fdf9f3; }
  .cand.disabled { opacity: .55; cursor: not-allowed; }
  .cand input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: var(--amber2); flex: none; cursor: pointer;
  }
  .cand-main { flex: 1; min-width: 0; }
  .cand-name { font-size: 13px; font-weight: 600; color: #4a3f31; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cand-sub { font-size: 11px; color: #a99c89; margin-top: 1px; }
  .cand-dist { font-size: 11.5px; color: #b08a5c; flex: none; font-variant-numeric: tabular-nums; }
  .cand-dist.none { color: #b5544b; }

  .route-result {
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    padding: 13px; box-shadow: var(--shadow); margin-top: 4px;
  }
  .route-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
  .rs-item { background: #faf5ec; border-radius: 9px; padding: 8px 10px; }
  .rs-item .v { font-size: 16px; font-weight: 700; color: #8a6435; font-variant-numeric: tabular-nums; }
  .rs-item .k { font-size: 11px; color: #a9977f; }
  .rs-note { font-size: 11px; color: #a99c89; margin-bottom: 10px; line-height: 1.5; }
  .stop {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 0; border-bottom: 1px dashed #f2ebdf;
  }
  .stop:last-child { border-bottom: none; }
  .stop-no {
    width: 22px; height: 22px; border-radius: 50%; flex: none;
    background: #f3e6d4; color: #a06a2f;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
  }
  .stop-main { flex: 1; min-width: 0; }
  .stop-name { font-size: 12.8px; font-weight: 600; color: #4a3f31; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stop-sub { font-size: 10.8px; color: #a99c89; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stop-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
  .leg { font-size: 10.5px; color: #b08a5c; font-variant-numeric: tabular-nums; }
  .nav-link {
    font-size: 10.5px; color: #3f7a5c; text-decoration: none;
    border: 1px solid #d6e5db; background: #eef6f0; border-radius: 6px; padding: 1px 7px;
  }
  .nav-link:hover { background: #e2efe6; }
  .route-foot { display: flex; gap: 8px; margin-top: 12px; }

  .route-map-wrap { position: relative; flex: 1; min-width: 0; }
  .route-fab {
    display: none; position: absolute; right: 12px; bottom: 40px; z-index: 600;
    box-shadow: 0 6px 18px rgba(179, 117, 58, .35);
  }

  /* ---------- 抽屉表单 ---------- */
  .overlay {
    position: fixed; inset: 0; background: rgba(43, 30, 19, .42);
    opacity: 0; visibility: hidden; transition: .22s; z-index: 1000;
    backdrop-filter: blur(1px);
  }
  .overlay.open { opacity: 1; visibility: visible; }
  .drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(540px, 100%);
    background: var(--bg);
    z-index: 1001;
    transform: translateX(102%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
  }
  .drawer.open { transform: translateX(0); }
  .drawer-head {
    flex: none; display: flex; align-items: center; justify-content: space-between;
    padding: 15px 20px; background: #fffdfa; border-bottom: 1px solid var(--line);
  }
  .drawer-head h2 { font-size: 16px; color: var(--wood); }
  .drawer-head p { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
  .close-btn {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
    background: #fff; display: flex; align-items: center; justify-content: center; color: #7a6a56;
  }
  .close-btn:hover { background: #f7f1e7; }
  .close-btn svg { width: 16px; height: 16px; }
  .drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 24px; }

  .form-section {
    background: var(--card); border: 1px solid var(--line); border-radius: 13px;
    padding: 14px 15px; margin-bottom: 13px;
  }
  .form-section > h4 {
    font-size: 12.5px; color: #8a7b64; font-weight: 600; margin-bottom: 11px;
    display: flex; align-items: center; gap: 6px;
  }
  .form-section > h4::before {
    content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--amber);
  }
  .field { margin-bottom: 11px; }
  .field:last-child { margin-bottom: 0; }
  .field label { display: block; font-size: 12px; color: #7f7260; margin-bottom: 4px; }
  .field label .req { color: var(--red); }
  .field input, .field select, .field textarea {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--line); border-radius: 9px;
    background: #fff; outline: none; transition: .15s;
  }
  .field select {
    appearance: none; cursor: pointer;
    padding-right: 30px;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a7f72' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
  }
  .field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--amber); box-shadow: 0 0 0 3px rgba(201, 138, 75, .12);
  }
  .field textarea { resize: vertical; min-height: 64px; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

  .loc-box {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: #faf6ee; border: 1px dashed #e3d3ba; border-radius: 9px;
    padding: 8px 11px; flex-wrap: wrap;
  }
  .loc-txt { font-size: 12.5px; color: #8a7b64; }
  .loc-txt b { color: #a06a2f; font-weight: 600; }
  .loc-btns { display: flex; gap: 6px; }

  .visits { display: flex; flex-direction: column; gap: 6px; margin-bottom: 9px; }
  .visit-item {
    display: flex; gap: 8px; align-items: flex-start;
    background: #faf6ee; border-radius: 8px; padding: 7px 10px; font-size: 12.5px;
    color: #5d5346;
  }
  .visit-date { color: #b08a5c; flex: none; font-size: 11.5px; font-variant-numeric: tabular-nums; }
  .visit-text { flex: 1; word-break: break-all; }
  .visit-del {
    border: none; background: none; color: #b9aa95; padding: 0 2px; font-size: 15px; line-height: 1;
  }
  .visit-del:hover { color: var(--red); }
  .visit-add { display: flex; gap: 6px; }
  .visit-add input[type="date"] { width: 128px; flex: none; }
  .visit-add input[type="text"] { flex: 1; min-width: 0; }
  .visit-add button { flex: none; }
  .no-visits { font-size: 12px; color: #b3a795; padding: 2px 0 7px; }

  .drawer-foot {
    flex: none; padding: 12px 20px; background: #fffdfa; border-top: 1px solid var(--line);
    display: flex; gap: 9px;
  }
  .drawer-foot .btn { flex: 1; }
  .drawer-foot .btn.danger-outline { flex: none; color: var(--red); border-color: #e3c6c1; padding: 8px 12px; }
  .drawer-foot .btn.danger-outline:hover { background: #fdf5f4; }

  /* ---------- 地图选点弹窗 ---------- */
  .modal {
    position: fixed; inset: 0; z-index: 1200;
    background: rgba(43, 30, 19, .45);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: .2s;
    padding: 20px;
  }
  .modal.open { opacity: 1; visibility: visible; }
  .modal-box {
    width: min(760px, 100%); height: min(640px, 92vh);
    background: var(--bg); border-radius: 16px; overflow: hidden;
    display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
    transform: scale(.97); transition: .2s;
  }
  .modal.open .modal-box { transform: scale(1); }
  .modal-head {
    flex: none; display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: #fffdfa; border-bottom: 1px solid var(--line);
  }
  .modal-head h3 { font-size: 14.5px; color: var(--wood); }
  .city-chips {
    flex: none; display: flex; gap: 6px; overflow-x: auto;
    padding: 8px 12px; background: #fffdfa; border-bottom: 1px solid var(--line);
  }
  .city-chips button {
    flex: none; font-size: 12px; padding: 4px 10px; border-radius: 20px;
    border: 1px solid var(--line); background: #fff; color: #7f7260;
  }
  .city-chips button:hover { border-color: var(--amber); color: var(--amber2); }
  .modal-map-wrap { position: relative; flex: 1; min-height: 0; }
  #pickerMap { position: absolute; inset: 0; }
  .pick-tip {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 500;
    background: rgba(59, 40, 25, .82); color: #fff; font-size: 12px;
    padding: 5px 12px; border-radius: 20px; white-space: nowrap;
    pointer-events: none;
  }
  .modal-foot {
    flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px; background: #fffdfa; border-top: 1px solid var(--line);
    flex-wrap: wrap;
  }
  .coord-txt { font-size: 12px; color: #8a7b64; font-variant-numeric: tabular-nums; }
  .coord-txt b { color: #a06a2f; }
  .modal-actions { display: flex; gap: 8px; }

  /* ---------- 提示 ---------- */
  #toastWrap {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center;
    pointer-events: none;
  }
  .toast {
    background: rgba(47, 32, 20, .92); color: #f8f1e6;
    padding: 9px 18px; border-radius: 10px; font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    animation: toastIn .22s ease both;
    max-width: 86vw; text-align: center;
  }
  .toast.ok { background: rgba(52, 96, 72, .95); }
  .toast.err { background: rgba(150, 62, 54, .95); }
  @keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

  /* ---------- 滚动条 ---------- */
  ::-webkit-scrollbar { width: 7px; height: 7px; }
  ::-webkit-scrollbar-thumb { background: #d9ccb8; border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: #c9b79c; }
  ::-webkit-scrollbar-track { background: transparent; }

  /* ---------- 响应式 ---------- */
  @media (max-width: 900px) {
    .route-layout { flex-direction: column; height: 100%; }
    .map-layout { flex-direction: column-reverse; }
    .route-panel { width: 100%; flex: none; max-height: 52%; border-right: none; border-top: 1px solid var(--line); }
    .route-map-wrap { flex: 1; min-height: 260px; }
    .map-layout .route-panel { display: none; }
    .map-layout.panel-open .route-panel { display: block; }
    .route-fab { display: inline-flex; }
    .candidate-list { max-height: 180px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .cust-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 640px) {
    body { font-size: 13.5px; }
    .topbar { padding: 8px 12px; gap: 8px; }
    .brand { gap: 8px; }
    .logo { width: 34px; height: 34px; border-radius: 9px; }
    .logo svg { width: 22px; height: 22px; }
    .brand h1 { font-size: 15px; }
    .brand p { display: none; }
    .top-actions { gap: 6px; }
    .btn { padding: 7px 10px; font-size: 12.5px; }
    .btn .lbl-long { display: none; }
    .tab { padding: 11px 12px; font-size: 13px; gap: 5px; }
    .page { padding: 13px; }
    #page-map { padding: 0; }
    .stats { gap: 8px; }
    .stat { padding: 10px 12px; }
    .stat .num { font-size: 20px; }
    .toolbar { gap: 7px; }
    .searchbox { flex: 1 1 100%; }
    select.filter { flex: 1; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .drawer-body { padding: 14px 14px 20px; }
    .drawer-head, .drawer-foot { padding-left: 14px; padding-right: 14px; }
    .route-result { margin-bottom: 16px; }
    .map-legend { top: 8px; left: 8px; padding: 6px 9px; max-width: calc(100% - 96px); gap: 4px; }
    .map-legend .lg-title { font-size: 10.5px; cursor: pointer; user-select: none; }
    .map-legend .lg-toggle { display: inline; }
    .map-legend.collapsed .lg-toggle { transform: rotate(-90deg); }
    .map-legend.collapsed .lg-row { display: none; }
    .map-legend .lg-row { flex-direction: column; gap: 3px; }
    .map-legend .lg-item { font-size: 11px; gap: 4px; }
    .modal { padding: 10px; }
    .modal-box { height: 94vh; }
    .visit-add { flex-wrap: wrap; }
    .visit-add input[type="date"] { width: 120px; }
  }

  /* ---------- 登录 / 初始化 ---------- */
  .user-chip {
    display: inline-block;
    margin-left: 4px;
    padding: 0 7px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .2);
    font-size: 11px;
    color: #f2e4cf;
    line-height: 17px;
    vertical-align: 1px;
  }
  body.auth-page {
    display: block;
    overflow: auto;
    background:
      radial-gradient(900px 420px at 15% -10%, rgba(201, 138, 75, .18), transparent 60%),
      radial-gradient(700px 380px at 95% 0%, rgba(79, 138, 107, .12), transparent 55%),
      var(--bg);
  }
  .auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
  }
  .auth-card {
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 26px 26px 22px;
    box-shadow: 0 18px 50px rgba(74, 53, 39, .16);
  }
  .auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
  .auth-brand .logo {
    width: 46px; height: 46px; flex: none;
    border-radius: 13px;
    background: linear-gradient(135deg, #f6ead8, #efdfc7);
    border: 1px solid #ead9bf;
    display: flex; align-items: center; justify-content: center;
  }
  .auth-brand h1 { font-size: 18px; color: var(--wood2); letter-spacing: .3px; }
  .auth-brand p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
  .auth-form { margin-top: 14px; }
  .auth-label { display: block; font-size: 12.5px; color: #7f7260; margin: 13px 0 5px; }
  .auth-input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    outline: none;
    font-size: 14px;
    transition: .15s;
  }
  .auth-input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(201, 138, 75, .13); }
  .auth-submit { display: block; width: 100%; margin-top: 18px; padding: 11px; text-align: center; text-decoration: none; }
  .auth-check {
    display: flex; align-items: center; gap: 7px;
    margin-top: 12px; font-size: 13px; color: #6f6455;
    cursor: pointer; user-select: none;
  }
  .auth-check input { width: 15px; height: 15px; accent-color: var(--amber); }
  .auth-error, .auth-ok {
    margin-top: 12px;
    border-radius: 9px;
    padding: 8px 11px;
    font-size: 12.5px;
    line-height: 1.6;
  }
  .auth-error { background: #fdf3f2; border: 1px solid #f0d5d1; color: #a94a41; }
  .auth-ok { background: #edf6ef; border: 1px solid #d3e7d9; color: #3f7a5c; }
  .auth-note { margin-top: 16px; font-size: 11.5px; color: #a99c89; line-height: 1.7; }
  .auth-note code { background: #f6efe4; padding: 1px 5px; border-radius: 4px; font-size: 11px; word-break: break-all; }
  .auth-foot { margin-top: 16px; font-size: 11.5px; color: #b9a88f; letter-spacing: .5px; }
  @media (max-width: 640px) {
    .auth-card { padding: 22px 18px 18px; }
    .auth-brand h1 { font-size: 16.5px; }
  }
