/* ============================================================
   Eureka CRM v2.0 — Design System
   ============================================================ */

/* ----- Design Tokens ----- */
:root {
  /* 卡布里蓝（RAL 5019 #1B579C）品牌色阶 */
  --brand-50: #eef4fc;  --brand-100: #d4e4f7;  --brand-200: #b1cff1;
  --brand-300: #7dafe8; --brand-400: #3b87dd;  --brand-500: #226dc4;
  --brand-600: #1b579c; --brand-700: #15447a;  --brand-800: #0f3057;

  --gray-50: #f8fafc;  --gray-100: #f1f5f9;  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;  --gray-400: #94a3b8;  --gray-500: #64748b;
  --gray-600: #475569;  --gray-700: #334155;  --gray-800: #1e293b;

  --red-50: #fef2f2;   --red-500: #ef4444;   --red-600: #dc2626;
  --green-50: #f0fdf4; --green-600: #16a34a; --green-700: #15803d;
  --amber-50: #fffbeb; --amber-500: #f59e0b; --amber-600: #d97706;
  --purple-50: #faf5ff; --purple-600: #9333ea;
  --emerald-50: #ecfdf5; --emerald-600: #059669;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --shadow-card: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-modal: 0 20px 60px rgba(0,0,0,.12);
  --shadow-btn: 0 1px 2px rgba(0,0,0,.06);
  --shadow-btn-hover: 0 4px 12px rgba(37,99,235,.2);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Space Grotesk', 'Inter', sans-serif;
}

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1,h2,h3,h4,h5,h6 { font-family: var(--font-heading); letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
[x-cloak][x-cloak] { display: none; } /* 双属性提升特异性(0,2,0)：压过 .modal-backdrop/.detail-overlay/.confirm-overlay 的 display:flex；不加 !important，避免 x-show 内联样式失效（弹窗永不显示） */

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* ----- Layout ----- */
.layout { display: flex; min-height: 100vh; }

/* ----- Narrow Sidebar ----- */
.sidebar-narrow {
  width: 56px; flex-shrink: 0;
  background: var(--gray-800); display: flex; flex-direction: column;
  align-items: center; overflow-y: auto;
}
.sidebar-logo-narrow {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: #fff; margin: 12px 0 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Nav Item (vertical icon+label) */
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: var(--radius); cursor: pointer;
  transition: all .12s; text-decoration: none; color: var(--gray-400);
  width: 48px; margin-bottom: 2px; position: relative; border: none; background: none;
  font-family: inherit;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: var(--brand-600); }
.nav-item-icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item-label { font-size: 9px; text-align: center; line-height: 1.1; white-space: nowrap; }
.nav-item.active .nav-item-label { font-weight: 600; }
.nav-badge {
  position: absolute; top: 2px; right: 4px;
  background: var(--red-500); color: #fff; font-size: 9px;
  min-width: 14px; height: 14px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.logout-btn { margin-top: auto; }
.sidebar-version {
  margin-top: 4px; padding: 2px 0 2px;
  font-size: 10px; line-height: 1; color: var(--gray-600);
  letter-spacing: .02em; user-select: none;
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 4px 0; }
.sidebar-footer-narrow { display: flex; flex-direction: column; align-items: center; padding-bottom: 8px; }

/* Main content area */
.main-content { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.main-body { padding: 24px; flex: 1; }

/* 页面切换平滑过渡（避免导航切换闪烁） */
html { scrollbar-gutter: stable; }
.main-content { animation: page-fade-in .28s ease; }
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .main-content { animation: none; }
}

/* Customer list page layout */
.customer-page { display: flex; min-height: 0; height: 100vh; }
/* 手机客群抽屉触发按钮：桌面默认隐藏（`.btn` 后定义会覆盖，这里提高特异性），手机（767px 内）显示 */
.btn.m-filter-trigger { display: none; pointer-events: none; }
.filter-panel {
  width: 140px; flex-shrink: 0; padding: 16px 12px;
  border-right: 1px solid var(--border-light); overflow-y: auto;
  background: var(--bg-card);
}
.filter-panel-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
.filter-section { margin-bottom: 20px; }
.filter-section-title {
  font-size: 11px; font-weight: 600; color: var(--text-subtle);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
  display: flex; align-items: center; cursor: pointer; user-select: none;
}
.filter-section-title:hover { color: var(--text-muted); }
.filter-item {
  display: block; padding: 5px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted); text-decoration: none;
  transition: all .1s; margin-bottom: 1px; cursor: pointer;
  background: none; border: none; width: 100%; text-align: left;
}
.filter-item:hover { background: var(--gray-50); color: var(--text); }
.filter-item.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.filter-clear {
  display: block; padding: 6px 10px; font-size: 12px; color: var(--red-500);
  text-decoration: none; border-top: 1px solid var(--border-light); margin-top: 8px; padding-top: 10px;
}
.filter-clear:hover { color: var(--red-600); }

.filter-arrow { width: 12px; height: 12px; transition: transform .15s; margin-left: auto; }
.filter-arrow.rotated { transform: rotate(180deg); }
.filter-items { margin-top: 2px; }

/* Icon button */
/* 设置中心：左侧菜单 + 右侧内容区 */
.settings-layout { display: grid; grid-template-columns: 208px 1fr; gap: 18px; align-items: start; }
.settings-menu {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px;
}
.settings-menu-title { font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 6px 10px 10px; letter-spacing: .05em; }
.settings-menu-item {
    display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px;
    font-size: 13px; color: var(--gray-600); text-decoration: none; transition: background .15s, color .15s;
}
.settings-menu-item:hover { background: var(--gray-50); color: var(--gray-800); }
.settings-menu-item.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.settings-content { min-width: 0; padding-top: 12px; }
/* 字段级查重错误 */
.input-error {
    border-color: var(--red-500) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .10);
}
.field-error-msg {
    color: var(--red-500); font-size: 11px; margin-top: 3px;
    display: flex; align-items: center; gap: 4px;
}
/* 自定义选项分组卡片 */
.opt-group-card:hover { border-color: var(--brand-400); }
.opt-group-card.active { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); box-shadow: 0 0 0 1px var(--brand-500); }
@media (max-width: 860px) { .settings-layout { grid-template-columns: 1fr; } .settings-menu { position: static; } }

/* 建档重复项管理：重复列表卡片尽量通到底部（只限制卡片自身高度，不动页面/侧边栏布局） */
/* ⚠️ 必须用 .table-wrap.dup-list-wrap 双类选择器：下方 .table-wrap{overflow:hidden} 与本规则同为单类优先级，
   且声明在文件更靠后 → 单类写法会被覆盖成 overflow:hidden（内容被裁掉、无法滚动浏览，2026-09-09 实测） */
.table-wrap.dup-list-wrap { max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px); overflow: auto; }
/* 列表内部滚动时表头固定，长列表更好读 */
.dup-list-wrap thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-card); }
@media (max-width: 860px) {
    /* 同样用双类，否则被上面的高优先级 max-height 压掉 */
    .table-wrap.dup-list-wrap { max-height: calc(100vh - 320px); max-height: calc(100dvh - 320px); }
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--radius-sm); border: none;
  background: transparent; color: var(--text-muted); cursor: pointer; transition: all .12s;
}
.icon-btn:hover { background: var(--gray-50); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }

/* Sort link */
.sort-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; }
.sort-link:hover { color: var(--brand-600); }
.sort-link.active { color: var(--brand-600); }
.sort-link span { font-size: 10px; }

