:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --navy: #16233c;
  --navy-2: #20345d;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --muted-2: #9aa4b2;
  --line: #e6ebf2;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --radius: 14px;
  --shadow: 0 2px 14px rgba(22, 35, 60, 0.06);
  --sidebar: 148px;
  --topbar: 56px;
}

* { box-sizing: border-box; }
/* 手机端禁止双击缩放；保留单指滚动与多指手势由 JS 拦截 */
html, body { margin: 0; padding: 0; touch-action: manipulation; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.app-shell { min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  transition: transform 0.24s ease;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 18px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2f6bff, #1d4ed8);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.brand-text strong { display: block; font-size: 13px; letter-spacing: 0.2px; }
.brand-text span { display: block; font-size: 10px; color: var(--muted-2); }
.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: #5b6779;
  font-size: 13px;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: #f4f7fc; color: var(--primary); }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(37, 99, 235, 0.22); }
.nav-item .nav-icon { flex: none; opacity: 0.95; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 4px; color: var(--muted-2); font-size: 11px; }
.sidebar-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); margin-right: 6px; }

/* ---------- Main / topbar ---------- */
.main-wrap { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  height: var(--topbar);
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-title { font-size: 16px; font-weight: 600; letter-spacing: 0.3px; }
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  display: grid;
  place-items: center;
  position: relative;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn .badge {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f87171;
  border: 1.5px solid var(--navy);
}
/* 待回访数量角标：红色数字气泡 */
.icon-btn .badge.count-badge {
  top: -3px;
  right: -5px;
  width: auto;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  font-weight: 700;
  text-align: center;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd7b5, #f0a57a);
  display: grid;
  place-items: center;
  color: #7a3c1d;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}
.avatar-btn { border: 0; cursor: pointer; padding: 0; }
.avatar-btn:hover { box-shadow: 0 0 0 3px rgba(255,255,255,.22); }
.account-menu { position: relative; display: flex; align-items: center; }
.account-menu-panel {
  display: none;
  position: absolute; top: 100%; right: -8px; min-width: 190px;
  padding: 8px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--text); box-shadow: 0 12px 30px rgba(15,23,42,.18); z-index: 60;
}
.account-menu:hover .account-menu-panel,
.account-menu:focus-within .account-menu-panel,
.account-menu-panel.open { display: block; }
.account-menu-user { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.account-menu-user b { display: block; font-size: 13px; }
.account-menu-user span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.account-menu-panel button {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text);
  font-size: 12px; text-align: left; cursor: pointer;
}
.account-menu-panel button:hover { background: #f1f5ff; color: var(--primary); }
/* 消息通知：替换原右上角待回访铃铛入口 */
.notification-wrap { position: relative; display: flex; align-items: center; }
.notification-panel {
  position: absolute; top: 100%; right: -10px; width: 340px; max-width: calc(100vw - 24px);
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text);
  box-shadow: 0 14px 34px rgba(15,23,42,.18); z-index: 60; overflow: hidden;
}
.notification-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notification-head b { font-size: 13px; }
.notification-actions { display: inline-flex; align-items: center; gap: 12px; }
.notification-list { max-height: 360px; overflow: auto; }
.notification-item {
  width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px;
  border: 0; border-bottom: 1px solid #f0f3f7; background: #fff; color: var(--text);
  font-family: inherit; text-align: left; cursor: pointer;
}
.notification-item:hover { background: #f5f8ff; }
.notification-item.read { background: #fafbfc; color: var(--muted); }
.notification-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--primary); flex: none; }
.notification-item.read .notification-dot { background: #cbd5e1; }
.notification-main { min-width: 0; display: block; }
.notification-main b { display: block; font-size: 12px; }
.notification-main > span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.notification-main em { display: block; margin-top: 4px; color: var(--primary); font-size: 10px; font-style: normal; }
.notification-empty { padding: 30px 14px; text-align: center; color: var(--muted); font-size: 12px; }
.menu-btn { display: none; }
.content { padding: 20px 24px 44px; max-width: 1560px; margin: 0 auto; }

/* ---------- 第三方嵌入页（易订货）：iframe 占满右侧内容区 ---------- */
.external-app-page { display: none; }
/* 易订货 iframe 独立层：脱离 #app，render() 重建 innerHTML 时会话不被销毁 */
.external-app-layer { position: fixed; top: var(--topbar); left: var(--sidebar); right: 0; bottom: 0; z-index: 28; display: none; background: var(--bg); }
.external-app-layer.show { display: block; }
.external-app-layer .external-app-frame-wrap { width: 100%; height: 100%; background: #fff; }
.external-app-layer .external-app-frame-wrap iframe { display: block; width: 100%; height: 100%; border: 0; }

/* ---------- Common ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: 0.2px; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--primary); border-color: #cbd9f7; }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.plain { background: #f3f6fb; color: #526071; border-color: var(--line); }
.btn.plain:hover { background: #e9eef6; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.danger { background: #fff1f1; color: var(--danger); border-color: #fecaca; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.7;
  background: #eef2f7;
  color: #64748b;
  white-space: nowrap;
}
.badge.blue { background: #e8f0ff; color: #2f6bff; }
.badge.green { background: #e7f8ee; color: #16a34a; }
.badge.orange { background: #fff3e0; color: #d97706; }
.badge.red { background: #feecec; color: #dc2626; }
.badge.purple { background: #f1eaff; color: #7c3aed; }
.badge.gray { background: #f1f3f6; color: #778193; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); display: inline-block; margin-right: 6px; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted-2); font-size: 13px; }

/* ---------- Dashboard ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 92px;
  padding: 16px 18px;
  border: 1px solid #e6edf9;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff 0%, #f7faff 100%);
  box-shadow: var(--shadow);
}
.stat-card[data-action] { cursor: pointer; font-family: inherit; color: inherit; text-align: left; }
.stat-card[data-action]:hover { border-color: #b9cdf7; box-shadow: 0 8px 20px rgba(47,107,255,.13); }
.stat-card::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -24px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 107, 255, 0.08), transparent 70%);
}
.stat-label { color: #667085; font-size: 12px; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: 0.4px; line-height: 1.1; }
.stat-value.ok { color: var(--primary); font-size: 19px; }
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: #e8f0ff;
  color: #3b74f5;
  display: grid;
  place-items: center;
  flex: none;
}
.stat-icon.green { background: #e7f8ee; color: #16a34a; }
.stat-icon.orange { background: #fff3e0; color: #f59e0b; }
.stat-icon.purple { background: #f1eaff; color: #8b5cf6; }
.stat-icon.red { background: #feecec; color: #dc2626; }
.stat-icon.gray { background: #f1f3f6; color: #98a2b3; }
/* 首页统计条件与可点击维度卡片 */
.dash-stat-filter { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; }
.dash-range { display: inline-flex; gap: 4px; padding: 3px; background: #f1f5fb; border-radius: 9px; }
.range-btn { border: 0; background: transparent; color: #667085; font-size: 12px; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.range-btn:hover { color: var(--primary); }
.range-btn.active { background: #fff; color: var(--primary); font-weight: 650; box-shadow: 0 1px 3px rgba(16,24,40,.1); }
.dash-range-hint { margin-left: auto; }
/* 首页指标卡：5 项（客资数 / 已登记寄样 / 已寄样 / 成交客户 / 跟进客户）一行排布 */
.metric-grid { margin-bottom: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat-metric-card {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  min-height: 92px; padding: 14px 18px; border: 1px solid #dbe7ff; border-radius: 16px;
  background: linear-gradient(135deg, #fff 0%, #f3f7ff 100%); box-shadow: var(--shadow);
  font-family: inherit; transition: transform .12s ease, box-shadow .12s ease;
}
.stat-metric-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(47,107,255,.15); }
.stat-metric-card[data-no-drill="1"] { cursor: default; }
.stat-metric-card[data-no-drill="1"]:hover { transform: none; box-shadow: var(--shadow); }
.stat-metric-card .stat-label { display: flex; align-items: center; gap: 6px; }
.metric-go { color: #98a2b3; display: inline-flex; }
.stat-metric-card .stat-icon { position: absolute; right: 14px; bottom: 14px; width: 38px; height: 38px; }
/* 归属人/销售员统一多选组件：按钮显示当前选择，面板内带客户数 */
.owner-multi { position: relative; display: inline-flex; align-items: center; }
.filter-owners-multi {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  min-width: 148px; min-height: 34px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--text); font-size: 12px; cursor: pointer;
}
.filter-owners-multi:hover, .filter-owners-multi.open { border-color: #9dbcf8; box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.owner-multi-value { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-multi-value.placeholder { color: #667085; }
.owner-multi-caret { color: #98a2b3; font-size: 10px; transition: transform .15s ease; }
.filter-owners-multi.open .owner-multi-caret { transform: rotate(180deg); }
.owner-multi-panel {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 230px;
  max-height: 280px; overflow-y: auto; padding: 6px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(16,24,40,.14); z-index: 50;
}
.owner-multi-panel.open { display: block; }
.owner-multi-option {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px;
  font-size: 12px; color: var(--text); cursor: pointer; white-space: nowrap;
}
.owner-multi-option:hover { background: #f5f8ff; }
.owner-multi-option.active { background: #eef4ff; color: var(--primary); font-weight: 600; }
.owner-multi-option input { margin: 0; accent-color: var(--primary); }
.owner-multi-count { margin-left: auto; color: #98a2b3; font-weight: 400; }
.owner-multi-empty { padding: 8px; color: var(--muted-2); font-size: 12px; }
.owner-multi-native { display: none; }
.dialog .owner-multi { display: flex; width: 100%; }
.dialog .owner-multi-trigger { width: 100%; }
/* 字典多选（意向产品 / 寄样产品）：选项统一左对齐 */
.multi-select-field .owner-multi { display: flex; width: 100%; }
.multi-select-field .owner-multi-trigger {
  width: 100%; min-height: 38px; justify-content: space-between; text-align: left;
}
.multi-select-field .owner-multi-value {
  flex: 1; min-width: 0; max-width: none; text-align: left;
}
.multi-select-field .owner-multi-panel {
  left: 0; right: 0; width: 100%; min-width: 0; max-height: 260px; padding: 5px;
}
.multi-select-field .owner-multi-option {
  justify-content: flex-start; text-align: left; min-height: 28px;
  padding: 5px 10px; font-size: 12.5px; line-height: 1.35;
}
.multi-select-field .owner-multi-option input {
  width: auto; flex: 0 0 auto; min-width: 0; margin: 0;
  padding: 0; border: 0; background: transparent; box-shadow: none;
}
.multi-select-field .owner-multi-option span { text-align: left; }
/* 寄样产品清单：产品 / 规格 / 数量，可增行删行 */
.sample-items-field .sample-items { display: flex; flex-direction: column; gap: 6px; }
.sample-item-row {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 84px 30px;
  gap: 6px; align-items: center;
}
.sample-item-row select,
.sample-item-row input {
  height: 34px; min-width: 0; padding: 0 9px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
}
.sample-item-row select { padding-right: 6px; }
.sample-item-row input[data-item="qty"] { text-align: center; padding: 0 4px; }
.sample-item-row select:focus,
.sample-item-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.sample-item-del {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
}
.sample-item-del:hover { border-color: #f0a7a7; color: #d64545; background: #fff5f5; }
.sample-items-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
@media (max-width: 767px) {
  .sample-item-row { grid-template-columns: minmax(0, 1fr) 80px 30px; }
  .sample-item-row select { grid-column: 1 / -1; }
}
.charts-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 16px; margin-top: 16px; }
.panel { padding: 18px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { font-size: 14px; font-weight: 650; }
/* 待办分组跟进人单选筛选 */
.todo-owner-filter.filter-select { height: 30px; padding: 0 22px 0 9px; font-size: 12px; max-width: 160px; }
.panel-sub { font-size: 11px; color: var(--muted-2); }
.chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.trend-controls { display: flex; gap: 6px; align-items: center; }
.trend-controls .filter-select { min-width: 88px; height: 30px; font-size: 12px; padding: 0 20px 0 8px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.line-chart { width: 100%; height: 220px; }
.chart-svg-wrap { position: relative; }
.chart-tip { position: absolute; z-index: 5; display: none; min-width: 156px; padding: 8px 10px; border-radius: 8px; background: rgba(17, 24, 39, .94); color: #fff; font-size: 11px; line-height: 1.5; pointer-events: none; box-shadow: 0 6px 18px rgba(15, 23, 42, .2); }
.chart-tip.show { display: block; }
.chart-tip-title { font-weight: 650; margin-bottom: 5px; color: #fff; }
.chart-tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart-tip-row i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chart-tip-row b { margin-left: auto; font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 8px; }
.donut-wrap svg { width: 170px; height: 170px; flex: none; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; font-size: 12px; }
.donut-legend-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.donut-legend-row span:first-child { color: var(--muted); display: flex; align-items: center; }
.donut-legend-row b { font-weight: 600; }
.donut-legend-row::after { content: ""; }
.donut-legend .bar { height: 2px; width: 18px; background: #d8e2f0; margin-left: 6px; }

/* ---------- Table ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  font-weight: 500;
  color: #7b8798;
  background: #f6f8fb;
  padding: 11px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f0f3f7; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #f9fbff; }
.data-table .name-cell { font-weight: 600; color: #1f2937; }
/* 操作列吸右：备注等长文本把表格撑出横向滚动时，操作按钮仍固定可见 */
.table-wrap.sticky-action .data-table th.col-action,
.table-wrap.sticky-action .data-table td.col-action { position: sticky; right: 0; z-index: 1; }
.table-wrap.sticky-action .data-table th.col-action { background: #f6f8fb; box-shadow: inset 1px 0 0 var(--line); }
.table-wrap.sticky-action .data-table td.col-action { background: #fff; box-shadow: inset 1px 0 0 #f0f3f7; }
.table-wrap.sticky-action .data-table tbody tr:hover td.col-action { background: #f9fbff; }
.table-wrap.sticky-action .data-table tbody tr.row-selected td.col-action { background: #f5f8ff; }
.table-actions { display: flex; gap: 6px; }
.link-btn { border: none; background: transparent; color: var(--primary); padding: 2px 4px; font-size: 12px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.link-btn.claim-btn { color: #16a34a; font-weight: 600; }
.btn.claim-btn { border-color: #16a34a; color: #16a34a; }

/* ---------- Filters / lists ---------- */
.filter-bar { padding: 12px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-input {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 11px;
  min-width: 190px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.filter-input:focus { border-color: #9dbcf8; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08); }
.filter-select { height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 28px 0 10px; background: #fff; color: var(--text); outline: none; }
.filter-date { min-width: 138px; }
.filter-label { font-size: 12px; color: #667085; font-weight: 500; }
.filter-sep { font-size: 12px; color: #98a2b3; }
.filter-range { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* 已选筛选条件：浅蓝底 + 主色边框 + 加粗文字，一眼可辨 */
.filter-select.is-active,
.filter-input.is-active,
.owner-multi-trigger.is-active,
.filter-drawer-dialog select.is-active,
.filter-drawer-dialog input.is-active {
  border-color: var(--primary);
  background: #eef4ff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}
.filter-select.is-active:hover,
.filter-input.is-active:hover,
.owner-multi-trigger.is-active:hover { border-color: var(--primary); }
.filter-range.is-active .filter-label,
.filter-range.is-active .filter-sep { color: var(--primary); font-weight: 700; }
/* 已选中的日期/输入框：Chrome 下 date input 文字需 -webkit-text-fill-color 才能变主色，
   并加左侧主色竖条标记，选中态一眼可辨 */
.filter-drawer-dialog input.is-active,
.filter-drawer-dialog select.is-active {
  -webkit-text-fill-color: var(--primary);
  border-left: 3px solid var(--primary);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .16), inset 3px 0 0 rgba(37, 99, 235, .06);
}
/* 有值的日期区间整组：label 与「至」一并高亮加粗 */
.filter-drawer-dialog .field:has(.filter-range.is-active) > label,
.filter-drawer-dialog .field:has(input.is-active) > label,
.filter-drawer-dialog .field:has(select.is-active) > label {
  color: var(--primary);
  font-weight: 700;
}
.record-filter-bar .filter-input { min-width: 150px; }
.record-filter-bar .filter-date { min-width: 136px; }
/* 客户列表筛选：条件较多，压缩控件宽度让一行尽量排满 */
.customer-filter-bar { gap: 8px; }
.customer-filter-bar .filter-input { min-width: 168px; }
.customer-filter-bar .filter-select { max-width: 176px; }
/* 归属人多选沿用普通下拉的尺寸/边框；仅展开时保留焦点反馈 */
.customer-filter-bar .filter-owners-multi { min-width: 0; font-size: inherit; }
.customer-filter-bar .filter-owners-multi:hover { border-color: var(--line); box-shadow: none; }
.customer-filter-bar .filter-owners-multi.open { border-color: #9dbcf8; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08); }
.customer-filter-bar .filter-date { min-width: 132px; }
.customer-filter-bar .filter-range { gap: 5px; }
.customer-filter-bar .filter-owners-multi.is-active,
.customer-filter-bar .filter-owners-multi.is-active:hover { border-color: var(--primary); background: #eef4ff; color: var(--primary); box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16); }
/* 关键字搜索固定在筛选条件最后，给足宽度便于输入 */
.customer-filter-bar .filter-keyword { min-width: 200px; flex: 1 1 200px; }
/* 批量导入：模板下载 + 文件上传两步走 */
.import-steps { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.import-step { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
.import-step-main { flex: 1; min-width: 0; }
.import-step-main b { font-size: 13px; }
.import-step-main p { margin: 4px 0 8px; }
.step-no {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 600;
}
.import-pick { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.import-step .btn + span { margin-left: 8px; }
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
/* 公海客资为独立视图：靠右 + 橙色胶囊，区别于普通状态 tab */
.tabs .tab-pool {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px 7px; border: 1px solid #fed7aa; border-radius: 999px;
  background: #fff7ed; color: #c2410c; font-weight: 600;
}
.tabs .tab-pool::before,
.mobile-filter-chips .tab-pool::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: #f97316; flex: none;
}
.tab {
  border: none;
  background: transparent;
  padding: 8px 2px 11px;
  color: var(--muted);
  font-size: 13px;
  position: relative;
}
.tab.active { color: var(--primary); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--primary); border-radius: 2px; }
.tabs .tab-pool.active { background: #ea580c; border-color: #ea580c; color: #fff; }
.tabs .tab-pool.active::before { background: #fff; }
.tabs .tab-pool.active::after { display: none; }
.mobile-filter-chips { display: none; }
.mobile-filter-chips .tab-pool {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  background: #fff7ed; border-color: #fed7aa; color: #c2410c; font-weight: 600;
}
.mobile-filter-chips .tab-pool.active { background: #ea580c; border-color: #ea580c; color: #fff; }
.mobile-filter-chips .tab-pool.active::before { background: #fff; }
.mobile-list { display: none; }
.customer-card { padding: 14px 16px; margin-bottom: 10px; cursor: pointer; }
.customer-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.customer-card-head { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.customer-card-identity { min-width: 0; }
.customer-card h3 { margin: 0; font-size: 16px; font-weight: 650; }
.customer-card-identity h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.customer-card .phone { color: #667085; font-size: 12px; margin-left: 6px; font-weight: 400; word-break: break-all; }
.customer-card-identity .phone { margin-left: 0; }
.customer-card .wechat-contact { color: #2f6bff; }
.customer-meta { margin-top: 10px; display: grid; gap: 6px; font-size: 12px; color: #667085; }
.customer-meta b { color: #344054; font-weight: 500; margin-left: 10px; }
/* 待办列表跟进内容：备注较长时换行显示，避免撑破表格 */
.todo-content { max-width: 360px; white-space: normal; word-break: break-word; line-height: 1.5; }
/* 客户详情待办卡片：复用待办事项页卡片结构，去掉整卡手型 */
.detail-todo-card { cursor: default; }
.detail-todo-card .customer-card-top { flex-wrap: wrap; }
.detail-todo-card .customer-meta b { word-break: break-word; }
.detail-todo-list .customer-card:last-child { margin-bottom: 0; }
.customer-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.customer-card-actions .btn { flex: 1; min-width: 0; padding-left: 6px; padding-right: 6px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5fb;
  color: #526071;
  font-size: 11px;
  border: 1px solid transparent;
}
.tag-chip.blue { background: #eaf1ff; color: #2f6bff; border-color: #d7e5ff; }
.tag-chip.orange { background: #fff5e6; color: #d97706; border-color: #ffe4bb; }
.tag-chip.green { background: #e8f8ee; color: #16a34a; border-color: #cdf0da; }
.tag-chip.auto { opacity: 0.75; }

/* ---------- Detail ---------- */
.detail-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.detail-left, .detail-right { display: flex; flex-direction: column; gap: 16px; }
.detail-section { padding: 18px 20px; }
.section-title { font-size: 14px; font-weight: 650; margin: 0 0 16px; display: flex; align-items: center; justify-content: space-between; }
.info-grid { display: grid; grid-template-columns: 76px 1fr; row-gap: 13px; column-gap: 8px; font-size: 13px; }
.info-grid .key { color: #98a2b3; }
.info-grid .val { color: #344054; font-weight: 500; }
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: #dfe6f0; }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -19px;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #cbd9f7;
}
.timeline-dot.system { background: #94a3b8; box-shadow: 0 0 0 1px #d7dee8; }
.timeline-dot.visit { background: var(--success); box-shadow: 0 0 0 1px #b7e4c7; }
.timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.timeline-head b { font-weight: 600; }
.timeline-time { color: #98a2b3; font-size: 11px; margin-left: auto; }
.timeline-content { margin-top: 6px; color: #475467; font-size: 13px; }
.timeline-item.void { opacity: 0.5; }
.timeline-item.void .timeline-content { text-decoration: line-through; }
.detail-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.detail-top-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.quick-actions { display: none; }
.detail-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 14px; flex-wrap: wrap; }
.detail-banner-main { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.detail-banner-right { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Tag / Sync / API / Settings ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.mini-card { padding: 16px; }
.mini-card h3 { margin: 0 0 8px; font-size: 14px; }
.mini-card p { margin: 4px 0; color: var(--muted); font-size: 12px; }
.kv-line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #edf1f6; font-size: 12px; }
.kv-line:last-child { border-bottom: none; }
.kv-line span:first-child { color: var(--muted); }
.method { display: inline-block; min-width: 42px; text-align: center; padding: 2px 6px; border-radius: 5px; font-size: 10px; font-weight: 700; }
.method.get { background: #e7f8ee; color: #16a34a; }
.method.post { background: #eaf1ff; color: #2f6bff; }
.code-block {
  background: #111a2e;
  color: #cfe0ff;
  border-radius: 10px;
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}
/* 字典管理：顶部概览 + 分区图标 */
.dict-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.dict-overview-item { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.dict-overview-num { font-size: 24px; font-weight: 700; line-height: 1; color: var(--text, #101828); }
.dict-section .panel-head { align-items: flex-start; gap: 10px; }
.dict-section-title { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dict-section-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; }
.dict-section-icon.tone-blue { color: #2563eb; background: #eff6ff; }
.dict-section-icon.tone-purple { color: #7c3aed; background: #f5f3ff; }
.dict-section-icon.tone-cyan { color: #0891b2; background: #ecfeff; }
.dict-section-icon.tone-orange { color: #ea580c; background: #fff7ed; }
.dict-section-icon.tone-green { color: #059669; background: #ecfdf5; }
.dict-section-count { font-size: 11px; font-weight: 600; color: var(--muted, #667085); background: #f2f4f7; border-radius: 999px; padding: 2px 8px; }
.dict-add-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: end; }
.dict-key { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; color: #475467; }
.dict-key-readonly { display: inline-block; min-width: 88px; padding: 6px 8px; border: 1px dashed var(--line, #d0d5dd); border-radius: 8px; background: #f8fafc; user-select: text; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.profile-grid .full { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1; }

/* ---------- 客资自动分配规则 ---------- */
.aa-block { margin-top: 14px; }
.aa-label { font-size: 13px; font-weight: 600; color: #344054; margin-bottom: 8px; }
.switch-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #344054; cursor: pointer; }
.switch-row input { width: 16px; height: 16px; accent-color: var(--primary, #2563eb); }
.aa-chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.aa-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid #d0d5dd; border-radius: 16px; font-size: 12px; color: #475467; background: #fff; cursor: pointer; user-select: none; }
.aa-chip:has(input:checked) { border-color: #9dbcf8; background: #eff4ff; color: #1d4ed8; }
.aa-chip input { width: 14px; height: 14px; accent-color: var(--primary, #2563eb); margin: 0; }
.aa-table th, .aa-table td { vertical-align: middle; }
.aa-table input[type="number"] { width: 76px; padding: 6px 8px; border: 1px solid #d0d5dd; border-radius: 6px; font-size: 13px; }
.aa-today { display: inline-block; min-width: 24px; padding: 2px 8px; border-radius: 10px; background: #f2f4f7; font-weight: 600; color: #344054; text-align: center; }
.aa-meta { margin-top: 12px; padding-top: 10px; border-top: 1px solid #eaecf0; }

/* ---------- Modal / toast / drawer ---------- */
#modalRoot:empty { display: none; }
#modalRoot {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.dialog {
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  padding: 20px 22px;
}
.dialog.wide { width: 620px; }
/* 成员管理：编辑表单字段与多选项较多，放大弹窗避免横向滚动与内容截断 */
.dialog.user-form-dialog { width: 880px; max-width: 97vw; max-height: 96vh; padding: 28px 32px; }
.dialog.user-form-dialog .dialog-head { margin-bottom: 22px; }
.dialog.user-form-dialog .dialog-head h2 { font-size: 22px; }
.dialog.user-form-dialog .form-grid { gap: 22px 24px; }
.dialog.user-form-dialog .field > input:not([type="hidden"]):not([type="checkbox"]),
.dialog.user-form-dialog .field > select { height: 46px; padding: 12px 14px; font-size: 14px; }
.dialog.user-form-dialog .multi-select-field { grid-column: 1 / -1; }
.dialog.user-form-dialog .hint { margin: 18px 0 6px; font-size: 14px; line-height: 1.65; }
.dialog.user-form-dialog .dialog-foot { margin-top: 26px; }
/* 寄样登记 / 寄样表单：更大的弹窗，字段与多选项更舒展 */
.dialog.sample-form-dialog { width: 880px; max-width: 97vw; max-height: 96vh; padding: 28px 32px; }
.dialog.sample-form-dialog .dialog-head { margin-bottom: 22px; }
.dialog.sample-form-dialog .dialog-head h2 { font-size: 22px; }
.dialog.sample-form-dialog .form-grid { gap: 22px 24px; }
.dialog.sample-form-dialog .field > input:not([type="hidden"]):not([type="checkbox"]),
.dialog.sample-form-dialog .field > select { height: 46px; padding: 12px 14px; font-size: 14px; }
.dialog.sample-form-dialog .field textarea { min-height: 150px; padding: 14px; font-size: 14px; }
.dialog.sample-form-dialog .multi-select-field { grid-column: 1 / -1; }
.dialog.sample-form-dialog .hint { margin: 18px 0 6px; font-size: 14px; line-height: 1.65; }
.dialog.sample-form-dialog .dialog-foot { margin-top: 26px; }
.dialog.sample-form-dialog .ship-customer-info { padding: 16px 18px; margin-bottom: 18px; }
.dialog.sample-form-dialog .ship-customer-info > div { font-size: 15px; }
/* 筛选客户弹窗：条件多且含四组日期区间，加大宽高避免横向滚动与内容截断 */
.dialog.filter-drawer-dialog { width: 960px; max-width: 96vw; max-height: 94vh; padding: 26px 30px; }
.filter-drawer-dialog .dialog-head { margin-bottom: 18px; }
.filter-drawer-dialog .dialog-head h2 { font-size: 20px; }
.filter-drawer-dialog .hint { margin-bottom: 14px; font-size: 13px; }
.filter-drawer-dialog .form-grid { gap: 16px 26px; }
.filter-drawer-dialog .filter-range { width: 100%; }
.filter-drawer-dialog .filter-range input { min-width: 0; flex: 1 1 0; }
.filter-drawer-dialog .dialog-foot { margin-top: 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-close { border: none; background: #f3f6fa; color: #667085; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
/* 寄样弹窗客户信息摘要 */
.ship-customer-info { display: grid; gap: 6px; background: #f7f9fc; border: 1px solid #e8edf5; border-radius: 9px; padding: 10px 12px; margin-bottom: 12px; }
.ship-customer-info > div { display: flex; gap: 10px; font-size: 13px; line-height: 1.5; }
.ship-customer-info span { color: #8892a4; min-width: 62px; flex: none; }
.ship-customer-info b { color: #23324d; font-weight: 600; word-break: break-all; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: #667085; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #9dbcf8; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08); }
.input-with-unit { display: flex; align-items: center; gap: 8px; }
.input-with-unit input { flex: 1; min-width: 0; }
.input-with-unit > span { flex: none; color: #667085; font-size: 12px; }
.field textarea { min-height: 88px; resize: vertical; }
.readonly-value { padding: 9px 10px; border: 1px dashed var(--line); border-radius: 9px; background: #f8fafc; color: #667085; font-size: 13px; }
.field-error { color: var(--danger); font-size: 11px; display: none; }
.field.invalid .field-error { display: block; }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: #fca5a5; }
.segment { display: flex; gap: 6px; background: #f3f6fa; padding: 4px; border-radius: 10px; }
.segment label { flex: 1; text-align: center; padding: 7px 4px; border-radius: 7px; font-size: 12px; color: #667085; cursor: pointer; }
.segment input { display: none; }
.segment input:checked + span { color: var(--primary); font-weight: 600; }
.segment label:has(input:checked) { background: #fff; box-shadow: 0 1px 5px rgba(16,24,40,.08); color: var(--primary); font-weight: 600; }
/* 新建跟进弹窗：只读档案 + 跟进方式 tab 面板 */
.record-form-dialog { width: 760px; max-width: 96vw; padding: 26px 30px 22px; border-radius: 18px; box-shadow: 0 28px 80px rgba(15,23,42,.28); }
/* 标题区：左侧主题色竖条 + 底部分隔线，强化分区层次 */
.record-form-dialog .dialog-head { position: relative; padding-left: 16px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.record-form-dialog .dialog-head::before { content: ''; position: absolute; left: 0; top: 3px; bottom: 16px; width: 4px; border-radius: 4px; background: linear-gradient(180deg, var(--primary), #7aa2ff); }
.record-form-dialog .dialog-head h2 { font-size: 21px; letter-spacing: .2px; }
.record-form-dialog .dialog-close { width: 30px; height: 30px; border-radius: 9px; transition: background .15s, color .15s, transform .15s; }
.record-form-dialog .dialog-close:hover { background: #eef3ff; color: var(--primary); transform: rotate(90deg); }
/* 顶部引导改为渐变信息条 */
.record-form-dialog > .hint { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 18px; padding: 10px 12px; color: #475467; line-height: 1.6; background: linear-gradient(90deg, #f3f8ff, #f8fafc); border: 1px solid #e3edff; border-radius: 10px; }
.record-form-dialog > .hint::before { content: ''; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.12); flex: none; }
.record-form-dialog .form-grid { gap: 18px 20px; }
/* 分区标题：小徽标 + 只读标记，建立表单阅读节奏 */
.record-form-dialog .field[data-field="customer"] > label,
.record-form-dialog .field[data-field="follow-action"] > label,
.record-form-dialog .field[data-field="tags"] > label,
.record-form-dialog .field[data-field="content"] > label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: #1d2939; font-size: 13px; }
.record-form-dialog .field[data-field="customer"] > label::before,
.record-form-dialog .field[data-field="follow-action"] > label::before,
.record-form-dialog .field[data-field="tags"] > label::before,
.record-form-dialog .field[data-field="content"] > label::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.10); flex: none; }
.record-form-dialog .field[data-field="customer"] > label::after { content: '只读'; margin-left: auto; padding: 2px 7px; border-radius: 999px; background: #eef3ff; color: var(--primary); font-size: 10px; font-weight: 600; }
.record-form-dialog .field > label { font-weight: 600; color: #344054; }
/* 跟进方式：图标 + 文字独立卡片，选中态主色渐变实心 */
.follow-action-tabs { flex-wrap: wrap; gap: 8px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.follow-action-tabs label { flex: 1 1 calc(20% - 6.4px); min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 6px; font-size: 12.5px; line-height: 1.2; color: #5c6a80; border: 1px solid #e3e9f2; border-radius: 10px; background: #fff; cursor: pointer; transition: background .16s, color .16s, box-shadow .16s, border-color .16s, transform .16s; }
.follow-action-tabs label:hover { border-color: #bcd2ff; background: #f7faff; }
.follow-action-tabs .tab-ico { width: 24px; height: 24px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: #edf3ff; color: var(--primary); transition: background .16s, color .16s; }
.follow-action-tabs .tab-ico svg { width: 15px; height: 15px; display: block; }
.follow-action-tabs label:has(input:checked) { background: linear-gradient(135deg, var(--primary), #4b7bff); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 5px 14px rgba(47,107,255,.28); transform: translateY(-1px); }
.follow-action-tabs label:has(input:checked) .tab-ico { background: rgba(255,255,255,.22); color: #fff; }
.follow-action-tabs label:has(input:checked)::after { display: none; }
.follow-panel { grid-column: 1 / -1; margin-top: 4px; padding: 16px 18px; border: 1px solid #e5eaf2; border-radius: 12px; background: linear-gradient(180deg, #fff, #fafcff); box-shadow: 0 2px 10px rgba(16,24,40,.03); }
.follow-panel .multi-select-field { margin-bottom: 2px; }
.follow-panel .field.full { margin-bottom: 0; }
.follow-panel input[type="date"] { height: 44px; font-size: 14px; }
/* 寄样面板：联系人 / 电话并排，产品 / 地址独占整行 */
.follow-panel.sample-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.follow-panel.sample-panel > .field.full, .follow-panel.sample-panel > .sample-note { grid-column: 1 / -1; }
.follow-panel.sample-panel .sample-note { margin: -2px 0 0; }
.follow-panel.sample-panel .sample-open-order { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid #e5eaf2; border-radius: 10px; background: linear-gradient(180deg, #fbfdff, #f8fafc); transition: border-color .15s, background .15s; }
.follow-panel.sample-panel .sample-open-order:has(input:checked) { border-color: #9dbcf8; background: linear-gradient(180deg, #eff4ff, #f5f8ff); }
.follow-panel.sample-panel .sample-open-order .switch-row { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-size: 13px; font-weight: 600; color: #344054; white-space: nowrap; }
.follow-panel.sample-panel .sample-open-order .switch-row input[type="checkbox"] { width: 16px; height: 16px; margin: 0; padding: 0; border: 1px solid #d0d5dd; border-radius: 4px; background: #fff; accent-color: var(--primary, #2563eb); cursor: pointer; flex: none; }
.follow-panel.sample-panel .sample-open-order .tiny { line-height: 1.5; padding-left: 24px; font-size: 12px; }
.follow-panel.sample-panel .multi-select-field { min-width: 0; }
.readonly-profile { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; padding: 14px 16px; border: 1px solid #e5eaf2; border-radius: 10px; background: linear-gradient(180deg, #fbfdff, #f8fafc); box-shadow: inset 0 1px 0 #fff; }
.readonly-profile > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.readonly-profile span { font-size: 11px; color: #98a2b3; }
.readonly-profile b { font-size: 13px; color: #344054; font-weight: 600; word-break: break-all; }
/* 意向产品等多选长文本：独占一行，避免被压成单格省略 */
.readonly-profile > div.wide { grid-column: 1 / -1; }
/* 备注区：更大的输入面，聚焦时切回纯白 */
.record-form-dialog [data-field="content"] textarea { min-height: 108px; padding: 12px 14px; font-size: 13px; line-height: 1.6; background: #fcfdff; }
.record-form-dialog [data-field="content"] textarea:focus { background: #fff; }
.record-form-dialog .tag-picker { gap: 9px; }
.record-form-dialog .tag-picker button { padding: 7px 13px; font-size: 12.5px; }
/* 跟进弹窗内容较长：底部操作栏吸底，滚动时提交按钮始终可见 */
.record-form-dialog .dialog-foot {
  position: sticky; bottom: -22px; margin: 18px -30px -22px; padding: 14px 30px 20px;
  border-top: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(8px); z-index: 2;
  box-shadow: 0 -8px 20px rgba(16,24,40,.07);
}
.record-form-dialog .dialog-foot .btn:not(.plain) { min-width: 132px; background: linear-gradient(135deg, var(--primary), #4b7bff); box-shadow: 0 6px 16px rgba(47,107,255,.28); }
@media (max-width: 767px) {
  .record-form-dialog { padding: 20px 18px 16px; }
  .record-form-dialog .dialog-head { padding-left: 14px; }
  .record-form-dialog > .hint { margin-bottom: 14px; }
  .record-form-dialog .form-grid { gap: 14px; }
  .record-form-dialog .dialog-foot { margin: 14px -18px -16px; padding: 12px 18px 16px; }
  .record-form-dialog .field[data-field="customer"] > label::after { display: none; }
  .readonly-profile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .follow-action-tabs { gap: 4px; }
  .follow-action-tabs label { flex: 1 1 calc(20% - 3.2px); flex-direction: column; gap: 4px; padding: 8px 1px; font-size: 11px; white-space: nowrap; }
  .follow-action-tabs .tab-ico { width: 24px; height: 24px; }
  .follow-action-tabs .tab-ico svg { width: 14px; height: 14px; }
  .follow-panel.sample-panel { grid-template-columns: 1fr; gap: 12px; }
}
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.sample-rec-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sample-rec-toolbar .filter-input { min-width: 120px; }
.sample-rec-toolbar .filter-date { min-width: 130px; }
.sample-form { margin: 0 0 16px; padding: 14px; background: #f8fafc; border-radius: 12px; }
.sample-form .dialog-foot { margin-top: 12px; }
#sampleRecRegion .data-table { font-size: 12px; }
/* 客户详情寄样记录手机卡片：与待办事项卡片同款结构，长文本可换行 */
.detail-sample-card { cursor: default; }
.detail-sample-card .customer-card-top { flex-wrap: wrap; }
.detail-sample-card .customer-meta b { word-break: break-word; text-align: right; min-width: 0; }
.detail-sample-card .customer-meta > div { min-width: 0; }
.detail-sample-card .link-btn { flex: none; }

/* 新建记录：客户搜索下拉 */
.cust-picker { position: relative; }
.cust-picker-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
  display: none;
}
.cust-picker-list.open { display: block; }
.cust-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #f1f4f8;
  cursor: pointer;
}
.cust-picker-item:last-child { border-bottom: none; }
.cust-picker-item:hover, .cust-picker-item.active { background: var(--primary-soft); }
.cust-picker-item b { font-size: 13px; color: var(--text); font-weight: 600; }
.cust-picker-meta { margin-left: auto; text-align: right; }
.cust-picker-empty { padding: 12px; text-align: center; font-size: 12px; color: #98a2b3; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-picker button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #d5dbe4; background: #fff; color: #8a94a6; border-radius: 999px; padding: 6px 12px; font-size: 12px; transition: background .15s, border-color .15s, box-shadow .15s, color .15s, transform .15s; cursor: pointer; }
.tag-picker button:hover { border-color: #9db4dc; }
.tag-picker button .tag-mark { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid #c4cbd6; font-size: 11px; line-height: 1; font-weight: 700; color: #aeb6c2; background: #fff; }
.tag-picker button:not(.selected):hover .tag-mark::before { content: '+'; font-size: 11px; }
.tag-picker button.selected .tag-mark { background: var(--primary); border-color: var(--primary); color: #fff; }
.tag-picker button.selected .tag-mark::before { content: '✓'; font-size: 10px; }
.tag-color-control { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #667085; cursor: pointer; }
.tag-color-input { width: 34px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; }
.inline-form .tag-color-input { height: 34px; width: 42px; }
.tag-picker button.selected { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 700; box-shadow: inset 0 0 0 1px var(--primary), 0 0 0 3px rgba(47,107,255,.10); }
.tag-picker button.locked { background: #f4f6f9; color: #98a2b3; cursor: not-allowed; }
.tag-picker button.selected.danger { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

/* 批量操作 */
.batch-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; }
.batch-bar.active { border-color: #a9c6ff; background: var(--primary-soft); }
.batch-count { font-size: 13px; color: #344054; }
.batch-count b { color: var(--primary); font-size: 15px; }
.col-check { width: 38px; text-align: center; padding-left: 10px !important; padding-right: 0 !important; }
.col-check input, .card-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
tr.row-selected td { background: #f5f8ff; }
.customer-card.card-selected { border-color: #a9c6ff; box-shadow: 0 0 0 2px rgba(47,107,255,.12); }
.hint { background: #f5f8fd; color: #667085; border-radius: 9px; padding: 10px 12px; font-size: 12px; margin-bottom: 14px; }
#toastRoot { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #16233c;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22);
  animation: toastIn 0.22s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.mobile-bottom-nav { display: none; }
.scrim { display: none; }
.mobile-only { display: none; }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.pager-info { font-size: 12px; color: #667085; }
.pager-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-btn, .page-num { border: 1px solid var(--line); background: #fff; color: #344054; border-radius: 8px; padding: 6px 11px; font-size: 12px; cursor: pointer; }
.page-btn:hover:not(:disabled), .page-num:hover:not(.active) { border-color: #9dbcf8; color: var(--primary); }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-num.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.phone-revealed { font-weight: 600; color: #b42318; letter-spacing: .3px; }
.resolve-info { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 12px 0 16px; padding: 12px 14px; background: #f8fafc; border-radius: 10px; }
.resolve-info > div { display: flex; flex-direction: column; gap: 3px; }
.resolve-info span { font-size: 11px; color: #98a2b3; }
.resolve-info b { font-size: 12px; color: #344054; font-weight: 600; word-break: break-all; }

/* ---------- Tablet ---------- */
@media (max-width: 1199px) {
  .sidebar { transform: translateX(-100%); box-shadow: 12px 0 30px rgba(15,23,42,.12); }
  .sidebar.open { transform: none; }
  .main-wrap { margin-left: 0; }
  .menu-btn { display: grid; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .settings-grid, .profile-grid { grid-template-columns: 1fr; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.32); z-index: 35; }
  /* 易订货独立层：平板侧边栏默认隐藏，左侧留空取消 */
  .external-app-layer { left: 0; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  body { background: #eef2f7; }
  .topbar {
    height: 60px;
    padding: 0 14px;
    background: linear-gradient(135deg, #1b3773 0%, #2563eb 100%);
    border-radius: 0 0 18px 18px;
    gap: 8px;
  }
  .topbar-title { font-size: 17px; }
  .desktop-only { display: none !important; }
  .mobile-only { display: grid !important; }
  /* 移动端隐藏「易订货」「系统设置」入口（桌面端保留） */
  .nav-item[data-page="yidinghuo"] { display: none; }
  .nav-item[data-page="settings"] { display: none; }
  /* 消息通知卡片：移动端贴屏定位，避免以铃铛为锚点向左溢出被裁切 */
  .notification-panel {
    position: fixed;
    top: 60px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
  .content { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  /* 易订货独立层：topbar 高 60px，底部给导航留位 */
  .external-app-layer { top: 60px; bottom: calc(64px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 12px; }
  .page-head h1 { font-size: 20px; }
  .page-head p { font-size: 11px; }
  .page-head > .btn { height: 32px; padding: 0 10px; font-size: 12px; }
  /* 客户页：新增 / 批量导入 / 筛选 三个按钮在同一行等分宽度，筛选紧邻批量导入右侧 */
  .page-head.customers-head { flex-wrap: wrap; }
  .page-head-actions { width: 100%; display: flex; align-items: center; gap: 7px; }
  .page-head-actions .btn { flex: 1; height: 34px; justify-content: center; padding: 0 6px; font-size: 12px; }
  .list-filter-btn.mobile-only {
    display: inline-flex !important; flex: 0 0 76px; align-items: center; justify-content: center; gap: 5px;
    margin: 0 0 0 auto; height: 34px; padding: 0 6px; border: none; border-radius: 9px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
    font-size: 12px; font-weight: 650; letter-spacing: .2px;
    box-shadow: 0 3px 9px rgba(37, 99, 235, .28), inset 0 1px 0 rgba(255, 255, 255, .22);
  }
  .list-filter-btn.mobile-only svg { width: 15px; height: 15px; flex: none; }
  .list-filter-btn.mobile-only:active { transform: scale(.97); box-shadow: 0 2px 6px rgba(37, 99, 235, .3); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card, .stat-metric-card { min-height: 78px; padding: 12px; border-radius: 13px; }
  .stat-value { font-size: 20px; }
  .stat-value.ok { font-size: 16px; }
  .stat-icon { width: 36px; height: 36px; border-radius: 11px; }
  .stat-metric-card .stat-icon { right: 10px; bottom: 10px; width: 32px; height: 32px; }
  .stat-icon svg { width: 19px; height: 19px; }
  .dash-stat-filter { gap: 10px; padding: 10px 12px; flex-direction: column; align-items: stretch; }
  .dash-stat-filter .dash-range { flex-wrap: wrap; width: 100%; }
  .dash-stat-filter .filter-range { display: flex; flex-wrap: wrap; width: 100%; }
  .dash-stat-filter .filter-range .filter-date { min-width: 0; flex: 1 1 120px; width: auto; }
  .dash-range-hint { margin-left: 0; width: 100%; }
  .dash-stat-filter .owner-multi { width: 100%; }
  .filter-owners-multi { min-width: 0; width: 100%; }
  /* 手机端展示趋势图与状态分布：纵向堆叠、允许图表横向滚动避免标签挤压 */
  .charts-grid { display: block; }
  .chart-panel { display: block; margin-top: 12px; padding: 12px; }
  .chart-panel .panel-head { flex-wrap: wrap; gap: 8px; }
  .chart-panel .panel-sub { font-size: 11px; }
  .trend-controls { display: flex; gap: 6px; width: 100%; }
  .trend-controls .filter-select { flex: 1; min-width: 0; height: 30px; font-size: 12px; padding: 0 6px; }
  .chart-legend { flex-wrap: wrap; gap: 8px 12px; margin-bottom: 6px; }
  .chart-panel .table-wrap, .chart-panel .line-chart { min-width: 0; }
  .chart-panel .line-chart { height: 190px; }
  .donut-wrap { flex-wrap: wrap; }
  .donut-wrap svg { width: 140px; height: 140px; margin: 0 auto; }
  .donut-legend { width: 100%; }
  .filter-bar { display: none; }
  /* 批量操作栏吸顶：移动端勾选客户后按钮常驻可见（topbar 高 60px） */
  .batch-bar {
    position: sticky;
    top: 60px;
    z-index: 22;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  }
  .batch-bar.active .btn-row { width: 100%; margin-left: 0; display: flex; flex-wrap: wrap; }
  .record-filter-bar { display: grid !important; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px; }
  .record-filter-bar .filter-input { min-width: 0; width: 100%; }
  .record-filter-bar .filter-range { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; white-space: nowrap; }
  .record-filter-bar .filter-range .filter-date { width: 100%; min-width: 0; }
  .record-filter-bar .btn { width: 100%; }
  .tabs { gap: 0; justify-content: space-between; overflow-x: auto; }
  .tab { flex: 1; white-space: nowrap; padding: 8px 6px 10px; }
  .mobile-filter-chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 12px; scrollbar-width: none; }
  .mobile-filter-chips::-webkit-scrollbar { display: none; }
  .mobile-filter-chips button { flex: none; border: 1px solid var(--line); background: #fff; color: #667085; border-radius: 999px; padding: 5px 12px; font-size: 12px; }
  .mobile-filter-chips button.active { background: var(--primary-soft); border-color: #b9d1ff; color: var(--primary); font-weight: 600; }
  .table-wrap { display: none; }
  .mobile-list { display: block; }
  .customer-card { padding: 14px 14px 12px; border-radius: 14px; }
  .customer-list-card .customer-card-head { gap: 8px; width: 100%; }
  .customer-list-card .card-check { flex: none; }
  .customer-list-card .customer-card-identity { flex: 1; }
  /* 客户卡片：核心信息浅底两列，来源/画像次要在下方细字区，长文本可换行不截断 */
  .customer-list-card .customer-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  .customer-list-card .customer-meta > div { min-width: 0; display: flex; gap: 6px; line-height: 1.45; }
  .customer-list-card .customer-meta b {
    margin-left: 0; min-width: 0; flex: 1; text-align: right; color: #344054; font-weight: 600;
    white-space: normal; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .customer-list-card .customer-meta-primary {
    margin-top: 11px; padding: 10px 11px; background: #f5f8ff; border: 1px solid #e8efff; border-radius: 10px;
  }
  .customer-list-card .customer-meta-secondary {
    margin-top: 9px; padding-top: 9px; border-top: 1px dashed #e3e8f0; font-size: 11px; color: #98a2b3;
  }
  .customer-list-card .customer-meta-secondary b { color: #667085; font-weight: 500; }
  .customer-list-card:active { background: #f8fbff; }
  .customer-list-card .customer-card-actions { margin-top: 11px; gap: 6px; }
  .customer-list-card .customer-card-actions .btn { height: 30px; font-size: 12px; }
  .detail-layout { display: block; }
  .detail-left, .detail-right { gap: 12px; }
  .detail-left { margin-bottom: 12px; }
  .detail-section { padding: 16px; border-radius: 14px; }
  .detail-banner { border-radius: 12px; }
  .quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 14px 8px;
  }
  .quick-action { border: none; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 7px; color: #475467; font-size: 12px; }
  .quick-action .qa-icon { width: 44px; height: 44px; border-radius: 50%; background: #e7f8ee; color: #16a34a; display: grid; place-items: center; }
  .quick-action:nth-child(2) .qa-icon, .quick-action:nth-child(3) .qa-icon, .quick-action:nth-child(4) .qa-icon { background: #e7efff; color: #2f6bff; }
  .detail-actions { display: none; }
  .detail-right .btn-row { display: none; }
  .mobile-sticky-action {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    background: #fff;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    z-index: 24;
    display: flex;
    gap: 8px;
  }
  .mobile-sticky-action .btn.block {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 4px;
    font-size: 13px;
    white-space: nowrap;
  }
  .mobile-sticky-action .btn.block:nth-child(2) { background: var(--primary-soft); color: var(--primary); border-color: #a9c6ff; }
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 25;
    box-shadow: 0 -4px 18px rgba(22,35,60,.04);
  }
  .nav-bottom-item { border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #98a2b3; font-size: 10px; }
  .nav-bottom-item.active { color: var(--primary); font-weight: 600; }
  .nav-bottom-item.add .add-circle { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 14px rgba(37,99,235,.28); }
  .grid-cards { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .pager { justify-content: center; text-align: center; }
  .resolve-info { grid-template-columns: 1fr; }
  /* 页面标题区：标题独占一行，按钮另起一行，避免副标题与按钮互相挤压 */
  .page-head { flex-wrap: wrap; gap: 10px; }
  .page-head > div:first-child { flex: 1 1 100%; min-width: 0; }
  .page-head .btn-row { width: 100%; }
  .page-head .btn-row .btn { flex: 1; justify-content: center; }
  /* 档案信息：收窄标签列，长值允许换行，避免溢出 */
  .info-grid { grid-template-columns: 62px minmax(0, 1fr); column-gap: 6px; row-gap: 11px; }
  .info-grid .val { word-break: break-all; }
  /* 同步面板头：说明文字与筛选另起一行，避免与标题重叠 */
  .sync-panel .panel-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .sync-panel .sync-panel-tools { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
  .sync-panel .sync-panel-tools > .tiny { flex: 1 1 100%; }
  .sync-panel .compact-select { flex: 1; min-width: 0; }
  /* 同步统计条：窄屏两列紧凑排布 */
  .sync-summary-bar { gap: 8px; padding: 10px 12px; }
  .sync-summary-item { flex: 1 1 calc(50% - 8px); padding: 6px 8px; justify-content: center; }
  .sync-summary-item b { font-size: 15px; }
  /* 同步应用卡片：操作按钮横排，避免竖排拥挤 */
  .sync-app-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
  /* 同步应用面板头：统计说明另起一行，不与标题、新建按钮挤压 */
  .sync-apps-section .panel-head { flex-wrap: wrap; gap: 8px; }
  .sync-apps-section .panel-head .panel-title { flex: 0 0 100%; }
  .sync-apps-section .panel-head .panel-title .tiny { display: block; margin-top: 4px; }
  .sync-apps-section .panel-head .btn-row .btn { width: 100%; justify-content: center; }
  #modalRoot { align-items: flex-end; padding: 0; }
  .dialog { width: 100%; max-height: 88vh; border-radius: 20px 20px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
  /* 筛选客户弹窗在手机端仍为全宽底部抽屉，覆盖桌面端放大尺寸 */
  .dialog.filter-drawer-dialog { width: 100%; max-width: 100%; max-height: 88vh; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
  .filter-drawer-dialog .form-grid { gap: 14px; }
  /* 筛选客户弹窗：头部固定，滚动条件时标题始终可见。
     用 ::before 背板覆盖负 margin 溢出的顶部区域，避免滚动内容从标题栏上方穿透露出。 */
  .filter-drawer-dialog .dialog-head {
    position: sticky;
    top: 0;
    z-index: 8;
    background: #fff;
    margin: -18px -16px 12px;
    padding: 14px 16px 12px;
    box-shadow: 0 8px 14px -10px rgba(16, 24, 40, .22);
  }
  .filter-drawer-dialog .dialog-head::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -18px;
    height: 18px;
    background: #fff;
  }
  /* 顶部拖拽把手：提示这是可下拉关闭的底部抽屉 */
  .filter-drawer-dialog .drawer-handle {
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #d0d5dd;
  }
  .filter-drawer-dialog .dialog-head h2 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 6px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .2px;
  }
  .filter-drawer-dialog .dialog-head h2 svg { color: var(--primary); flex: none; }
  .filter-drawer-dialog .dialog-head .dialog-close { border-radius: 50%; width: 32px; height: 32px; margin-top: 6px; }
  /* 归属人下拉右对齐：触发按钮文本与展开面板均靠右，避免窄屏溢出 */
  .filter-drawer-dialog .owner-multi { width: 100%; }
  .filter-drawer-dialog .owner-multi-trigger { justify-content: flex-end; text-align: right; }
  .filter-drawer-dialog .owner-multi-value { text-align: right; }
  .filter-drawer-dialog .owner-multi-panel { left: auto; right: 0; }
  #toastRoot { top: 72px; }
}

@media (min-width: 768px) {
  .mobile-sticky-action { display: none; }
}

/* ---------- 登录页 ---------- */
.login-content { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-wrap { width: 100%; max-width: 380px; }
.login-card { padding: 28px 24px; border-radius: 16px; }
.login-card .brand-mark { width: 40px; height: 40px; }

/* ---------- 抖音来客线索详情 ---------- */
.clue-section .section-title { margin-bottom: 12px; }
.clue-summary { grid-template-columns: 84px 1fr; }
.clue-dialog { width: 860px; max-width: 96vw; }
.clue-dialog .dialog-body { max-height: 74vh; overflow-y: auto; padding-right: 4px; }
/* 外呼机器人运行日志：更大的弹窗，运行记录 / 回调事件以 tab 切换，表格区独立滚动 */
.dialog.robot-logs-dialog { width: 900px; max-width: 96vw; max-height: 94vh; padding: 24px 28px; }
.robot-logs-dialog .dialog-body { max-height: 76vh; overflow-y: auto; padding-right: 6px; }

/* ---------- 话单详情：通话转写 + 意向总结 + 录音播放 ---------- */
.dialog.call-detail-dialog { width: 1080px; max-width: 97vw; max-height: 94vh; padding: 22px 26px; }
.call-detail-dialog .dialog-body { padding-right: 0; }
.call-inline-audio { margin-top: 10px; }
.call-inline-audio audio { width: 100%; height: 36px; }
.call-detail-head { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.call-detail-callid { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.call-detail-callid code { font-size: 13px; color: var(--text); background: #f6f8fa; padding: 3px 8px; border-radius: 5px; }
.call-detail-meta { margin-top: 8px; font-size: 15px; font-weight: 600; color: var(--navy); }
.call-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: stretch; }
.call-section-title { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.call-transcript { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fbfcfe; }
.call-transcript-body { max-height: 54vh; overflow-y: auto; padding-right: 8px; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.call-transcript-body::-webkit-scrollbar { width: 6px; }
.call-transcript-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.call-transcript-body::-webkit-scrollbar-track { background: transparent; }
.call-bubble-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.call-bubble-row.bot { flex-direction: row; justify-content: flex-end; }
.call-avatar { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; }
.call-avatar.user { background: linear-gradient(135deg, #f0a27a, #d9704b); }
.call-avatar.bot { background: linear-gradient(135deg, #5b8def, #2563eb); }
.call-bubble-main { max-width: 78%; min-width: 0; }
.call-bubble-row.bot .call-bubble-main { text-align: right; }
.call-bubble-time { font-size: 11px; color: var(--muted-2); margin: 0 4px 4px; }
.call-bubble { display: inline-block; text-align: left; padding: 9px 13px; border-radius: 12px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.call-bubble-row.user .call-bubble { background: #fff; color: var(--text); border: 1px solid var(--line); border-top-left-radius: 3px; }
.call-bubble-row.bot .call-bubble { background: var(--primary); color: #fff; border-top-right-radius: 3px; }
.call-summary-panel { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: #fff; }
.call-summary-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.call-summary-text { font-size: 14px; line-height: 1.75; color: var(--text); background: #f6f8fa; border-left: 3px solid var(--primary); border-radius: 0 8px 8px 0; padding: 12px 14px; min-height: 120px; white-space: pre-wrap; }
.call-summary-fields { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.call-summary-fields > div { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 13px; }
.call-summary-fields span { color: var(--muted); }
.call-summary-fields b { color: var(--navy); }
.call-detail-player { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.call-audio-bar { display: flex; align-items: center; gap: 10px; }
.call-audio-nav { flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.call-audio-nav:hover { color: var(--primary); border-color: var(--primary); }
.call-audio-empty { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; padding: 8px 0; }
.robot-logs-dialog .tabs { margin-bottom: 16px; }
.robot-logs-dialog .dialog-foot { margin-top: 18px; }
.clue-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.clue-core-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.clue-core-item { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.clue-core-item span { display: block; font-size: 11px; color: var(--muted); }
.clue-core-item b { display: block; font-size: 13px; margin-top: 3px; word-break: break-all; font-weight: 600; color: #344054; }
.clue-core-item .link-btn { display: inline-block; margin-top: 2px; font-size: 11px; }
.clue-section-title { font-weight: 650; font-size: 13px; margin: 0 0 8px; }
.clue-raw-details { margin-top: 4px; }
.clue-raw-summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; margin-bottom: 0; }
.clue-raw-summary::-webkit-details-marker { display: none; }
.clue-raw-summary > span:first-child { display: flex; align-items: center; gap: 6px; }
.clue-raw-summary svg { transition: transform .15s ease; }
.clue-raw-details[open] .clue-raw-summary svg { transform: rotate(90deg); }
.clue-raw-details[open] .clue-raw-summary { border-radius: 10px 10px 0 0; border-bottom: none; }
.clue-raw-details[open] .clue-field-wrap { border-radius: 0 0 10px 10px; }
.clue-field-wrap { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.clue-field-table th, .clue-field-table td { padding: 8px 10px; font-size: 12px; vertical-align: top; }
.clue-field-table th { position: sticky; top: 0; background: #f8fafc; z-index: 1; }
.clue-label { white-space: nowrap; font-weight: 600; color: #344054; }
.clue-field-key { color: var(--muted-2); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; }
@media (max-width: 767px) {
  .clue-core-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clue-dialog { max-height: 92vh; }
  .clue-field-wrap { max-height: 50vh; }
}

/* ---------- 列表新增列与同步分页 ---------- */
.col-tags .tag-row { gap: 4px; flex-wrap: wrap; }
.col-tags .tag-chip { font-size: 11px; padding: 2px 6px; }
.data-table th.col-sample, .data-table td.col-sample { min-width: 84px; }
.data-table th.col-tags, .data-table td.col-tags { min-width: 120px; }
/* 同步日志成功/失败客户统计 */
.sync-summary-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.sync-summary-item { display: flex; align-items: baseline; gap: 6px; padding: 6px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.sync-summary-label { color: #7b8798; font-size: 12px; }
.sync-summary-item b { font-size: 17px; color: #1f2937; }
.sync-summary-item b.ok, .sync-count-cell .ok { color: #1a9d5a; font-weight: 600; }
.sync-summary-item b.bad, .sync-count-cell .bad { color: #d64545; font-weight: 600; }
.sync-count-cell .muted { color: #9aa4b2; }
.section-pager { padding: 10px 14px; border-top: 1px solid var(--line); }

/* ---------- 隐藏入口：打标签统一在跟进中操作 ---------- */
.hidden-feature { display: none !important; }

/* ---------- 系统设置容器子菜单 ---------- */
.settings-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; padding: 6px; background: #f1f5f9; border: 1px solid var(--line); border-radius: 12px; }
.settings-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 8px; background: transparent; color: #475467; font-size: 13px; font-weight: 550; cursor: pointer; }
.settings-tab:hover { background: #e2e8f0; }
.settings-tab.active { background: #fff; color: var(--primary, #2f6bff); box-shadow: 0 1px 3px rgba(16,24,40,.1); }

/* ---------- 成员管理：按项目分组树形结构 ---------- */
.tree-group-row { cursor: pointer; background: #f8fafc; }
.tree-group-row:hover { background: #f1f5f9; }
.tree-group-row td { padding: 9px 12px; border-bottom: 1px solid var(--line); color: #344054; }
.tree-group-row td > svg { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.tree-caret { display: inline-flex; vertical-align: -3px; margin-right: 4px; color: #667085; }
.tree-caret svg { display: block; }
.tree-group-card-head > svg { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.tree-member-row td:first-child { padding-left: 30px; }
.tree-leaf { display: inline-block; position: relative; padding-left: 14px; }
.tree-leaf:before { content: ''; position: absolute; left: 2px; top: 50%; width: 7px; height: 1px; background: #cbd5e1; }
.tree-group-card { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tree-group-card-head { display: flex; align-items: center; gap: 4px; padding: 11px 13px; background: #f8fafc; cursor: pointer; font-size: 13px; }
.tree-group-children { padding: 8px; display: grid; gap: 8px; }
.tree-member-card { margin-left: 10px; }

/* ---------- 同步中心：应用卡片与类型筛选 ---------- */
.sync-center { display: grid; gap: 16px; }
.sync-apps-section { padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.sync-apps-section .panel-head { margin-bottom: 6px; }
.sync-section-hint { margin: 0 0 14px; }
.sync-app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.sync-app-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sync-app-head { display: flex; align-items: flex-start; gap: 10px; }
.sync-app-icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: grid; place-items: center; }
.sync-app-icon.dy { background: #eaf1ff; color: #2f6bff; }
.sync-app-icon.xhs { background: #fff1e8; color: #e2571a; }
.sync-app-title { min-width: 0; flex: 1; }
.sync-app-title h3 { margin: 0 0 5px; font-size: 15px; font-weight: 650; word-break: break-all; }
.sync-app-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sync-app-actions .link-btn[data-enabled="0"] { color: var(--danger); }
.sync-app-actions .link-btn[data-enabled="1"] { color: #16a34a; }
.sync-app-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 11px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.sync-app-meta > div { min-width: 0; }
.sync-app-meta span { display: block; font-size: 11px; color: var(--muted); }
.sync-app-meta b { display: block; margin-top: 2px; font-size: 12px; font-weight: 550; color: #344054; word-break: break-all; }
.sync-clue-strip { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: auto; }
.sync-clue-strip.pending { color: var(--muted); font-size: 12px; }
.sync-clue-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: #344054; margin-bottom: 8px; }
.sync-clue-stats { display: grid; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.sync-clue-stats span { display: flex; justify-content: space-between; gap: 8px; }
.sync-clue-stats b { color: #344054; font-weight: 600; word-break: break-all; text-align: right; }
.sync-panel { overflow: hidden; }
.sync-panel-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.compact-select { width: auto; min-width: 116px; padding: 6px 9px; font-size: 12px; }
.sync-log-type { display: grid; gap: 3px; }
.sync-log-type .badge { justify-self: start; }
@media (max-width: 900px) {
  .sync-app-grid { grid-template-columns: 1fr; }
  .sync-panel-tools { justify-content: flex-start; }
}

/* ---------- 应用中心 ---------- */
.integration-app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.integration-app-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.integration-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.integration-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 15px; font-weight: 650; color: #1f2937; margin-bottom: 4px; }
.integration-card-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; color: var(--muted); }
.integration-card-stats b { display: block; margin-top: 3px; font-size: 13px; color: #344054; word-break: break-all; }
.integration-error { margin-top: 8px; padding: 7px 9px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 7px; word-break: break-all; }
.integration-detail-panel { min-height: 320px; }
.integration-overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 12px; }
.digest-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f8fafc; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 4px 0 14px; }
.filter-row input, .filter-row select { width: auto; min-width: 160px; }
.checkbox-field label { display: flex; align-items: center; gap: 8px; }
.checkbox-field input { width: auto; }
.req { color: #dc2626; }
@media (max-width: 767px) {
  .integration-app-grid { grid-template-columns: 1fr; }
  .integration-overview-grid { grid-template-columns: 1fr; gap: 14px; }
  .integration-card-stats { grid-template-columns: 1fr; }
  .filter-row input, .filter-row select { width: 100%; min-width: 0; }
  .filter-row .btn { width: 100%; }
  .digest-cell { max-width: 120px; }
}

/* ---------- 外呼任务 ---------- */
.outbound-detail-page { display: flex; flex-direction: column; gap: 16px; }
.outbound-row-ops { white-space: nowrap; }
.outbound-row-ops .link-btn + .link-btn { margin-left: 6px; }
.outbound-page .outbound-filter .filter-keyword { min-width: 200px; flex: 1 1 200px; }
.outbound-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.outbound-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.outbound-metric { min-width: 0; padding: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.outbound-metric span { display: block; font-size: 11px; color: var(--muted); }
.outbound-metric b { display: block; margin-top: 6px; font-size: 20px; font-weight: 650; color: #1f2937; word-break: break-all; }
.outbound-metric b.blue { color: var(--primary); }
.outbound-metric b.green { color: var(--success); }
.outbound-metric b.red { color: var(--danger); }
.outbound-error { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--danger); font-size: 11px; }
.outbound-robots .outbound-robot + .outbound-robot { border-top: 1px solid var(--line); }
.outbound-robot-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; flex-wrap: wrap; }
.outbound-robot-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.outbound-robot-title b { font-size: 14px; }
.outbound-robot-body { padding: 14px; margin-bottom: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.outbound-robot-body .form-grid { gap: 12px 16px; }
.outbound-robot-actions { margin-top: 14px; }
.outbound-customer-card .badge + .badge { margin-left: 4px; }
.outbound-task-dialog { width: 560px; }
.week-row { display: flex; flex-wrap: wrap; gap: 8px; }
.week-check { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; cursor: pointer; }
.week-check input { width: auto; margin: 0; accent-color: var(--primary); }
.outbound-checks { gap: 10px; }
.outbound-checks label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #344054; cursor: pointer; }
.outbound-checks input { width: auto; accent-color: var(--primary); }
.callback-secret { display: grid; gap: 10px; }
.callback-secret > div { padding: 10px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; }
.callback-secret span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.callback-secret code { color: #1f2937; font-size: 12px; word-break: break-all; }
@media (max-width: 1199px) {
  .outbound-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .outbound-page .table-wrap, .outbound-detail-page .table-wrap { display: block; }
  .outbound-page .outbound-filter .filter-keyword { width: 100%; min-width: 0; flex: 1 1 100%; }
  .outbound-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .outbound-metric b { font-size: 17px; }
  .outbound-pager { justify-content: center; }
  .outbound-robot-body .form-grid { grid-template-columns: 1fr; }
  .outbound-robot-actions .btn { flex: 1 1 45%; justify-content: center; }
  .outbound-detail-head .btn-row { width: 100%; }
  .outbound-detail-head .btn-row .btn { flex: 1; justify-content: center; }
  .outbound-detail-page { gap: 12px; }
  .dialog.robot-logs-dialog { width: 100%; max-width: 100%; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
  .robot-logs-dialog .dialog-body { max-height: 70vh; padding-right: 2px; }
  .dialog.call-detail-dialog { width: 100%; max-width: 100%; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
  .call-inline-audio { margin-top: 8px; }
  .call-detail-grid { grid-template-columns: 1fr; }
  .call-bubble-main { max-width: 86%; }
  .robot-logs-dialog .panel-head { flex-wrap: wrap; gap: 6px; }
}

/* ==================== AI 助手：科幻 HUD 全屏界面 ==================== */
.ai-assistant-layer {
  --aa-cyan: #22d3ee;
  --aa-blue: #3b82f6;
  --aa-purple: #a855f7;
  --aa-text: #e6f1ff;
  --aa-muted: #8fb3d9;
  --aa-line: rgba(34,211,238,.20);
  position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.ai-assistant-layer .aa-fab,
.ai-assistant-layer .aa-mask,
.ai-assistant-layer .aa-panel { pointer-events: auto; }

/* 入口胶囊：暗玻璃 + 霓虹描边 */
.aa-fab { position: fixed; right: 24px; bottom: 26px; border: 1px solid rgba(34,211,238,.42); border-radius: 999px;
  background: linear-gradient(135deg, rgba(9,16,36,.94), rgba(14,26,56,.9)); color: #f0fbff;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 11px;
  box-shadow: 0 0 24px rgba(34,211,238,.18), 0 10px 30px rgba(0,0,0,.45); transition: transform .18s, opacity .2s, box-shadow .2s; }
.aa-fab:hover { transform: translateY(-2px); box-shadow: 0 0 32px rgba(34,211,238,.3), 0 12px 34px rgba(0,0,0,.5); }
.aa-fab.hidden { opacity: 0; pointer-events: none; transform: translateY(10px); }
.aa-fab-wave { width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: conic-gradient(from 140deg, var(--aa-cyan), var(--aa-blue), var(--aa-purple), var(--aa-cyan));
  display: grid; place-items: center; position: relative; box-shadow: 0 0 14px rgba(34,211,238,.5); }
.aa-fab-wave svg { width: 16px; height: 16px; filter: drop-shadow(0 0 4px #fff); }
.aa-fab-wave:after { content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid rgba(34,211,238,.5); animation: aa-ring 2.2s infinite; }
.aa-fab-wave.listening { background: linear-gradient(135deg, #fb7185, #ef4444); box-shadow: 0 0 16px rgba(239,68,68,.55); }
.aa-fab-wave.listening:after { border-color: rgba(239,68,68,.5); animation-duration: 1.1s; }
.aa-fab-wave.speaking { background: linear-gradient(135deg, #a78bfa, #8b5cf6); box-shadow: 0 0 16px rgba(139,92,246,.55); }
.aa-fab-wave.speaking:after { border-color: rgba(139,92,246,.5); animation-duration: 1.6s; }
.aa-fab-wave.idle { background: linear-gradient(135deg, #38bdf8, #6366f1); }
.aa-fab-wave.idle:after { display: none; }
@keyframes aa-ring { 0%{transform:scale(.9);opacity:.8} 100%{transform:scale(1.35);opacity:0} }
.aa-fab-tx { text-align: left; line-height: 1.35; }
.aa-fab-tx b { font-size: 13px; display: block; letter-spacing: .4px; }
.aa-fab-tx small { font-size: 11px; color: #9fc5e8; }
.aa-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.aa-dot.g{background:#4ade80;box-shadow:0 0 8px #4ade80}.aa-dot.r{background:#f87171;box-shadow:0 0 8px #f87171}
.aa-dot.v{background:#c4b5fd;box-shadow:0 0 8px #c4b5fd}.aa-dot.gray{background:#94a3b8}

/* 全屏面板：深空底色 + 网格点阵 + 扫描光带 */
.aa-mask { position: fixed; inset: 0; background: rgba(2,6,16,.5); opacity: 0;
  pointer-events: none !important; transition: opacity .25s; }
/* 全屏面板已覆盖整个视口，遮罩不再承担点击关闭职责（用头部 × 关闭） */
.aa-mask.on { opacity: 0; pointer-events: none !important; }
.aa-panel { position: fixed; inset: 0; width: auto;
  height: 100vh; height: 100dvh; max-height: none;
  color: var(--aa-text); border: 0; border-radius: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% -8%, rgba(34,211,238,.18), transparent 65%),
    radial-gradient(ellipse 55% 40% at 100% 102%, rgba(168,85,247,.14), transparent 62%),
    linear-gradient(180deg, #070c1a 0%, #060a15 55%, #040711 100%);
  box-shadow: inset 0 0 0 1px rgba(34,211,238,.14), inset 0 0 80px rgba(34,211,238,.045);
  display: none; flex-direction: column; overflow: hidden; }
.aa-panel.on { display: flex; }
.aa-panel > * { position: relative; z-index: 1; }
.aa-panel:before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(34,211,238,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,211,238,.055) 1px, transparent 1px),
    radial-gradient(circle, rgba(125,211,252,.24) .8px, transparent 1.2px);
  background-size: 46px 46px, 46px 46px, 23px 23px;
  background-position: 0 0, 0 0, 11px 11px; }
.aa-panel:after { content: ""; position: absolute; left: 0; right: 0; top: -35%; height: 35%; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(34,211,238,.06), transparent);
  animation: aa-scanline 9s linear infinite; }
@keyframes aa-scanline { 0%{transform:translateY(0)} 100%{transform:translateY(400%)} }

.aa-head { padding: 13px 20px; padding-top: calc(13px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--aa-line); display: flex; align-items: center; gap: 8px; flex: none;
  background: linear-gradient(180deg, rgba(12,22,46,.9), rgba(8,14,32,.6));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.aa-title { font-weight: 700; font-size: 15px; letter-spacing: .6px; color: #f0fbff;
  text-shadow: 0 0 14px rgba(34,211,238,.45); display: flex; align-items: center; }
.aa-title:before { content: ""; width: 16px; height: 16px; margin-right: 10px; border-radius: 4px;
  border: 2px solid var(--aa-cyan); background: radial-gradient(circle, rgba(168,85,247,.95) 0 2px, transparent 2.5px),
    linear-gradient(135deg, rgba(34,211,238,.25), rgba(59,130,246,.25));
  box-shadow: 0 0 12px rgba(34,211,238,.55), inset 0 0 8px rgba(34,211,238,.35); }
.aa-sub { font-size: 11px; color: var(--aa-muted); margin-top: 3px; }
.aa-sub .dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; display: inline-block; margin-right: 4px;
  box-shadow: 0 0 8px #4ade80; }
.aa-x { margin-left: auto; border: 1px solid transparent; background: transparent; color: var(--aa-muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 6px 10px; border-radius: 8px; transition: all .2s; }
.aa-x:hover { color: #fff; border-color: rgba(34,211,238,.4); background: rgba(34,211,238,.08);
  text-shadow: 0 0 12px rgba(34,211,238,.8); }
.aa-mode { display: flex; gap: 8px; padding: 12px 20px 0; flex: none; }
.aa-mode button { border: 1px solid rgba(34,211,238,.16); background: rgba(10,18,38,.6); border-radius: 9px;
  padding: 8px 14px; font-size: 12px; color: var(--aa-muted); flex: 1; transition: all .2s; }
.aa-mode button:hover { border-color: rgba(34,211,238,.42); color: #dff8ff; }
.aa-mode button.on { background: linear-gradient(135deg, rgba(34,211,238,.22), rgba(99,102,241,.28));
  border-color: rgba(34,211,238,.55); color: #eaffff; font-weight: 600;
  box-shadow: 0 0 18px rgba(34,211,238,.22), inset 0 0 14px rgba(34,211,238,.1); text-shadow: 0 0 8px rgba(34,211,238,.5); }

/* 语音通话态：能量核心 + 旋转扫描环 + 呼吸光晕，全屏下占满剩余空间 */
.aa-stage { display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, rgba(34,211,238,.13) 0%, rgba(6,10,22,0) 58%);
  padding: 22px 16px; flex: 1; min-height: 0; }
.aa-orb-wrap { position: relative; width: 168px; height: 168px; display: grid; place-items: center; }
.aa-orb-wrap:before { content: ""; position: absolute; width: 168px; height: 168px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 68%, rgba(34,211,238,.75) 86%, transparent 100%);
  -webkit-mask: radial-gradient(transparent 62%, #000 64%); mask: radial-gradient(transparent 62%, #000 64%);
  animation: aa-spin 6s linear infinite; }
@keyframes aa-spin { to { transform: rotate(360deg); } }
.aa-orb-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(34,211,238,.35);
  width: 128px; height: 128px; box-shadow: 0 0 18px rgba(34,211,238,.18), inset 0 0 18px rgba(34,211,238,.1);
  animation: aa-ring2 3s infinite; }
.aa-orb-ring.r2 { animation-delay: 1s; width: 152px; height: 152px;
  border-color: rgba(168,85,247,.3); box-shadow: 0 0 20px rgba(168,85,247,.16); }
@keyframes aa-ring2 { 0%{transform:scale(.86);opacity:.7} 100%{transform:scale(1.06);opacity:0} }
.aa-orb { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; color: #fff; position: relative;
  background: conic-gradient(from 140deg, var(--aa-cyan), var(--aa-blue), var(--aa-purple), var(--aa-cyan));
  box-shadow: 0 0 30px rgba(34,211,238,.45), 0 0 70px rgba(59,130,246,.28), inset 0 0 20px rgba(255,255,255,.25);
  animation: aa-breathe 3.2s ease-in-out infinite; }
.aa-orb:before { content: ""; position: absolute; inset: 6px; border-radius: 50%;
  background: linear-gradient(160deg, rgba(6,12,28,.2), rgba(6,12,28,.75)); }
@keyframes aa-breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.045)} }
.aa-orb svg { width: 42px; height: 42px; position: relative; z-index: 1; filter: drop-shadow(0 0 6px rgba(255,255,255,.85)); }
.aa-orb.listening { background: conic-gradient(from 140deg, #fb7185, #ef4444, #f97316, #fb7185);
  box-shadow: 0 0 34px rgba(239,68,68,.5), 0 0 80px rgba(239,68,68,.25); }
.aa-orb.speaking { background: conic-gradient(from 140deg, #a78bfa, #8b5cf6, #22d3ee, #a78bfa);
  box-shadow: 0 0 34px rgba(139,92,246,.5), 0 0 80px rgba(168,85,247,.25); }
.aa-orb.idle { background: conic-gradient(from 140deg, #38bdf8, #6366f1, #a855f7, #38bdf8); }
.aa-wave { display: flex; gap: 3px; height: 20px; align-items: center; margin-top: 4px; }
.aa-wave i { width: 3px; height: 5px; border-radius: 3px; background: var(--aa-cyan);
  box-shadow: 0 0 8px rgba(34,211,238,.8); opacity: .45; }
.aa-wave.live i { animation: aa-w .9s infinite ease-in-out; opacity: 1; }
.aa-wave.live i:nth-child(2){animation-delay:.1s}.aa-wave.live i:nth-child(3){animation-delay:.2s}
.aa-wave.live i:nth-child(4){animation-delay:.3s}.aa-wave.live i:nth-child(5){animation-delay:.4s}
.aa-wave.live i:nth-child(6){animation-delay:.5s}.aa-wave.live i:nth-child(7){animation-delay:.15s}
@keyframes aa-w { 0%,100%{height:5px} 50%{height:20px} }
.aa-st-title { font-size: 18px; font-weight: 700; margin-top: 12px; color: #f0fbff; letter-spacing: 1px;
  text-shadow: 0 0 16px rgba(34,211,238,.5); }
.aa-st-sub { font-size: 11px; color: #a8c4e6; margin-top: 5px; text-align: center; padding: 0 18px; line-height: 1.5; }
.aa-ctx { margin-top: 10px; font-size: 10px; color: #8fd8ee; background: rgba(34,211,238,.07);
  border: 1px solid rgba(34,211,238,.22); border-radius: 999px; padding: 5px 12px; max-width: 100%;
  box-shadow: inset 0 0 14px rgba(34,211,238,.08);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa-tool-card { margin-top: 10px; max-width: 92%; font-size: 10px; color: #a8c4e6;
  background: rgba(12,22,46,.6); border: 1px solid rgba(34,211,238,.2); border-left: 3px solid var(--aa-cyan);
  border-radius: 8px; padding: 7px 10px; text-align: left; box-shadow: 0 4px 18px rgba(0,0,0,.25); }
.aa-tool-card b { color: #67e8f9; }

.aa-foot { border-top: 1px solid var(--aa-line); padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  flex: none; background: linear-gradient(0deg, rgba(7,12,26,.96), rgba(8,14,32,.65));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.aa-mic { width: 52px; height: 52px; border-radius: 50%; border: 0; color: #fff; display: grid; place-items: center;
  margin: 0 auto; background: conic-gradient(from 140deg, var(--aa-cyan), var(--aa-blue), var(--aa-purple), var(--aa-cyan));
  box-shadow: 0 0 0 4px rgba(34,211,238,.1), 0 0 24px rgba(34,211,238,.45); }
.aa-mic svg { width: 22px; height: 22px; filter: drop-shadow(0 0 5px #fff); }
.aa-mic.listening { background: linear-gradient(135deg, #fb7185, #ef4444);
  box-shadow: 0 0 0 7px rgba(239,68,68,.15), 0 0 30px rgba(239,68,68,.5); }
.aa-mic:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.aa-acts { display: flex; justify-content: center; gap: 14px; margin-top: 11px; }
.aa-acts button { border: 0; background: transparent; color: var(--aa-muted); font-size: 11px; cursor: pointer; }
.aa-acts button:hover { color: #67e8f9; text-shadow: 0 0 10px rgba(34,211,238,.5); }

/* 文字对话态：霓虹气泡 + 深玻璃消息面，占满剩余高度 */
.aa-chat { display: none; flex: 1; min-height: 0; flex-direction: column; }
.aa-chat.on { display: flex; }
.aa-msg-list { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.aa-msg-list::-webkit-scrollbar { width: 6px; }
.aa-msg-list::-webkit-scrollbar-track { background: rgba(34,211,238,.04); }
.aa-msg-list::-webkit-scrollbar-thumb { background: rgba(34,211,238,.3); border-radius: 6px; }
.aa-msg { max-width: min(760px, 88%); padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.65; word-break: break-word; }
.aa-msg.user { align-self: flex-end; background: linear-gradient(135deg, #0891b2, #2563eb 60%, #6d28d9);
  color: #fff; border: 1px solid rgba(125,211,252,.35); border-bottom-right-radius: 3px;
  box-shadow: 0 4px 18px rgba(34,211,238,.25), inset 0 0 14px rgba(255,255,255,.08); }
.aa-msg.assistant { align-self: flex-start; background: linear-gradient(135deg, rgba(18,32,62,.88), rgba(12,20,42,.82));
  color: #e6f1ff; border: 1px solid rgba(34,211,238,.2); border-bottom-left-radius: 3px;
  box-shadow: 0 4px 18px rgba(0,0,0,.25); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.aa-msg.tool { align-self: flex-start; background: rgba(10,18,38,.6);
  border: 1px dashed rgba(168,85,247,.35); color: #b9a6e8; font-size: 11px; }
.aa-msg.interrupted { opacity: .55; text-decoration: line-through; }
.aa-typing { align-self: flex-start; color: var(--aa-muted); font-size: 12px; }
.aa-input-row { display: flex; gap: 8px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(34,211,238,.18); flex: none;
  background: linear-gradient(0deg, rgba(7,12,26,.96), rgba(8,14,32,.6));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.aa-input-row textarea { flex: 1; resize: none; height: 40px; max-height: 120px;
  border: 1px solid rgba(34,211,238,.22); border-radius: 10px; padding: 9px 10px;
  font-size: 13px; line-height: 1.4; color: #e6f1ff; background: rgba(6,12,26,.75); }
.aa-input-row textarea::placeholder { color: #6f88ac; }
.aa-input-row textarea:focus { outline: none; border-color: rgba(34,211,238,.65);
  box-shadow: 0 0 0 3px rgba(34,211,238,.1), 0 0 16px rgba(34,211,238,.18); }
.aa-input-row button { border: 1px solid rgba(125,211,252,.4); border-radius: 10px;
  background: linear-gradient(135deg, #06b6d4, #3b82f6 55%, #7c3aed); color: #fff;
  padding: 0 18px; font-size: 13px; font-weight: 600; box-shadow: 0 0 18px rgba(34,211,238,.35); }
.aa-input-row button:disabled { opacity: .5; }

/* P1.1 唤醒：PTT 按键说话态 */
.aa-mic.ptt { background: linear-gradient(135deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 0 4px rgba(245,158,11,.18), 0 0 26px rgba(245,158,11,.45); }
.aa-mic.ptt:before { content: "按住"; position: absolute; font-size: 9px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.aa-mic.ptt svg { opacity: .35; }

@media (max-width: 767px) {
  .aa-panel { inset: 0; width: auto;
    height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .aa-fab { right: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .aa-head { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .aa-title { font-size: 14px; }
  .aa-title:before { width: 14px; height: 14px; margin-right: 8px; }
  .aa-sub { font-size: 10px; }
  .aa-x { font-size: 24px; padding: 4px 8px; }
  .aa-mode { gap: 6px; padding: 10px 14px 0; }
  .aa-mode button { padding: 9px 10px; font-size: 12px; }
  .aa-stage { padding: 12px; }
  .aa-orb-wrap { transform: scale(.85); margin: -6px 0; }
  .aa-st-title { font-size: 16px; }
  .aa-st-sub { font-size: 11px; }
  .aa-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .aa-mic { width: 48px; height: 48px; }
  .aa-msg-list { padding: 12px 14px; gap: 10px; }
  .aa-msg { max-width: 92%; font-size: 13px; }
  .aa-input-row { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .aa-input-row textarea { height: 40px; font-size: 16px; } /* iOS 防自动缩放 */
  .aa-input-row button { padding: 0 14px; font-size: 14px; }
}

/* 移动端横屏：压缩通话态视觉，保证底部操作区可见 */
@media (max-height: 480px) and (orientation: landscape) {
  .aa-orb-wrap { transform: scale(.6); margin: -18px 0; }
  .aa-st-title { margin-top: 4px; }
  .aa-stage { padding: 6px 12px; }
}

/* 手机端禁止缩放：iOS Safari 聚焦字号 <16px 的输入框会自动放大整页，统一提到 16px */
@media (max-width: 767px) {
  input, select, textarea { font-size: 16px !important; }
  /* 已知显式小字号控件同步取消，避免 -webkit-text-size-adjust 二次放大 */
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  .todo-owner-filter.filter-select,
  .trend-controls .filter-select,
  .aa-input-row textarea,
  .follow-panel input[type="date"],
  .dialog.user-form-dialog .field > select,
  .dialog.sample-form-dialog .field > select,
  .dialog.sample-form-dialog .field textarea,
  .record-form-dialog [data-field="content"] textarea { font-size: 16px !important; }
}

/* 尊重系统“减少动态效果”偏好 */
@media (prefers-reduced-motion: reduce) {
  .aa-panel:after, .aa-orb-wrap:before, .aa-orb, .aa-orb-ring,
  .aa-fab-wave:after, .aa-wave.live i { animation: none !important; }
}
