:root {
  --bg: #eef1f8;
  --panel: rgba(255, 255, 255, 0.62);
  --panel-solid: #ffffff;
  --text: #1a1d29;
  --muted: #767e92;
  --border: rgba(20, 30, 60, 0.09);
  --primary: #ff7a59;
  --primary-2: #ff5e9c;
  --accent: #6c5ce7;
  --accent-soft: rgba(108, 92, 231, 0.12);
  --shadow: 0 18px 40px rgba(28, 36, 64, 0.12);
  --shadow-sm: 0 6px 18px rgba(28, 36, 64, 0.10);
  --glass-blur: 18px;
  --radius: 20px;
}

[data-theme="dark"] {
  --bg: #080b11;
  --panel: rgba(26, 32, 44, 0.55);
  --panel-solid: #131823;
  --text: #eef1f7;
  --muted: #98a1b5;
  --border: rgba(255, 255, 255, 0.09);
  --primary: #ff8a66;
  --primary-2: #ff6fae;
  --accent: #8b7bff;
  --accent-soft: rgba(139, 123, 255, 0.16);
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(820px 520px at 10% -8%, rgba(255, 122, 89, 0.14), transparent 60%),
    radial-gradient(720px 520px at 102% 4%, rgba(108, 92, 231, 0.14), transparent 55%);
  pointer-events: none;
  transition: opacity 0.4s;
}

/* ===== Topbar ===== */
.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: var(--panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(255, 94, 156, 0.38);
  animation: floaty 4s ease-in-out infinite;
}
.logo svg { width: 24px; height: 24px; fill: #fff; }
.topbar h1 {
  font-size: 17px; margin: 0; letter-spacing: 0.2px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.stat {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--panel-solid); padding: 7px 14px;
  border-radius: 999px; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* ===== Buttons ===== */
.btn {
  border: none; cursor: pointer; border-radius: 12px;
  padding: 10px 15px; font-size: 13px; font-weight: 600;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, filter 0.2s, background 0.2s;
  will-change: transform;
}
.btn:active { transform: scale(0.97) !important; }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: 0 8px 20px rgba(255, 94, 156, 0.34);
}
.btn.primary:hover { box-shadow: 0 12px 26px rgba(255, 94, 156, 0.46); filter: brightness(1.04); }
.btn.ghost {
  background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.65; cursor: progress; }

/* ===== Layout 双栏 ===== */
.layout { display: flex; height: calc(100vh - 62px); gap: 14px; padding: 14px; }
.sidebar {
  flex: 0 1 40%; min-width: 360px; max-width: 520px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto; padding: 16px;
  background: var(--panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.detail {
  flex: 1 1 60%; min-width: 0;
  overflow-y: auto; padding: 22px 24px;
  background: var(--panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  background: transparent; border: none; box-shadow: none;
  border-radius: 0; padding: 4px 2px; margin-bottom: 6px;
}
.panel + .panel { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 4px; }
.panel h2 { font-size: 13.5px; margin: 0 0 10px; font-weight: 700; letter-spacing: 0.3px; }
.panel h3 { font-size: 12px; color: var(--muted); margin: 16px 0 9px; font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.65; margin: 0 0 12px; }

/* ===== 采集区 ===== */
.collect-row { display: flex; gap: 8px; }
.collect-row .input { margin-top: 0; }
.collect-row .btn { white-space: nowrap; }

/* ===== City presets ===== */
.city-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 12px; padding: 7px 13px; border-radius: 999px;
  background: var(--panel-solid); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-weight: 500;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.chip:hover {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  transform: translateY(-2px); box-shadow: 0 8px 18px rgba(255, 94, 156, 0.32);
}

/* ===== Inputs ===== */
.input {
  width: 100%; padding: 10px 13px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel-solid);
  color: var(--text); font-size: 13px; margin-top: 5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.16); }
/* datetime-local 日期时间输入：前面可填写，右侧日历图标可选择 */
.datetime-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.datetime-wrap input[type="datetime-local"] {
  width: 100%;
  padding-right: 42px;
  cursor: text;
  background-image: none;
}
/* 隐藏原生日历指示器，使用右侧显式图标触发 */
.datetime-wrap input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  display: none;
}
.calendar-trigger {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 42px;
  border: none;
  border-radius: 0 11px 11px 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ff7a59' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}
.calendar-trigger:active { opacity: 0.7; }
label { display: block; font-size: 12px; color: var(--muted); margin-top: 11px; font-weight: 500; }

/* 仅显示有电话 筛选开关 */
.filter-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 9px 12px;
  background: var(--panel-solid); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; user-select: none;
  font-size: 13px; color: var(--text); font-weight: 500;
  transition: border-color 0.2s, background 0.2s;
}
.filter-toggle:hover { border-color: var(--primary); }
.filter-toggle input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* 状态筛选胶囊 */
.status-filter { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.sf-pill {
  font-size: 12px; padding: 6px 13px; border-radius: 999px; cursor: pointer;
  background: var(--panel-solid); border: 1px solid var(--border);
  color: var(--muted); font-weight: 600; transition: all 0.16s;
}
.sf-pill:hover { border-color: var(--primary); color: var(--text); }
.sf-pill.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px rgba(255, 94, 156, 0.3);
}

/* 统计条 */
.stats-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 12px; font-size: 11.5px; color: var(--muted);
}
.sb-total { font-weight: 700; color: var(--text); }
.sb-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 4px; }
.sb-num { font-weight: 600; }