/* Detail Panel (右侧滑出) */
.detail-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,.2);
  display: flex; justify-content: flex-end;
}
/* 面板正文：唯一的滚动容器（flex:1 + min-height:0 是定高弹窗的标准写法） */
.detail-panel-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 18px 24px;
}
/* 面板内的滚动条加粗一点，避免「以为下面没内容」 */
.detail-panel-body::-webkit-scrollbar { width: 10px; }
.detail-panel-body::-webkit-scrollbar-thumb {
  background: var(--gray-300, #cbd5e1); border-radius: 5px;
  border: 2px solid #fff; background-clip: padding-box;
}
.detail-panel-body::-webkit-scrollbar-thumb:hover { background: var(--gray-400, #94a3b8); background-clip: padding-box; }
.detail-panel {
  width: 66.66%; max-width: 900px; background: #fff; height: 100%;
  /* margin-left:auto：即使某一帧容器不是 flex，也把面板顶到右侧 */
  margin-left: auto;
  box-shadow: -8px 0 30px rgba(0,0,0,.1);
  /* 定高面板必须用 flex 分配高度（AGENTS.md 已有规则）：
     顶栏固定、正文自己滚 —— 这样滚动条一定出现在正文上，内容再多也能滚到底 */
  display: flex; flex-direction: column; overflow: hidden;
  animation: slideIn .22s cubic-bezier(.22,.61,.36,1);
}
@keyframes slideIn { from { transform: translateX(28px); opacity: .55; } to { transform: translateX(0); opacity: 1; } }
.detail-panel-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid #e8ecf0;
  background: #fff; z-index: 10;
  flex-shrink: 0;              /* 面板已改成 flex 列：顶栏固定不参与压缩，正文独占滚动 */
}
.detail-panel-code { font-family: monospace; color: var(--text-muted); white-space: nowrap; }
/* 新建模式顶栏提示：桌面显示，手机端顶栏窄（要放「保存」）故隐藏 */
.detail-panel-hint { white-space: nowrap; }
/* 详情/新建面板里的卡片四周留白收窄（用户：卡片四周边距太大）——只作用于该面板，不动全站 .card-padded */
.detail-panel .card-padded { padding: 14px 16px; }
/* 查重提示里可点击的「客户编号」→ 清空草稿 + 列表定位 + 打开详情 */
.dup-code-link { color: var(--brand-600); font-weight: 600; text-decoration: underline; cursor: pointer; }
.dup-code-link:hover { color: var(--brand-700); }
.detail-panel-name { font-weight: 700; font-size: 20px; font-family: var(--font-heading); display: flex; align-items: center; gap: 6px; margin-bottom: 16px; }
.detail-panel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; font-size: 14px; }
@media (max-width: 767px) {
  .detail-panel { width: 100%; max-width: none; }
  .detail-panel-grid { grid-template-columns: repeat(2, 1fr); }
}
/* P1-3：详情面板信息区在手机上改 1 列（字段值长的不挤） */
@media (max-width: 480px) {
  .detail-panel-grid { grid-template-columns: 1fr; }
}

/* Inline edit */
.edit-btn { font-size: 11px; color: var(--text-subtle); background: none; border: none; cursor: pointer; padding: 2px 4px; border-radius: 3px; flex-shrink: 0; }
.edit-btn:hover { color: var(--brand-600); background: var(--brand-50); }
.field-row { display: flex; align-items: center; gap: 4px; }
.edit-form { display: flex; align-items: center; gap: 6px; }
.editing-row { background: var(--brand-50); padding: 4px 6px; border-radius: var(--radius-sm); margin: -4px -6px; }
.contact-panel-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.contact-panel-item:last-child { border-bottom: none; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contact-card { border: 1px solid #e8ecf0; border-radius: 12px; padding: 10px 12px; background: #fff; }
.contact-card:hover { border-color: #d4d8e0; }
.contact-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* 联系人头像（user.svg 图标 + 浅灰圆底） */
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--gray-100); color: var(--gray-500);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.contact-card-links { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; }
.contact-link-row { display: flex; align-items: center; gap: 4px; padding: 1px 0; min-width: 0; }
/* 社媒图标行：用 class 而非内联样式，避免 x-show 覆盖 display:flex 导致 gap 失效 */
.contact-social-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.social-icon { width: 18px; height: 18px; flex-shrink: 0; }
.social-value { overflow: hidden; text-overflow: ellipsis; white-space: normal; word-break: break-all; font-size: 12px; flex: 1; min-width: 0; }
.timeline-svg-icon { position: absolute; left: -22px; top: 3px; width: 16px; height: 16px; color: var(--brand-400); }
.copy-mini { font-size: 10px; background: none; border: none; cursor: pointer; padding: 1px 3px; color: var(--text-subtle); flex-shrink: 0; display: flex; align-items: center; }
.copy-mini:hover { color: var(--brand-600); }
@media (max-width: 767px) { .contact-grid { grid-template-columns: 1fr; } }
.input-sm { font-size: 13px; padding: 4px 8px; }

.customer-content { flex: 1; min-width: 0; min-height: 0; padding: 16px 20px; display: flex; flex-direction: column; overflow: hidden; }

/* Toolbar */
.customer-toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-create-customer {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; background: var(--brand-600); color: #fff;
  border-radius: var(--radius); font-size: 14px; font-weight: 600;
  text-decoration: none; transition: all .15s; flex-shrink: 0;
}
.btn-create-customer:hover { background: var(--brand-700); transform: translateY(-1px); box-shadow: var(--shadow-btn-hover); }

.search-box {
  flex: 1; max-width: 520px; min-width: 200px; position: relative; display: flex; align-items: center;
}
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-subtle); pointer-events: none; z-index: 1; }
.search-box .search-input {
  width: 100%; padding: 9px 12px 9px 38px; border: 1px solid var(--border);
  border-radius: var(--radius-full); font-size: 13px; background: #fff; color: var(--text);
  outline: none; transition: all .15s;
}
.search-box .search-input:focus { border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(27,87,156,.08); }

.toolbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Header */
.header {
  height: 64px; background: rgba(255,255,255,.8); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light); padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.header-title { font-size: 20px; font-weight: 700; font-family: var(--font-heading); color: var(--gray-800); }
.header-actions { display: flex; align-items: center; gap: 12px; }

/* ----- Card ----- */
.card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-card); overflow: hidden;
}
/* 详情面板内的卡片允许下拉框（标签/产品/状态等）溢出显示，避免被裁剪 */
.detail-panel .card { overflow: visible; }
.card-hover:hover { border-color: var(--gray-200); box-shadow: var(--shadow-card-hover); }
.card-padded { padding: 24px; }

/* ----- Button ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 500; border-radius: var(--radius); transition: all .15s;
  white-space: nowrap; outline: none; position: relative;
}
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn:active { transform: scale(.98); }

.btn-sm  { font-size: 13px; padding: 6px 12px; border-radius: var(--radius-sm); }
.btn-md  { font-size: 14px; padding: 8px 16px; }
.btn-lg  { font-size: 14px; padding: 10px 20px; }

.btn-primary {
  background: var(--brand-600); color: #fff; border: none;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--brand-700); box-shadow: var(--shadow-btn-hover); transform: translateY(-1px); }

.btn-secondary { background: var(--bg-card); color: var(--gray-600); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-ghost { color: var(--text-muted); background: transparent; border: none; }
.btn-ghost:hover { color: var(--brand-600); background: var(--brand-50); }

.btn-outline { background: transparent; color: var(--gray-600); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--gray-300); background: var(--gray-50); }

.btn-danger { background: transparent; color: var(--red-500); border: none; }
.btn-danger:hover { background: var(--red-50); }
.btn-danger-solid { background: var(--red-500); color: #fff; border: none; }
.btn-danger-solid:hover { background: var(--red-600); }

/* ----- Form ----- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-600); margin-bottom: 6px; }
.form-label .required { color: var(--red-500); margin-left: 2px; }
.form-error { font-size: 12px; color: var(--red-500); margin-top: 4px; }

.input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; background: #fff; color: var(--text);
  outline: none; transition: all .15s;
}
.input:focus { border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(27,87,156,.08); }
.input::placeholder { color: var(--text-subtle); }
.input.error { border-color: var(--red-500); }
.input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.1); }

textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ----- Custom Select (Dropdown) ----- */
.dropdown { position: relative; display: inline-block; }
.dropdown-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; background: #fff; color: var(--text);
  cursor: pointer; transition: all .15s; text-align: left;
}
.dropdown-trigger:hover { border-color: var(--gray-300); }
.dropdown-trigger:focus, .dropdown.open .dropdown-trigger { border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(27,87,156,.08); }
.dropdown-trigger .arrow { transition: transform .15s; color: var(--text-subtle); }
.dropdown.open .arrow { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  min-width: 100%; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-modal); padding: 4px;
  max-height: 240px; overflow-y: auto;
}
.dropdown-menu .dropdown-item {
  display: block; width: 100%; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); text-align: left; cursor: pointer; transition: background .1s;
  background: none; border: none;
}
.dropdown-menu .dropdown-item:hover { background: var(--gray-50); }
.dropdown-menu .dropdown-item.selected { background: var(--brand-50); color: var(--brand-700); font-weight: 500; }
.dropdown-menu .dropdown-item.active { background: var(--gray-50); }
.dropdown-menu .dropdown-item .check { float: right; color: var(--brand-600); }

/* ----- 主题化下拉选择器（x-ui.pick 组件：触发器 + 弹出菜单全覆盖，无原生弹层） ----- */
.dropdown-pick { width: 100%; }
.dropdown-pick .dropdown-trigger { width: 100%; }
.dropdown-pick .dropdown-menu { min-width: 100%; }

/* ----- Checkbox / Radio ----- */
.checkbox, .radio {
  appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--gray-300);
  background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .12s;
}
.checkbox { border-radius: 5px; }
.checkbox:checked { background: var(--brand-600); border-color: var(--brand-600); }
.checkbox:checked::after { content: '✓'; color: #fff; font-size: 12px; font-weight: 700; }
.checkbox:focus, .radio:focus { outline: 2px solid var(--brand-100); outline-offset: 1px; }
.radio { border-radius: 50%; }
.radio:checked { border-color: var(--brand-600); border-width: 5px; }

/* ----- Badge ----- */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-blue   { background: var(--brand-50);  color: var(--brand-700); }
.badge-green  { background: var(--green-50);  color: var(--green-700); }
.badge-amber  { background: var(--amber-50);  color: var(--amber-600); }
.badge-red    { background: var(--red-50);    color: var(--red-600); }
.badge-gray   { background: var(--gray-50);   color: var(--text-muted); border: 1px solid var(--border-light); }
.badge-slate  { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.badge-purple { background: var(--purple-50); color: var(--purple-600); }
.badge-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--text-muted); }

/* ----- Chip / Filter Tag ----- */
.chip {
  display: inline-flex; padding: 6px 14px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all .12s;
  background: var(--gray-100); color: var(--text-muted); border: none;
}
.chip:hover { background: var(--gray-200); color: var(--gray-600); }
.chip.active { background: var(--brand-600); color: #fff; }

/* ----- Tab ----- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 10px 20px; font-size: 14px; font-weight: 500; color: var(--text-muted);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; transition: all .12s;
  background: none; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--gray-600); }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand-600); }
.tabs-pill { display: flex; gap: 4px; background: var(--gray-100); padding: 4px; border-radius: var(--radius-lg); }
.tab-pill {
  padding: 8px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .12s; background: transparent; color: var(--text-muted); border: none;
}
.tab-pill.active { background: #fff; color: var(--text); box-shadow: var(--shadow-card); }
.tab-pill:hover:not(.active) { color: var(--gray-600); }

/* ----- Modal ----- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 300; background: rgba(15,23,42,.3);
  backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-light); width: 100%; max-height: 90vh; overflow-y: auto;
}
.modal-sm { max-width: 400px; }
.modal-md { max-width: 520px; }
.modal-lg { max-width: 720px; }
.modal-header { padding: 20px 24px 0; }
.modal-title { font-size: 18px; font-weight: 700; font-family: var(--font-heading); }
.modal-body { padding: 16px 24px; font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.modal-footer { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* ----- 高级筛选 ----- */
.adv-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  padding: 8px; border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  background: var(--gray-50); flex-wrap: wrap;
}
.adv-row .input { height: 34px; font-size: 13px; }

/* ----- Table ----- */
.table-wrap { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-xl); overflow: hidden; }
/* 客户列表内置滚动框：内容超出容器高度时出现滚动条（分页条固定在底部） */
.customer-content > .table-wrap { flex: 1; min-height: 0; overflow-y: auto; }
/* 线索视图（并入客户页）：自身占满剩余空间，内部表格滚动 */
.lead-content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.lead-content .table-wrap { flex: 1; min-height: 0; overflow-y: auto; }
.table { width: 100%; font-size: 14px; border-collapse: collapse; }
.table-customers { border-collapse: separate; border-spacing: 0; } /* sticky 表头需要 separate（collapse 下 Chrome 不生效） */
.table thead { background: var(--gray-50); }
.table-customers thead { position: sticky; top: 0; z-index: 5; }
.table thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--gray-50); /* sticky 时自身需有背景，避免内容透过 */
  padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ----- Alert ----- */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: var(--green-50);  color: var(--green-700);  border: 1px solid #bbf7d0; }
.alert-info    { background: var(--brand-50);  color: var(--brand-700); border: 1px solid var(--brand-200); }
.alert-warning { background: var(--amber-50);  color: var(--amber-600); border: 1px solid #fde68a; }
.alert-error   { background: var(--red-50);    color: var(--red-600);   border: 1px solid #fecaca; }

/* ----- Toast ----- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  background: var(--gray-800); color: #fff; padding: 12px 20px;
  border-radius: var(--radius); font-size: 14px; box-shadow: var(--shadow-modal);
}

/* ----- Search ----- */
.search-wrap { position: relative; }
.search-wrap .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-subtle); pointer-events: none;
}
.search-input { padding-left: 38px !important; }

/* ----- Pagination ----- */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 14px; }
.pagination-info { color: var(--text-muted); }
.pagination-btns { display: flex; gap: 4px; }
.page-btn {
  padding: 6px 12px; border-radius: var(--radius-sm); font-size: 13px;
  border: 1px solid var(--border); background: #fff; color: var(--text-muted);
  cursor: pointer; transition: all .12s;
}
.page-btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
.page-btn.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

/* ----- Empty State ----- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-subtle); }
.empty-state-icon { font-size: 40px; margin-bottom: 8px; opacity: .5; }

/* ----- 线索客户占位视图（后续开发） ----- */
.lead-view { flex: 1; min-height: 0; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.lead-view-card {
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card); padding: 40px 48px; text-align: center; max-width: 540px;
}
.lead-view-icon {
  width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--purple-50); color: var(--purple-600);
  display: flex; align-items: center; justify-content: center;
}
.lead-view-title { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; }
.lead-view-desc { margin: 10px auto 18px; font-size: 13px; color: var(--text-subtle); line-height: 1.7; max-width: 430px; }
.lead-view-plan { text-align: left; border-top: 1px solid var(--border-light); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.lead-view-plan-item { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.lead-view-plan-item svg { color: var(--purple-600); margin-top: 2px; }

/* ----- Stat Card ----- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
/* P2-8：手机端 stat 卡片 2 列紧凑 + 双列大区 1 列 */
@media (max-width: 767px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-grid .stat-card { min-height: 88px; }
  .dashboard-duo { grid-template-columns: 1fr !important; }
}
.stat-card {
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-xl);
  padding: 20px; box-shadow: var(--shadow-card); display: flex; align-items: center; gap: 16px;
  transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: var(--shadow-card-hover); }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-lg); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon-blue   { background: var(--brand-50);  color: var(--brand-600); }
.stat-icon-green  { background: var(--green-50);  color: var(--green-600); }
.stat-icon-amber  { background: var(--amber-50);  color: var(--amber-600); }
.stat-icon-red    { background: var(--red-50);    color: var(--red-500); }
.stat-icon-purple { background: var(--purple-50); color: var(--purple-600); }
.stat-icon-emerald { background: var(--emerald-50); color: var(--emerald-600); }
.stat-value { font-size: 28px; font-weight: 700; font-family: var(--font-heading); color: var(--gray-800); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.stat-seg { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.stat-seg button {
  font-size: 11px; line-height: 1; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.stat-seg button:hover { border-color: var(--brand-300); color: var(--brand-600); }
.stat-seg button.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* ----- Timeline (follow-up) ----- */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: ''; position: absolute; left: -20px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand-400);
  border: 2px solid #fff; box-shadow: 0 0 0 2px var(--brand-200);
}
.timeline-item:last-child { padding-bottom: 0; }

/* ----- Utility ----- */
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ----- Toolbar (客户列表) ----- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.link-subtle { font-size: 13px; color: var(--text-subtle); text-decoration: underline; text-underline-offset: 3px; }
.link-subtle:hover { color: var(--brand-600); }

/* ----- Search Box (工具栏内) ----- */
.search-box { position: relative; }
.search-box .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-subtle); pointer-events: none;
}
.search-box form { flex: 1; display: flex; }
.search-box .search-input {
  width: 100%; padding: 8px 12px 8px 38px; border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius); font-size: 13px; background: #fff; color: var(--text);
  outline: none; transition: all .15s; border-right: none;
}
.search-box .search-input:focus { border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(27,87,156,.08); }
.search-box .search-input::placeholder { color: var(--text-subtle); }
.search-btn { padding: 8px 16px; border-radius: 0 var(--radius) var(--radius) 0; flex-shrink: 0; border: 1px solid var(--brand-600); height: 39px; }