/* ===== 状态颜色（药丸/分段/圆点共用） ===== */
.warn  { background: rgba(245, 158, 11, 0.16);  color: #b7791f; }
.info  { background: rgba(79, 140, 255, 0.16);  color: #3b6fd4; }
.ok    { background: rgba(34, 197, 94, 0.16);   color: #1f9d57; }
.muted { background: rgba(120, 126, 146, 0.18); color: #6b7180; }
.pending { background: rgba(168, 85, 247, 0.16); color: #8b5cf6; }

/* ===== Store list ===== */
.store-list { margin-top: 12px; display: flex; flex-direction: column; gap: 9px; }
.load-more { margin: 8px auto 2px; width: 100%; font-weight: 600; color: var(--accent); }
.store-item {
  position: relative;
  background: var(--panel-solid); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px 12px 16px; cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, border-color 0.2s;
  animation: fadeInUp 0.42s both;
  overflow: hidden;
}
.store-item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  opacity: 0; transition: opacity 0.2s;
}
.store-item:hover { transform: translateY(-3px); border-color: transparent; box-shadow: var(--shadow-sm); }
.store-item:hover::before { opacity: 1; }
.store-item.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.store-item.selected::before { opacity: 1; }
.store-item .name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.store-item .meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.7; }
.store-item .meta span { display: inline-flex; align-items: center; gap: 4px; }
.store-item .meta svg { width: 12px; height: 12px; opacity: 0.7; }

/* 状态药丸（列表内） */
.status-pill {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 10px;
  border-radius: 999px; margin-left: auto;
}

/* 小按钮（复制 / 跟进 / 编辑 / 删除） */
.mini-btn {
  border: 1px solid var(--border); background: var(--panel-solid);
  color: var(--accent); border-radius: 8px; font-size: 11px; font-weight: 600;
  padding: 2px 9px; cursor: pointer; transition: all 0.15s; vertical-align: middle;
}
.mini-btn:hover { border-color: var(--primary); color: var(--primary); }
.mini-btn.danger { color: #e05050; }
.mini-btn.danger:hover { border-color: #e05050; color: #e05050; }
.tags-row { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px; }
.rep-tag, .follow-tag {
  display: inline-block; font-size: 10.5px; font-weight: 600; padding: 2px 9px;
  border-radius: 999px;
}
.rep-tag { background: rgba(255, 122, 89, 0.14); color: var(--primary); }
.follow-tag { background: var(--accent-soft); color: var(--accent); }

.empty { text-align: center; padding: 34px 12px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; opacity: 0.45; margin-bottom: 10px; }

/* ===== 详情面板 ===== */
.detail-empty {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  color: var(--muted); gap: 14px;
}
.detail-empty svg { width: 72px; height: 72px; opacity: 0.35; fill: var(--primary); }
.detail-empty p { font-size: 14px; max-width: 280px; line-height: 1.7; }
.detail-content { animation: fadeIn 0.25s both; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.detail-title {
  font-size: 21px; font-weight: 800; letter-spacing: 0.2px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.detail-ops { display: flex; gap: 7px; flex-shrink: 0; }

.status-seg { display: flex; gap: 8px; margin: 16px 0 6px; flex-wrap: wrap; }
.seg {
  flex: 1; min-width: 72px; padding: 9px 10px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel-solid);
  color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all 0.16s;
}
.seg:hover { border-color: var(--primary); color: var(--text); }
.seg.on { border-color: transparent; color: #1a1d29; box-shadow: var(--shadow-sm); }
[data-theme="dark"] .seg.on { color: #fff; }

/* 详情页状态更新提示：紧跟状态分段按钮下方，醒目显示 */
.detail-status-hint {
  margin: 8px 0 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.detail-status-hint.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.detail-status-hint.success {
  background: rgba(34, 197, 94, 0.14);
  color: #1f9d55;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.detail-status-hint.error {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.detail-status-hint::before {
  content: "";
  width: 18px; height: 18px;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.detail-status-hint.success::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%231f9d55' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}
.detail-status-hint.error::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
}
[data-theme="dark"] .detail-status-hint.success { color: #4ade80; border-color: rgba(34, 197, 94, 0.45); }
[data-theme="dark"] .detail-status-hint.error { color: #f87171; border-color: rgba(239, 68, 68, 0.45); }

.info-grid { margin-top: 14px; }
.info-row {
  display: flex; gap: 14px; padding: 11px 2px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.info-k { width: 72px; flex-shrink: 0; color: var(--muted); font-weight: 600; }
.info-v { color: var(--text); line-height: 1.6; word-break: break-word; }
.info-v .mini-btn { margin-left: 6px; }
/* 详情页复制成功提示：紧跟「复制」按钮右侧就地显示，避免跑到屏幕底部看不见 */
.copied-hint { display: none; margin-left: 8px; font-size: 12px; font-weight: 600; color: #1f9d55; }
.copied-hint.show { display: inline; animation: fadeIn .18s ease; }

/* 详情头部状态药丸（复用 .status-pill，放大一点） */
.detail-head .status-pill { font-size: 12px; padding: 4px 12px; margin-left: auto; }

/* 详情底部操作栏（吸底） */
.detail-actions {
  position: sticky; bottom: -22px; margin: 18px -24px -22px;
  padding: 14px 24px;
  display: flex; gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, var(--panel) 28%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid var(--border);
}
[data-theme="dark"] .detail-actions {
  background: linear-gradient(180deg, rgba(26,29,41,0) 0%, var(--panel) 30%);
}
.act-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 10px; border-radius: 13px; font-size: 13.5px; font-weight: 700;
  cursor: pointer; border: 1px solid transparent; color: var(--text);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}
.act-btn svg { width: 16px; height: 16px; }
.act-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.act-btn:active { transform: translateY(0); }
.act-follow {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}
.act-follow:hover { filter: brightness(1.05); }
.act-edit {
  background: var(--panel-solid); border-color: var(--border); color: var(--text);
}
.act-edit:hover { border-color: var(--primary); color: var(--primary); }
.act-del {
  background: var(--panel-solid); border-color: rgba(224, 80, 80, 0.35); color: #e05050;
}
.act-del:hover { background: rgba(224, 80, 80, 0.1); border-color: #e05050; }

/* 跟进弹窗状态选择药丸 */
.follow-status-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fsp {
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 700;
  border: 1px solid var(--border); background: var(--panel-solid); color: var(--muted);
  transition: all 0.16s;
}
.fsp:hover { color: var(--text); border-color: var(--primary); }
.fsp.on { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.fsp.on[data-v="待跟进"] { background: linear-gradient(135deg, #f59e0b, #f97316); }
.fsp.on[data-v="已联系"] { background: linear-gradient(135deg, #4f8cff, #3b6fd4); }
.fsp.on[data-v="已成交"] { background: linear-gradient(135deg, #22c55e, #16a34a); }
.fsp.on[data-v="已放弃"] { background: linear-gradient(135deg, #8b919e, #6b7180); }


/* ===== Toast（全局固定） ===== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 2500; font-size: 13px; padding: 11px 18px;
  border-radius: 12px; background: var(--accent-soft);
  color: var(--accent); border: 1px solid rgba(108, 92, 231, 0.3);
  box-shadow: var(--shadow-sm); max-width: 90vw;
  display: flex; align-items: center; gap: 8px;
  animation: slideUp 0.3s both;
}
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.hidden { display: none !important; }

/* ===== 下次跟进提醒（右下角固定，仅本人可见） ===== */
.reminder-box {
  position: fixed; right: 18px; bottom: 18px; z-index: 2600;
  display: flex; flex-direction: column; gap: 10px; max-width: 320px;
  pointer-events: none;  /* 容器不挡操作，卡片自身接收点击 */
}
.reminder-card {
  pointer-events: auto;
  background: var(--panel-solid, #fff);
  border: 1px solid rgba(108, 92, 231, 0.35);
  border-left: 4px solid var(--accent, #6c5ce7);
  border-radius: 12px; padding: 12px 14px;
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.12));
  animation: slideInRight 0.28s both;
}
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.reminder-title { font-weight: 700; font-size: 13px; color: var(--accent, #6c5ce7); margin-bottom: 4px; }
.reminder-body { font-size: 13px; color: var(--text); line-height: 1.5; word-break: break-word; }
.reminder-actions { margin-top: 10px; display: flex; gap: 8px; justify-content: flex-end; }
.reminder-actions .btn.small { padding: 5px 12px; font-size: 12px; }

/* ===== 连接状态横幅 ===== */
.connect-banner {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%);
  z-index: 3000; max-width: 92vw;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; padding: 13px 18px; border-radius: 14px;
  box-shadow: 0 12px 30px rgba(255, 94, 156, 0.4);
  font-size: 13px; line-height: 1.6; animation: slideDown 0.3s both;
}
.connect-banner code {
  background: rgba(255, 255, 255, 0.22); padding: 2px 7px;
  border-radius: 7px; font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* ===== Modal ===== */
.modal {
  position: fixed; inset: 0; background: rgba(10, 14, 22, 0.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
  animation: fadeIn 0.2s both;
}
.modal-box {
  width: 440px; max-width: 92vw; max-height: 90vh; overflow-y: auto;
  background: var(--panel-solid); border-radius: 22px; padding: 26px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  animation: popIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.modal-box h2 { margin: 0 0 6px; font-size: 17px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.row { display: flex; gap: 12px; }
.row label { flex: 1; }

/* 跟进弹窗：表单区固定，仅跟进历史滚动，底部按钮始终可见 */
#followModal .modal-box {
  display: flex;
  flex-direction: column;
  width: 640px;
  max-width: 95vw;
  max-height: 95vh;
  padding: 28px 28px 0;
  overflow: hidden;
}
#followModal .follow-form-area {
  flex-shrink: 0;
}
#followModal .follow-history-area {
  flex: 1 1 0;
  min-height: 80px;
  max-height: 36vh;
  overflow-y: auto;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
}
#followModal .follow-history-area .city-title {
  margin: 0 0 10px;
  font-size: 13px;
}
#followModal .follow-history {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#followModal .modal-actions {
  flex-shrink: 0;
  margin-top: 0;
  padding: 16px 0 26px;
  background: var(--panel-solid);
  position: relative;
  z-index: 1;
}

/* 跟进弹窗 */
textarea.input { resize: vertical; min-height: 64px; font-family: inherit; line-height: 1.6; }
.follow-hint {
  margin-top: 6px;
  min-height: 18px;
  font-size: 12px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.follow-hint.show { opacity: 1; }
.follow-hint.success { color: #1f9d55; }
.follow-hint.error { color: #e53e3e; }
.follow-history { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.follow-item { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; }
.follow-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.follow-time { font-size: 11px; color: var(--muted); }
.follow-note { font-size: 12.5px; line-height: 1.6; color: var(--text); white-space: pre-wrap; word-break: break-word; }

/* 成交凭证上传与展示 */
.voucher-box { margin-top: 8px; }
.voucher-box.hidden { display: none; }
.voucher-box input[type="file"] { padding: 8px 10px; font-size: 13px; cursor: pointer; }
.voucher-tip { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; }
.voucher-preview { margin-top: 8px; position: relative; display: inline-block; }
.voucher-preview img,
.voucher-thumb,
.follow-voucher img {
  max-width: 200px; max-height: 120px; border-radius: 10px;
  border: 1px solid var(--border); object-fit: cover; display: block;
}
.voucher-remove {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: #e05050; color: #fff;
  font-size: 16px; line-height: 22px; text-align: center; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.voucher-remove:hover { background: #c53030; }
.follow-voucher { margin-top: 8px; position: relative; display: inline-block; }
.follow-voucher a { display: block; }
.voucher-label {
  position: absolute; bottom: 6px; left: 6px;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 10px;
  padding: 2px 6px; border-radius: 6px;
}
.info-v .voucher-thumb { margin-top: 4px; }


/* ===== Spinner ===== */
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff;
  display: inline-block; vertical-align: -2px; margin-right: 7px;
  animation: spin 0.7s linear infinite;
}

/* ===== Scrollbar ===== */
.sidebar::-webkit-scrollbar, .detail::-webkit-scrollbar, .modal-box::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb, .detail::-webkit-scrollbar-thumb, .modal-box::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 8px;
}
.sidebar::-webkit-scrollbar-thumb:hover, .detail::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ===== Keyframes ===== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===== 响应式：窄屏上下堆叠 ===== */
@media (max-width: 880px) {
  .layout { flex-direction: column; height: auto; min-height: calc(100vh - 62px); overflow-y: auto; }
  .sidebar { flex: none; max-width: none; width: 100%; }
  .detail { flex: none; width: 100%; min-height: 420px; }
  body { overflow: auto; }
  .modal-box.wide { width: 92vw; }
  #followModal .modal-box {
    width: 100vw;
    max-width: 100vw;
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    padding: 22px 20px 0;
  }
  #followModal .follow-history-area {
    min-height: 60px;
    max-height: 32vh;
  }
  .sub-layout { flex-direction: column; gap: 16px; }
  .sub-list { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
}

/* ===== 登录 / 用户区 ===== */
#loginModal .modal-box { max-width: 360px; }
.login-err { color: #e05050; font-size: 13px; min-height: 18px; margin: 4px 0 0; }
.user-badge {
  font-size: 13px; color: var(--accent); background: var(--accent-soft);
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
.user-badge.hidden { display: none; }

/* ===== 子账号管理弹窗 ===== */
.modal-box.wide { width: 720px; }
.sub-layout { display: flex; gap: 20px; margin-top: 6px; }
.sub-form { flex: 1 1 52%; min-width: 0; }
.sub-list { flex: 1 1 48%; min-width: 0; border-left: 1px solid var(--border); padding-left: 20px; }
.sub-form h3, .sub-list h3 { font-size: 13px; margin: 4px 0 12px; font-weight: 700; }
#subFormTitle { font-size: 15px; margin: 0 0 12px !important; }

/* 权限复选框 */
.perm-list { display: flex; flex-direction: column; gap: 8px; }
.perm-item {
  display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
  padding: 10px 13px; border-radius: 12px; margin-top: 0; font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--panel-solid); border: 1px solid var(--border);
  transition: all 0.16s;
}
.perm-item:hover { border-color: var(--primary); }
.perm-item.on { border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.perm-item input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.perm-item.on input { accent-color: #fff; }
.perm-label { line-height: 1.2; }

/* 现有子账号卡片 */
.sub-items { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.sub-card {
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; transition: border-color 0.2s, box-shadow 0.2s;
}
.sub-card:hover { border-color: transparent; box-shadow: var(--shadow-sm); }
.sub-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sub-name { font-weight: 700; font-size: 14px; color: var(--text); }
.sub-phone { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.sub-perms { font-size: 11.5px; color: var(--accent); margin-top: 7px; line-height: 1.5;
  background: var(--accent-soft); border-radius: 9px; padding: 5px 10px; }
.sub-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.sub-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11.5px; }
.sub-login { color: var(--muted); }
.sub-badge { background: rgba(224,80,80,0.14); color: #e05050; border-radius: 6px;
  padding: 1px 7px; font-weight: 600; font-size: 11px; }
.sub-card.disabled { opacity: 0.6; }
.sub-card.disabled .sub-name { text-decoration: line-through; }
.mini-btn.warn { color: #d98a00; }
.mini-btn.warn:hover { border-color: #d98a00; color: #d98a00; }
.mini-btn.ok { color: #1f9d55; }
.mini-btn.ok:hover { border-color: #1f9d55; color: #1f9d55; }
.nationwide-box { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.nationwide-box .wide { width: 100%; }
.nationwide-box .sub-login { margin-top: 8px; min-height: 16px; }