/* ----- Filter Bar ----- */
.filter-bar { margin-bottom: 12px; }
.filter-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.filter-label { font-size: 13px; color: var(--text-muted); white-space: nowrap; padding-top: 6px; min-width: 40px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Active Filters Hint */
.active-filters {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--brand-50); border-radius: var(--radius);
  margin-bottom: 12px; font-size: 13px;
}
.filter-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; background: #fff; border: 1px solid var(--brand-200);
  border-radius: var(--radius-full); font-size: 12px; color: var(--brand-700);
}
.filter-tag-close { font-size: 11px; color: var(--text-subtle); margin-left: 2px; }
.filter-tag-close:hover { color: var(--red-500); }
.chip-more { background: transparent; border: 1px dashed var(--gray-300); color: var(--text-subtle); font-size: 12px; }

/* ----- View Bar ----- */
.view-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.view-toggle { display: flex; background: var(--gray-100); border-radius: var(--radius); padding: 3px; }
.view-btn {
  padding: 6px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .12s; background: transparent; color: var(--text-muted); border: none;
}
.view-btn.active { background: #fff; color: var(--text); box-shadow: var(--shadow-card); }
.view-btn:hover:not(.active) { color: var(--gray-600); }

/* ----- Batch Action Bar ----- */
.batch-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--brand-50); border-radius: var(--radius);
  margin-bottom: 12px; animation: slideDown .2s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ----- Sort Form ----- */
.sort-form { display: flex; align-items: center; gap: 6px; }
.sort-form .input { font-size: 13px; padding: 4px 8px; width: auto; }

/* ----- Customers Table Specific ----- */
.table-customers thead th { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.table-customers tbody tr { cursor: pointer; }
.table-customers tbody tr:hover { background: var(--gray-50); }

.cell-code { font-family: monospace; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.cell-name { font-weight: 600; font-size: 14px; color: var(--text); max-width: 160px; }
.cell-name:hover { color: var(--brand-600); }
.cell-name-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.4; word-break: break-all; }
.cell-contact { font-size: 13px; min-width: 130px; }
.contact-preview { display: flex; flex-direction: column; gap: 1px; }
.contact-name { font-size: 13px; color: var(--text); }
.contact-email { font-size: 12px; color: var(--text-subtle); word-break: break-all; }
.cell-country { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.cell-followup { font-size: 12px; white-space: nowrap; }
.cell-owner { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.cell-actions { text-align: right; white-space: nowrap; padding: 8px 4px !important; }
/* 行内三点菜单 */
.row-menu { position: relative; display: inline-flex; }
.row-menu-dropdown {
    position: absolute; right: 0; top: 100%; z-index: 30; min-width: 140px;
    max-height: 60vh; overflow-y: auto;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15,23,42,.12); padding: 4px; margin-top: 4px;
}
.row-menu-dropdown button {
    display: flex; align-items: center; gap: 7px; width: 100%; padding: 7px 10px;
    border: none; background: none; font-size: 13px; color: var(--gray-700);
    border-radius: 6px; cursor: pointer; text-align: left;
}
.row-menu-dropdown button:hover { background: var(--gray-50); }
.row-menu-dropdown button .f-icon { flex-shrink: 0; }

/* Follow-up Status Colors */
.followup-good { color: var(--green-600); font-weight: 500; }
.followup-warn { color: var(--amber-600); font-weight: 500; }
.followup-bad { color: var(--red-500); font-weight: 500; }
.followup-none { color: var(--text-subtle); }

/* Status Badge Select (行内下拉) */
.badge-select {
  font-size: 12px; padding: 2px 8px; border-radius: var(--radius-full);
  border: 1px solid; cursor: pointer; outline: none; font-weight: 500;
}
.badge-select.bg-prospect { background-color: var(--gray-50); color: var(--gray-700); border-color: var(--gray-200); }
.badge-select.bg-contacted { background-color: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.badge-select.bg-following { background-color: var(--amber-50); color: var(--amber-700); border-color: var(--amber-200); }
.badge-select.bg-won { background-color: var(--green-50); color: var(--green-700); border-color: var(--green-200); }
.badge-select.bg-lost { background-color: var(--red-50); color: var(--red-700); border-color: var(--red-200); }
.badge-select:focus { box-shadow: 0 0 0 2px rgba(27,87,156,.2); }

/* ----- Card Grid (卡片视图) ----- */
.card-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 1023px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .card-grid { grid-template-columns: 1fr; }
}

.customer-card {
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-xl);
  padding: 16px 18px; box-shadow: var(--shadow-card); transition: all .15s;
  display: flex; flex-direction: column; gap: 10px; cursor: pointer; text-decoration: none; color: inherit;
}
.customer-card:hover { border-color: var(--gray-200); box-shadow: var(--shadow-card-hover); transform: translateY(-1px); }

.card-top { display: flex; flex-direction: column; gap: 2px; }
.card-company { font-weight: 600; font-size: 15px; color: var(--text); }
.card-code { font-family: monospace; font-size: 11px; color: var(--text-subtle); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.card-country { font-size: 13px; color: var(--text-muted); }
.card-contact-row { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.card-contact { color: var(--text); }
.card-email { color: var(--text-subtle); font-size: 12px; word-break: break-all; }
.card-footer { display: flex; align-items: center; padding-top: 8px; border-top: 1px solid var(--border-light); font-size: 12px; }

/* ----- Pagination Wrap ----- */
.pagination-wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; font-size: 14px;
}
.pagination-wrap .pagination-info { color: var(--text-muted); }
.pagination-wrap .pagination-btns { display: flex; gap: 4px; }

/* ----- Toast Error ----- */
.toast-error { background: var(--red-600); }

/* ----- 分页条（邮件/客户列表通用） ----- */
.pager-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 4px; border-top: 1px solid var(--border); flex-shrink: 0; margin-top: 10px;
}
.pg-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 26px; height: 26px; padding: 0 8px; font-size: 13px;
    border: 1px solid var(--border); border-radius: 6px; color: var(--gray-600);
    background: var(--bg-card); cursor: pointer; text-decoration: none; transition: all .12s;
}
.pg-btn:hover { border-color: var(--brand-400); color: var(--brand-600); }
.pg-btn:disabled { opacity: .4; pointer-events: none; }
.pg-select-wrap { position: relative; }
.pg-select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card);
    color: var(--gray-700); font-size: 12px; padding: 3px 22px 3px 8px; cursor: pointer;
}
.pg-select-wrap::after {
    content: ''; position: absolute; right: 8px; top: 50%; transform: translateY(-60%);
    border: 4px solid transparent; border-top-color: var(--gray-500); pointer-events: none;
}

/* ============================================================
   自定义下拉菜单 & 日期选择器（覆盖浏览器原生样式，跟随主题）
   适用：所有页面的 <select>、input[type=date]、input[type=datetime-local]
   已自定义的 .pg-select（翻页）/.badge-select（状态徽标）不受影响
   ============================================================ */
select { appearance: none; -webkit-appearance: none; -moz-appearance: none; }

select:not(.pg-select):not(.badge-select) {
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: #fff;
  color: var(--text);
  font-size: 13px;
  padding: 6px 30px 6px 10px !important;
  cursor: pointer;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}
select:not(.pg-select):not(.badge-select):hover { border-color: var(--brand-300); }
select:not(.pg-select):not(.badge-select):focus {
  border-color: var(--brand-300);
  box-shadow: 0 0 0 3px rgba(27,87,156,.08);
}

input[type="date"],
input[type="datetime-local"] {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  position: relative;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='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: right 8px center;
  background-size: 15px;
  padding-right: 30px !important;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  position: absolute; right: 0; top: 0;
  width: 30px; height: 100%;
  opacity: 0; cursor: pointer;
}

/* ============================================================
   日期选择器（Ant Design DatePicker 风格，public/js/date-picker.js 增强）
   - .dpick 用 display:contents：不产生盒子，可见文本框直接落在原输入框的位置
     （flex/grid 布局与原生 <input type="date"> 完全一致）
   - .dp-src 是隐形数据源：name / x-model / 表单提交照旧
   - .dp-panel 单例面板，portal 到 body + position:fixed（逃逸弹窗 overflow 裁切）
   ============================================================ */
.dpick { display: contents; }
.dpick > input.dp-src {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important;
  opacity: 0 !important; pointer-events: none !important; overflow: hidden;
}
input.dp-text {
  /* 与原生 input[type=date] 的日历图标位置/内边距保持一致（图标由 JS 设为内联 background-image） */
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 15px;
  padding-right: 30px !important;
  cursor: text;
}
input.dp-text::placeholder { color: var(--text-subtle); }

.dp-panel {
  position: fixed; z-index: 500;
  width: 272px; max-width: 94vw;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  padding: 8px 10px 6px;
  font-size: 13px; color: var(--text);
  -webkit-user-select: none; user-select: none;
}
.dp-head { display: flex; align-items: center; gap: 2px; padding: 2px 0 6px; }
.dp-nav {
  width: 26px; height: 26px; flex-shrink: 0;
  border: none; background: none; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--gray-500); font-size: 13px; line-height: 1;
}
.dp-nav:hover { background: var(--gray-100); color: var(--brand-600); }
.dp-title {
  flex: 1; height: 26px; min-width: 0;
  border: none; background: none; border-radius: var(--radius-sm);
  cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text); white-space: nowrap;
}
.dp-title:hover { background: var(--gray-100); color: var(--brand-600); }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-grid-3 { grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dp-week span { text-align: center; font-size: 11px; color: var(--text-subtle); padding: 2px 0 4px; }
.dp-cell {
  height: 30px; border: none; background: none; border-radius: var(--radius-sm);
  cursor: pointer; font-family: inherit; font-size: 12.5px; color: var(--text);
  font-variant-numeric: tabular-nums; transition: background .12s, color .12s;
}
.dp-grid-3 .dp-cell { height: 38px; }
.dp-cell:hover { background: var(--brand-50); color: var(--brand-700); }
.dp-cell.out { color: var(--gray-300); }
.dp-cell.today { color: var(--brand-600); font-weight: 700; box-shadow: inset 0 0 0 1px var(--brand-300); }
.dp-cell.sel, .dp-cell.sel:hover { background: var(--brand-600); color: #fff; font-weight: 700; box-shadow: none; }
.dp-cell:disabled { color: var(--gray-200); cursor: not-allowed; background: none; }
.dp-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-light);
}
.dp-link {
  border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 12.5px; color: var(--brand-600); padding: 3px 6px; border-radius: var(--radius-sm);
}
.dp-link:hover { background: var(--brand-50); }
.dp-link-muted { color: var(--text-muted); }
.dp-link-muted:hover { background: var(--gray-100); }

/* ----- Detail Page ----- */
.detail-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.detail-topbar-left { display: flex; align-items: center; gap: 12px; }
.detail-topbar-right { display: flex; align-items: center; gap: 8px; }
.detail-code { font-family: monospace; font-size: 13px; color: var(--text-muted); }

.detail-info-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; font-size: 14px;
}
@media (max-width: 767px) {
  .detail-info-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .detail-info-grid { grid-template-columns: 1fr; }
}

.field-label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; font-weight: 500; }
.detail-company-name { font-weight: 700; font-size: 20px; font-family: var(--font-heading); color: var(--text); display: flex; align-items: center; gap: 6px; }

/* Quick Actions */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.quick-action-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 12px; background: var(--gray-50); border-radius: var(--radius-lg);
  border: 1px solid transparent; cursor: pointer; transition: all .15s;
  text-decoration: none; color: inherit; font-size: 13px;
}
.quick-action-card:hover { border-color: var(--brand-200); background: var(--brand-50); }
.quick-action-icon { font-size: 22px; }
.quick-action-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* Detail Timeline */
.detail-timeline { position: relative; padding-left: 28px; }
.detail-timeline::before {
  content: ''; position: absolute; left: 10px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}
.detail-timeline-item {
  position: relative; padding-bottom: 16px; display: flex; gap: 12px; align-items: flex-start;
}
.detail-timeline-item:last-child { padding-bottom: 0; }
.detail-timeline-icon {
  position: absolute; left: -22px; top: 2px;
  font-size: 14px; width: 24px; text-align: center;
}
.detail-timeline-body { flex: 1; min-width: 0; }
.detail-timeline-content { font-size: 14px; }
.detail-timeline-meta { font-size: 12px; color: var(--text-subtle); margin-top: 2px; }
.timeline-actions { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; opacity: 0; transition: opacity .12s; }
.detail-timeline-item:hover .timeline-actions { opacity: 1; }
.timeline-actions .edit-btn { padding: 2px 4px; }

/* Contact List Item */
.contact-list-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border-light);
}
.contact-list-item:last-child { border-bottom: none; }
.contact-list-body { flex: 1; min-width: 0; }
.contact-list-name { font-weight: 500; font-size: 14px; }
.contact-list-info { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; font-size: 13px; }
.contact-list-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Detail Link Row (quotes, emails, files, tasks) */
.detail-link-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 0;
  border-bottom: 1px solid var(--border-light); text-decoration: none; color: inherit;
  transition: background .1s;
}
.detail-link-row:last-child { border-bottom: none; }
.detail-link-row:hover { background: var(--gray-50); border-radius: var(--radius-sm); }

/* ============================================================
   Mobile
   ============================================================ */
/* 手机顶栏/抽屉默认隐藏（仅 ≤767px 显示） */
.mobile-topbar { display: none; }
.mobile-sidebar { display: none; }
.mobile-sidebar-overlay { display: none; }

@media (max-width: 767px) {
  .sidebar-narrow { display: none; }

  .mobile-topbar { display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 400;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .mtop-btn { position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 8px; border: none; background: none; color: var(--gray-600); cursor: pointer; }
  .mtop-btn:hover { background: var(--gray-100); }
  .mtop-logo { display: inline-flex; align-items: center; }
  .mtop-right { margin-left: auto; display: flex; align-items: center; gap: 2px; }
  .mtop-badge { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 99px; background: var(--red-500); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }

  .mobile-sidebar-overlay { position: fixed; inset: 0; z-index: 450; background: rgba(15,23,42,.45); display: none; }
  .mobile-sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 460; width: min(280px, 80vw);
    background: var(--bg-card); display: flex; flex-direction: column; box-shadow: 4px 0 24px rgba(0,0,0,.15);
    transform: translateX(-100%); transition: transform .22s ease; padding-top: env(safe-area-inset-top); }
  .mobile-sidebar.open { transform: translateX(0); }
  .mobile-sidebar-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-light); }
  .mobile-sidebar-nav { flex: 1; overflow-y: auto; padding: 8px; }
  /* 抽屉内导航项：横排（图标+文字），复用 x-nav-item 组件（内置图标） */
  .mobile-sidebar-nav .nav-item { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 11px 12px;
    border-radius: 8px; font-size: 14px; color: var(--gray-700); }
  .mobile-sidebar-nav .nav-item:hover { background: var(--gray-50); }
  .mobile-sidebar-nav .nav-item.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
  .mobile-sidebar-nav .nav-item .nav-item-icon { width: 18px; height: 18px; flex-shrink: 0; }
  .mobile-sidebar-nav .nav-item-label { display: inline; }
  .mobile-sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border-light); }

  .main-body { padding-bottom: 24px; }

  /* P0-2 全局弹窗手机适配 */
  .modal { max-width: 96vw; max-height: 88vh; }
  .modal-lg { max-width: 96vw; }
  .modal-header { padding: 14px 16px 0; }
  .modal-body { padding: 12px 16px; }
  .modal-footer { padding: 0 16px 14px; }
  .confirm-box { width: 90vw; }

  .customer-page { flex-direction: column; }
  /* 手机：客群抽屉触发按钮（仅手机显示） */
  .btn.m-filter-trigger { display: inline-flex !important; align-items: center; gap: 4px; pointer-events: auto; }
  .filter-panel {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 480;
    width: min(300px, 85vw); background: var(--bg-card);
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
    transform: translateX(-100%); transition: transform .22s ease;
    overflow-y: auto; padding: 16px; flex-wrap: nowrap;
  }
  .filter-panel.open { transform: translateX(0); }
  .filter-panel-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
  .filter-section { display: block; margin: 0 0 10px; }
  .filter-section-title { display: block; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gray-700); padding: 8px 0; }
  .filter-section-title .filter-arrow { float: right; transition: transform .15s; }
  .filter-section-title .filter-arrow.rotated { transform: rotate(180deg); }
  .filter-section .filter-items { display: flex; flex-wrap: wrap; gap: 6px; }
  .filter-section .filter-items .filter-item { display: inline-flex; padding: 4px 10px; font-size: 12px; }
  .filter-item.active { background: var(--brand-600); color: #fff; border-radius: var(--radius-full); }
  .filter-clear { display: block; width: 100%; margin-top: 8px; }
  /* 手机：客群抽屉遮罩 */
  .filter-overlay { display: none; }
  .filter-overlay.show { display: block; position: fixed; inset: 0; z-index: 470; background: rgba(15,23,42,.4); }

  .customer-content { padding: 12px; padding-bottom: 24px; }
  .customer-toolbar { gap: 8px; flex-wrap: wrap; }
  /* 手机：toolbar-left「共xxx个 + 新建」一行紧凑 */
  .toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; width: 100%; }
  .toolbar-left .btn-create-customer { width: auto; justify-content: center; flex-shrink: 0; }
  .toolbar-left > span.text-sm { flex: 1; min-width: 0; white-space: nowrap; }
  .search-box { flex: 1; max-width: none; }
  /* P1-3：工具栏操作不再隐藏，改第二行横向滚动（高级筛选/导入/导出/模板可用） */
  .toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; overflow-x: auto; }

  .view-bar { display: none; }
  .view-toggle { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .cell-actions { display: none; }

  .pagination-wrap { flex-direction: column; gap: 8px; align-items: flex-start; }
  .pagination-wrap .pagination-btns { overflow-x: auto; max-width: 100%; }

  .main-body { padding: 0; }
  .table-wrap { overflow-x: auto; }
  /* 手机：报价详情全屏弹窗(z-index 500)上开的产品/报价表单弹窗需在其上（modal-backdrop 默认 300） */
  .modal-backdrop { z-index: 600; }
  /* 手机：客户详情/新建面板是全屏抽屉，必须盖过 mobile-topbar(z-index 400)——
     否则面板顶栏的「保存 / 关闭」被顶栏挡住点不到（2026-10-01 新建客户改版实测） */
  .detail-overlay { z-index: 600; }
  .detail-panel-hint { display: none !important; }
  .detail-panel-header { padding: 10px 14px; gap: 8px; }
  /* 手机：客户详情任务卡片纵向布局（info 在上、操作行换行——避免 4 按钮挤压 info 到 0） */
  .detail-panel .day-task { flex-wrap: wrap; }
  .detail-panel .day-task-main { flex: 1 1 100%; }
  .detail-panel .day-task-actions { width: 100%; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
  /* 手机：客户页不被顶部导航遮挡（顶栏 sticky 高 ~56px），内容自然流 + 底部留白 */
  .customer-page { height: auto; min-height: 0; }
  .page-footer { padding: 16px 12px 48px; text-align: center; color: var(--text-subtle); font-size: 12px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ----- 标签/需求产品 多选下拉 ----- */
.tag-dropdown {
  position: absolute; top: 100%; left: 0; z-index: 10;
  background: #fff; border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-lg, 10px); padding: 8px;
  min-width: 180px; max-width: 260px;
  box-shadow: 0 8px 24px rgba(15,23,42,.12);
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 4px;
}
.tag-dropdown-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 6px;
  font-size: 13px; cursor: pointer; user-select: none;
  transition: background .12s;
}
.tag-dropdown-item:hover { background: var(--gray-50, #f8fafc); }
.tag-checkbox {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid var(--border-color, #cbd5e1);
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  color: #fff; transition: all .15s;
}
.tag-checkbox.checked {
  background: var(--brand-600, #4f46e5);
  border-color: var(--brand-600, #4f46e5);
}

/* ----- 单选项下拉（状态/等级/来源） ----- */
.select-dropdown {
  position: absolute; top: 100%; left: 0; z-index: 10;
  background: #fff; border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-lg, 10px); padding: 4px;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(15,23,42,.12);
}
.select-dropdown-item {
  padding: 7px 12px; border-radius: 6px;
  font-size: 13px; cursor: pointer;
  transition: background .12s;
}
.select-dropdown-item:hover { background: var(--gray-50, #f8fafc); }
.select-dropdown-item.active {
  background: var(--brand-50, #eef2ff);
  color: var(--brand-700, #4338ca);
  font-weight: 500;
}

/* ===================== 任务日历 ===================== */
.cal-page { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 0 10px; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-toolbar-left { display: flex; align-items: center; gap: 16px; }
.cal-toolbar-right { display: flex; align-items: center; gap: 10px; }
@media (max-width: 767px) {
  .cal-toolbar-left { flex-wrap: wrap; gap: 8px; }
}
.cal-stats { display: flex; gap: 14px; font-size: 13px; color: var(--text-muted); }
.cal-stat { display: inline-flex; align-items: center; gap: 5px; }
.cal-stat b { color: var(--text-main, #1e293b); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-red { background: var(--red-500, #ef4444); }
.dot-blue { background: var(--brand-600, #1B579C); }
.dot-gray { background: var(--gray-400, #94a3b8); }

.cal-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.cal-month-title { font-size: 18px; font-weight: 700; font-family: var(--font-heading); min-width: 120px; text-align: center; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; flex: 1; min-height: 0; }
.cal-head { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 4px 0; }
.cal-cell {
  border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  background: #fff; min-height: 84px; padding: 4px 6px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}
.cal-cell:hover { border-color: var(--brand-300); box-shadow: 0 2px 8px rgba(27,87,156,.08); }
.cal-cell.out { background: var(--gray-50); opacity: .55; }
.cal-cell.today { border-color: var(--brand-500); box-shadow: inset 0 0 0 1px var(--brand-500); }
.cal-day { display: flex; align-items: center; justify-content: space-between; }
.cal-day-num { font-size: 13px; font-weight: 600; color: var(--text-main, #1e293b); }
.cal-cell.today .cal-day-num {
  width: 22px; height: 22px; line-height: 22px; text-align: center;
  background: var(--brand-600); color: #fff; border-radius: 50%; font-size: 12px;
}
.cal-day-badges { display: flex; gap: 2px; }
.cal-mini-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-mini-dot.pri-high { background: var(--red-500, #ef4444); }
.cal-mini-dot.pri-medium { background: var(--amber-500, #f59e0b); }
.cal-mini-dot.pri-low { background: var(--green-500, #22c55e); }
.cal-mini-dot.overdue { outline: 1px solid var(--red-500); outline-offset: 1px; }

.cal-tasks { display: flex; flex-direction: column; gap: 3px; min-height: 0; }
.cal-task {
  display: flex; align-items: center; gap: 5px; font-size: 12px;
  background: var(--gray-50); border-radius: 6px; padding: 2px 6px;
  color: var(--text-main, #1e293b); overflow: hidden; white-space: nowrap;
}
.cal-task.overdue { background: #fef2f2; color: var(--red-600, #dc2626); }
.cal-task:hover { background: var(--brand-50, #eef4fb); }
.cal-pri { width: 3px; height: 12px; border-radius: 2px; flex-shrink: 0; }
.cal-pri.pri-high { background: var(--red-500, #ef4444); }
.cal-pri.pri-medium { background: var(--amber-500, #f59e0b); }
.cal-pri.pri-low { background: var(--green-500, #22c55e); }
.cal-task-title { overflow: hidden; text-overflow: ellipsis; }
.cal-task-cust { color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.cal-more { font-size: 11px; color: var(--text-subtle); padding-left: 8px; }

/* 当日任务弹窗 */
.day-task {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  padding: 8px 10px; margin-bottom: 8px; background: #fff;
}
.day-task-main { display: flex; align-items: flex-start; gap: 10px; min-width: 0; flex: 1; }
.day-task-info { flex: 1; min-width: 0; }
.day-task-title { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }
.day-task-snooze { font-size: 12px; color: var(--amber-600); }
.day-task-actions { display: flex; gap: 4px; flex-shrink: 0; }
.checkbox.checked { background: var(--green-600); border-color: var(--green-600); }

/* 自动生成任务标记 */
.cal-auto-badge {
  font-size: 10px; line-height: 1; padding: 2px 5px; border-radius: 8px;
  background: var(--brand-50, #eef4fb); color: var(--brand-600, #1B579C);
  border: 1px solid var(--brand-200, #bcd0e8); white-space: nowrap;
}

/* ===================== 看板视图 ===================== */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; }

/* P1-4：任务页手机适配——日历横向滚动、看板 1 列 */
@media (max-width: 767px) {
  .cal-grid { grid-template-columns: repeat(7, minmax(84px, 1fr)); overflow-x: auto; flex: none; min-height: 0; }
  .cal-cell { min-height: 64px; }
  .cal-nav { flex-wrap: wrap; gap: 8px; }
  .kanban { grid-template-columns: 1fr; }
}
.kanban-col {
  background: var(--gray-50); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 10px; min-height: 420px;
}
.kanban-col-title {
  font-size: 14px; font-weight: 600; display: flex; align-items: center;
  margin-bottom: 10px; color: var(--text-main, #1e293b);
}
.kanban-count {
  margin-left: 6px; font-size: 12px; color: var(--text-subtle);
  background: #fff; border: 1px solid var(--border-light); border-radius: 10px;
  padding: 0 8px; line-height: 18px;
}
.dot-green { background: var(--green-500, #22c55e); }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 100px; }
.kanban-card {
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  padding: 8px 10px; cursor: grab; box-shadow: 0 1px 2px rgba(15,23,42,.04);
  transition: box-shadow .15s, border-color .15s;
}
.kanban-card:hover { border-color: var(--brand-300); box-shadow: 0 2px 8px rgba(27,87,156,.10); }
.kanban-card.dragging { opacity: .45; }
.kanban-card.done { background: var(--gray-50); }
.kanban-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.kanban-card-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.kanban-card-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-subtle); }
.kanban-empty {
  border: 1px dashed var(--border); border-radius: var(--radius-lg);
  color: var(--text-subtle); font-size: 12px; text-align: center; padding: 16px 0;
}

/* 日历拖拽 */
.cal-cell.drag-over { border-color: var(--brand-500); background: var(--brand-50, #eef4fb); box-shadow: inset 0 0 0 2px var(--brand-500); }
.cal-task { cursor: grab; }
.cal-task.dragging { opacity: .45; }

/* 自动跟进开关 */
.auto-followup-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; user-select: none; }
.switch {
  width: 34px; height: 18px; border-radius: 10px; background: var(--gray-300, #cbd5e1);
  border: none; position: relative; transition: background .2s; cursor: pointer; padding: 0; flex-shrink: 0;
}
.switch .switch-knob {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: left .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); pointer-events: none;
}
.auto-followup-toggle.on .switch { background: var(--brand-600, #1B579C); }
.auto-followup-toggle.on .switch .switch-knob { left: 18px; }

/* 任务弹窗：关联客户搜索选择器 */
.customer-picker { position: relative; }
.customer-picker-input {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; text-align: left; width: 100%; background: #fff;
}
.customer-picker-input.placeholder { color: var(--text-subtle); }
.customer-picker-drop { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60; }
.customer-picker-list { max-height: 220px; overflow-y: auto; padding: 4px; }
.customer-picker-list .select-dropdown-item {
  display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; cursor: pointer;
  border-radius: 6px; min-width: 0;
}
.customer-picker-list .select-dropdown-item:hover { background: var(--gray-50); }
.customer-picker-list .select-dropdown-item.active { background: var(--brand-50, #eef4fb); color: var(--brand-700); font-weight: 500; }

/* 客户行持续选中高亮（打开详情后固定，切换客户/关闭面板才清除） */
tr.row-active,
.table-customers tbody tr.row-active {
  background: var(--brand-50, #eef4fb);
  box-shadow: inset 3px 0 0 var(--brand-600);
}
.table-customers tbody tr.row-active:hover { background: var(--brand-50, #eef4fb); }

/* 完成按钮 + 已完成徽标 */
.btn-success-solid { background: var(--green-600, #16a34a); color: #fff; border: none; }
.btn-success-solid:hover { background: var(--green-700, #15803d); box-shadow: var(--shadow-btn-hover); transform: translateY(-1px); }
.done-badge {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 500;
  color: var(--green-700, #15803d); background: #dcfce7; border: 1px solid #bbf7d0;
  border-radius: 10px; padding: 3px 8px; white-space: nowrap;
}

/* 新建/编辑任务弹窗：比例宽度（参考 1200px ≈ 62.5vw） */
.task-modal-lg { width: 62.5vw; max-width: 1200px; min-width: 520px; }

/* 日历格子快捷加号 */
.cal-cell-add {
  width: 18px; height: 18px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--brand-600); color: #fff; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  opacity: 0; transition: opacity .15s, transform .15s;
}
.cal-cell:hover .cal-cell-add { opacity: 1; }
.cal-cell-add:hover { transform: scale(1.15); }
.cal-day { gap: 4px; }

/* 已完成任务在日历格子的样式 */
.cal-task.done { background: var(--gray-100, #f1f5f9); color: var(--text-subtle); text-decoration: line-through; }
.cal-task.done:hover { background: var(--gray-100); }
.cal-task-check { color: var(--green-600, #16a34a); font-weight: 700; flex-shrink: 0; }

/* 任务悬浮预览卡片 */
.task-preview {
  position: fixed; z-index: 500; width: 300px; max-height: 320px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(15,23,42,.14); padding: 10px 12px; font-size: 13px;
  line-height: 1.6;
}
.task-preview-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task-preview-title { font-weight: 600; color: var(--text-main, #1e293b); }
.task-preview-link { color: var(--brand-600); font-size: 12px; white-space: nowrap; text-decoration: none; }
.task-preview-link:hover { text-decoration: underline; }
.task-preview-cust { color: var(--text-subtle); font-size: 12px; margin-bottom: 4px; }
.task-preview-section { font-size: 11px; color: var(--text-subtle); font-weight: 600; margin: 8px 0 3px; text-transform: uppercase; letter-spacing: .03em; }
.task-preview-fu { background: var(--gray-50); border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.task-preview-contact { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 2px 0; }
.task-preview-contact-val { color: var(--text-subtle); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-preview-actions { display: flex; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-light); }

/* 客户本地时区提示 */
.tz-hint {
  background: var(--brand-50, #eef4fb); border: 1px solid var(--brand-200, #bcd0e8);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.7;
}
.tz-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

/* 状态过滤按钮 */
.filter-btn {
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 2px 8px; cursor: pointer; transition: all .15s;
}
.filter-btn:hover { background: var(--gray-50); border-color: var(--border-light); }
.filter-btn.active { background: var(--brand-50, #eef4fb); border-color: var(--brand-300); color: var(--brand-700); }
.filter-btn.active b { color: var(--brand-700); }


/* 当日弹窗任务备注 */
.day-task-desc {
  margin-top: 4px; font-size: 12px; color: var(--text-muted); line-height: 1.5;
  max-height: 44px; overflow: hidden; cursor: pointer; background: var(--gray-50);
  border-radius: 6px; padding: 4px 8px; word-break: break-all;
  white-space: pre-line; /* 保留备注中的换行符 */
}
.day-task-desc:hover { background: var(--gray-100); }
.day-task-desc.expanded { max-height: none; }
.desc-more { color: var(--brand-600); font-size: 11px; white-space: nowrap; }

/* 网站链接：超长截断省略 */
.website-link {
  display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: middle; font-size: 12px;
  color: var(--brand-600); text-decoration: none;
}
.website-link:hover { text-decoration: underline; }

/* 全局二次确认弹窗（替代浏览器原生 confirm，全站共用） */
.confirm-overlay {
  /* 1100：必须高于所有页面弹窗（报价 500 / PI 900~960 / 手机 modal-backdrop 600），
     否则在弹窗里点「删除」时确认框会被弹窗盖住 = 看起来没反应。
     低于 toast(9999)。x-ui.pick 的 portal 菜单是 1000，也在这个之下。 */
  position: fixed; inset: 0; z-index: 1100; background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.confirm-box {
  background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-modal);
  width: 340px; max-width: 90vw; padding: 22px 24px; text-align: center;
}
.confirm-icon { font-size: 34px; margin-bottom: 8px; display: flex; justify-content: center; color: var(--amber-600); }
.confirm-title { font-size: 15px; font-weight: 600; color: var(--gray-800); font-family: var(--font-heading); }
.confirm-msg { font-size: 13px; color: var(--gray-600); margin-top: 8px; line-height: 1.6; word-break: break-word; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }

/* ============================================================
   客户详情 / 新建客户：「标题 + 输入框」字段网格（2026-10-01 改版）
   作用域限定在 .detail-panel 内 —— 全局只有一个定义处，
   页面 <style> 禁止重写同名类（见 AGENTS.md 踩坑记录 2026-09-23 第 1 条）
   ============================================================ */
.detail-panel .fp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 16px;
}
.detail-panel .fp-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.detail-panel .fp-row.fp-span { grid-column: 1 / -1; }
/* 多行控件（textarea / 网站 / 社媒 / 联系人块）标题顶对齐 */
.detail-panel .fp-row.fp-top { align-items: start; }
.detail-panel .fp-row.fp-top > .fp-label { padding-top: 7px; }
.detail-panel .fp-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: right;
  line-height: 1.35;
  min-width: 0;
  word-break: break-all;
}
.detail-panel .fp-ctl { min-width: 0; }
.detail-panel .fp-ctl > .input,
.detail-panel .fp-ctl > textarea.input { width: 100%; box-sizing: border-box; }
/* 只读展示行（负责人 / 当地时间 / 创建时间） */
.detail-panel .fp-static {
  font-size: 13px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 保存中的字段淡出反馈（不打断输入） */
.detail-panel .fp-saving { opacity: .55; }
/* 只读 ⇄ 编辑 模式切换：纯 CSS 淡入（display 由 x-show 切换，动画自动重放；
   不要改用 Alpine 的 x-transition —— 实测切换后新旧两块会同时可见 1.1s） */
@keyframes modeFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.detail-panel .mode-block { animation: modeFadeIn .18s ease; }
/* ===== 详情只读展示（2026-10-01 第 4 轮：详情默认只读，点「编辑」才可改）===== */
.detail-panel .fp-static { white-space: normal; }            /* 只读值允许多行（备注/标签换行） */
/* 只读主标题值（公司名称）：比其余字段大一档，建立视觉落点 */
.detail-panel .fp-static-lg { font-size: 15px; font-weight: 600; color: var(--text-strong, var(--text)); line-height: 1.4; }
.detail-panel .fp-ro-block { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-panel .fp-chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-50, #eff6ff); color: var(--brand-700, #1d4ed8);
  font-size: 12px; line-height: 18px;
}
/* 标签用中性色、需求产品用品牌色 —— 两类 chips 同排时一眼可分 */
.detail-panel .fp-chip-tag { background: var(--gray-100, #f1f3f5); color: var(--text-muted); }
/* 只读卡片标题（与其他卡片 h4 层级统一） */
.detail-panel .ro-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.detail-panel .ro-card-head h4 { font-weight: 600; font-size: 14px; }
/* 网站：一行一条 + 悬停出现复制按钮 */
.detail-panel .ro-link-row { display: flex; align-items: center; gap: 6px; }
.detail-panel .ro-link-row .copy-mini { opacity: 0; transition: opacity .12s ease; }
.detail-panel .ro-link-row:hover .copy-mini { opacity: 1; }
.detail-panel .fp-link { color: var(--brand-600); font-size: 13px; word-break: break-all; }
.detail-panel .fp-link:hover { text-decoration: underline; }
.detail-panel .fp-ro-line { display: block; margin-bottom: 2px; }
/* 只读联系人：联系方式一行一个（图标 + 值 + 复制），社媒只显示图标（与线上一致） */
.detail-panel .ct-ro-title {
  margin-left: 2px; font-size: 12px; color: var(--text-muted);
}
.detail-panel .ct-ro-title::before { content: "·"; margin-right: 6px; color: var(--text-subtle); }
.detail-panel .ct-ro-lines { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.detail-panel .ct-ro-line {
  display: flex; align-items: center; gap: 7px; min-height: 24px;
  padding: 1px 6px; margin-left: -6px; border-radius: 6px;
  transition: background-color .12s ease;
}
.detail-panel .ct-ro-line:hover { background: var(--gray-50, #f8fafc); }
.detail-panel .ct-ro-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .9; }
.detail-panel .ct-ro-val {
  font-size: 13px; color: var(--text); min-width: 0;
  word-break: break-all; text-decoration: none;
}
.detail-panel a.ct-ro-val:hover { text-decoration: underline; }
.detail-panel .ct-ro-plat { color: var(--text-muted); font-size: 12px; margin-right: 6px; }
/* 可点击的小徽标（写邮件 / Telegram）—— 提示这一行能点 */
.detail-panel .ct-ro-tag {
  font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 999px;
  background: var(--brand-50, #eff6ff); color: var(--brand-700, #1d4ed8);
  opacity: 0; transition: opacity .12s ease; flex-shrink: 0;
}
.detail-panel .ct-ro-line:hover .ct-ro-tag { opacity: 1; }
@media (hover: none) { .detail-panel .ct-ro-tag { opacity: 1; } }
.detail-panel .ct-ro-line .copy-mini { opacity: 0; transition: opacity .12s ease; }
.detail-panel .ct-ro-line:hover .copy-mini { opacity: 1; }
.detail-panel .ct-ro-social { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.detail-panel .ct-ro-social-icon {
  width: 22px; height: 22px; border-radius: 5px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.detail-panel .ct-ro-social a:hover .ct-ro-social-icon { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(15, 23, 42, .16); }
/* 只读卡片里的图标/链接统一走品牌色，避免整页灰扑扑 */
.detail-panel .fp-ro-block { align-items: center; gap: 10px; }
.detail-panel .fp-ro-block a { display: inline-flex; align-items: center; }
.detail-panel .fp-ro-block .social-icon { transition: transform .12s ease, box-shadow .12s ease; border-radius: 5px; }
.detail-panel .fp-ro-block a:hover .social-icon { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(15, 23, 42, .16); }
/* 触屏设备没有 hover：复制按钮/图标动效一律常显，否则永远看不到 */
@media (hover: none) {
  .detail-panel .ct-ro-line .copy-mini,
  .detail-panel .ro-link-row .copy-mini { opacity: 1; }
  .detail-panel .ct-ro-line:hover { background: none; }
  .detail-panel .ct-ro-line { margin-left: 0; padding-left: 0; padding-right: 0; }
}
/* 只读值里的长链接换行更自然 */
.detail-panel .fp-link { overflow-wrap: anywhere; }

/* 联系人编辑块：标题+输入框 双列 */
.detail-panel .ct-block {  border: 1px solid #e8ecf0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  margin-bottom: 10px;
}
.detail-panel .ct-block:last-child { margin-bottom: 0; }
.detail-panel .ct-block-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}
.detail-panel .ct-block-title { font-weight: 600; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-panel .ct-multi-row { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.detail-panel .ct-multi-row .input { flex: 1; min-width: 0; }
/* 「其他聊天平台」：一行两个「下拉 + 输入框」 */
.detail-panel .im-other-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
.detail-panel .im-other-grid .ct-multi-row { margin-bottom: 0; }
.detail-panel .ct-add-mini {
  font-size: 11px; color: var(--brand-600); background: none; border: none;
  cursor: pointer; padding: 1px 2px; text-align: left;
}
.detail-panel .ct-add-mini:hover { text-decoration: underline; }

/* 国家：输入框 + 模糊搜索建议列表（2026-10-01 用户要求：改成输入模糊搜索选择） */
.detail-panel .country-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  max-height: 240px; overflow-y: auto; padding: 4px;
}
.detail-panel .country-suggest-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
}
.detail-panel .country-suggest-item.active { background: var(--brand-50); color: var(--brand-700); }
.detail-panel .country-suggest-item .code {
  margin-left: auto; flex-shrink: 0; font-size: 11px; color: var(--text-subtle); font-family: monospace;
}
.detail-panel .country-suggest-empty {
  padding: 10px 8px; text-align: center; font-size: 12px; color: var(--text-muted);
}
@media (max-width: 767px) {
  .detail-panel .fp-grid { grid-template-columns: 1fr; }
  .detail-panel .fp-row { grid-template-columns: 66px minmax(0, 1fr); }
  .detail-panel .im-other-grid { grid-template-columns: 1fr; }
}
