/* ====== WeChat CRM Styles ====== */
:root {
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --primary-bg: #EFF6FF;
  --sidebar-bg: #f8fafc;
  --sidebar-active: #EFF6FF;
  --sidebar-text: #475569;
  --sidebar-active-text: #2563EB;
  --border: #E2E8F0;
  --bg-card: #ffffff;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --info: #3B82F6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --transition: all 0.2s ease;
}

/* ====== Reset ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: #f1f5f9;
  -webkit-font-smoothing: antialiased;
}

/* ====== Sidebar ====== */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon-box {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.logo-ver {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Navigation */
.nav-list {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--sidebar-text);
  transition: var(--transition);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}

.nav-item.active {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

.nav-icon { width: 20px; text-align: center; font-size: 16px; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* ====== Main Content ====== */
.main-content {
  flex: 1;
  margin-left: 220px;
  height: 100vh;
  overflow-y: auto;
  background: #f1f5f9;
}

.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-size: 14px;
  gap: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ====== Page Header ====== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 32px 0;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-title .count {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 6px;
}

/* ====== Buttons ====== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,0.2);
}
.btn-primary:hover { background: #1d4ed8; transform: translateY(-0.5px); box-shadow: 0 2px 6px rgba(37,99,235,0.3); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger {
  background: #dc2626;
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 6px; }

/* ====== Search Bar ====== */
.search-bar-wrapper {
  position: relative;
  margin: 16px 32px 0;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
  color: var(--text-primary);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.search-input::placeholder { color: var(--text-muted); }

/* ====== Tag Filter ====== */
.tag-filter-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 14px 32px 0;
  flex-wrap: wrap;
}

.tag-filter {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  transition: var(--transition);
  user-select: none;
}

.tag-filter:hover { border-color: var(--primary-light); color: var(--primary); }
.tag-filter.active { background: #2563eb; color: #fff; border-color: #2563eb; }

.tag-manage-link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
}
.tag-manage-link:hover { text-decoration: underline; }

/* ====== Customer Grid ====== */
.customer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 14px 32px;
}

.customer-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.customer-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 4px 12px rgba(37,99,235,0.08);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.card-info { flex: 1; min-width: 0; }

.card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-company {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #059669; }
.badge-yellow { background: #fef3c7; color: #d97706; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-teal { background: #ccfbf1; color: #0f766e; }
.badge-gray { background: #f1f5f9; color: #64748b; }

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.status-badge .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-badge.badge-blue { background: #eef2ff; color: #1d4ed8; }
.status-badge.badge-blue .status-dot { background: #2563eb; }
.status-badge.badge-green { background: #ecfdf5; color: #059669; }
.status-badge.badge-green .status-dot { background: #10b981; }
.status-badge.badge-yellow { background: #fffbeb; color: #d97706; }
.status-badge.badge-yellow .status-dot { background: #f59e0b; }
.status-badge.badge-purple { background: #f5f3ff; color: #7c3aed; }
.status-badge.badge-purple .status-dot { background: #7c3aed; }
.status-badge.badge-teal { background: #f0fdfa; color: #0f766e; }
.status-badge.badge-teal .status-dot { background: #14b8a6; }
.status-badge.badge-gray { background: #f8fafc; color: #64748b; }
.status-badge.badge-gray .status-dot { background: #94a3b8; }

.card-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* ====== Pagination ====== */
.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 32px 28px;
  gap: 4px;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  color: var(--text-secondary);
  transition: var(--transition);
  font-family: inherit;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

.page-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

/* ====== Modal ====== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal-content {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: #f1f5f9; color: var(--text-primary); }

.modal-body { padding: 20px 24px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.confirm-box {
  max-width: 400px;
  text-align: center;
}
.confirm-box h3 { font-size: 17px; margin-bottom: 8px; }
.confirm-box p { color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
.confirm-box .modal-actions { justify-content: center; padding-top: 20px; }

/* ====== Forms ====== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .col-span-2 { grid-column: span 2; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  background: #fff;
  font-family: inherit;
  color: var(--text-primary);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 60px;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.tag-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.tag-checkbox:hover { border-color: var(--primary-light); }
.tag-checkbox:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.tag-checkbox input { display: none; }

/* ====== Toast ====== */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  animation: toastIn 0.25s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toast-success { background: #ecfdf5; color: #065f46; border: 1px solid #d1fae5; }
.toast-error { background: #fef2f2; color: #991b1b; border: 1px solid #fee2e2; }
.toast-warning { background: #fffbeb; color: #92400e; border: 1px solid #fef3c7; }
.toast-info { background: #eff6ff; color: #1e40af; border: 1px solid #dbeafe; }

.toast-hide { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

/* ====== Customer Detail ====== */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px 0;
}

.customer-info-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 16px 32px;
  padding: 20px;
}

.info-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.info-text { flex: 1; }
.info-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.info-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.info-item { font-size: 13px; color: var(--text-primary); }
.info-item.col-span-2 { grid-column: span 2; }

.info-label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

/* ====== Tabs ====== */
.detail-tabs {
  display: flex;
  gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  font-family: inherit;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content-header {
  display: flex;
  justify-content: flex-end;
  padding: 14px 32px;
}

/* ====== Timeline ====== */
.timeline {
  padding: 0 32px 32px;
}

.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #dbeafe;
  flex-shrink: 0;
  margin-top: 3px;
}

.timeline-body {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.timeline-time { font-size: 11px; color: var(--text-muted); }

.timeline-content {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.timeline-next {
  font-size: 12px;
  color: #d97706;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

/* ====== Reminder ====== */
.reminder-list { padding: 0 32px 32px; }

.reminder-item, .reminder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}

.reminder-card { padding: 14px 16px; }

/* ====== Templates ====== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 0 32px 32px;
}

.template-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.template-cat { margin-bottom: 8px; display: inline-block; }

.template-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.template-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.template-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ====== Settings ====== */
.settings-section {
  padding: 0 32px;
  margin-bottom: 8px;
}

.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

kbd {
  padding: 3px 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}

/* ====== Responsive tweaks ====== */
@media (max-width: 1100px) {
  .customer-grid { grid-template-columns: repeat(2, 1fr); }
  .template-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .customer-grid { grid-template-columns: 1fr; }
  .sidebar { width: 60px; min-width: 60px; }
  .sidebar .logo-text, .sidebar .nav-item span:not(.nav-icon), .sidebar-footer, .logo-ver { display: none; }
  .main-content { margin-left: 60px; }
  .page-header, .search-bar-wrapper, .tag-filter-row, .customer-grid, .pagination-bar { padding-left: 16px; padding-right: 16px; }
}

/* ===== 客户档案 (2026-08-20) ===== */
.lvl-A { display:inline-block; width:22px; height:22px; border-radius:50%; background:#fef3c7; color:#b45309; text-align:center; line-height:22px; font-size:12px; font-weight:700; }
.lvl-B { display:inline-block; width:22px; height:22px; border-radius:50%; background:#dbeafe; color:#1d4ed8; text-align:center; line-height:22px; font-size:12px; font-weight:700; }
.lvl-C { display:inline-block; width:22px; height:22px; border-radius:50%; background:#dcfce7; color:#16a34a; text-align:center; line-height:22px; font-size:12px; font-weight:700; }
.lvl-D { display:inline-block; width:22px; height:22px; border-radius:50%; background:#f1f5f9; color:#64748b; text-align:center; line-height:22px; font-size:12px; font-weight:700; }
.lvl-E { display:inline-block; width:22px; height:22px; border-radius:50%; background:#ffedd5; color:#c2410c; text-align:center; line-height:22px; font-size:12px; font-weight:700; }
.lvl-其他 { display:inline-block; width:22px; height:22px; border-radius:50%; background:#f3e8ff; color:#7c3aed; text-align:center; line-height:22px; font-size:12px; font-weight:700; }
.lvl- { display:inline-block; width:22px; height:22px; border-radius:50%; background:#f8fafc; color:#cbd5e1; text-align:center; line-height:22px; font-size:12px; }
.sales-tag { display:inline-block; font-size:11px; padding:2px 9px; border-radius:10px; margin-right:4px; }
.sales-刘桂侠 { background:#eff6ff; color:#1d4ed8; }
.sales-刘苒娟 { background:#fdf2f8; color:#db2777; }
.sales- { background:#f1f5f9; color:#94a3b8; }
.arch-dl { display:flex; font-size:13px; padding:7px 0; border-bottom:1px dashed #f1f5f9; }
.arch-dl .k { width: 80px; color:#94a3b8; flex-shrink:0; }
.arch-dl span:last-child { color:#334155; line-height:1.6; }

/* ============================================================
   手机适配 (2026-08-29) — 手机窄屏自动切换样式, PC 宽屏完全不变
   ============================================================ */

/* 移动端顶部栏 (默认隐藏, 手机显示) */
.m-topbar { display: none; }
.sidebar-mask { display: none; }
.m-tabbar { display: none; }
.m-more-nav { display: none; }

@media (max-width: 768px) {
  /* ---------- 移动端顶部栏 ---------- */
  .m-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 50px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    padding: 0 12px;
    z-index: 950;
    box-shadow: 0 2px 10px rgba(37,99,235,.35);
  }
  .m-topbar .m-menu-btn {
    width: 36px; height: 36px;
    border: none; border-radius: 10px;
    background: rgba(255,255,255,.18);
    color: #fff; font-size: 19px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
  }
  .m-topbar .m-title {
    flex: 1; font-size: 16px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .m-topbar .m-user {
    font-size: 12px; background: rgba(255,255,255,.2);
    padding: 4px 10px; border-radius: 20px; white-space: nowrap;
  }

  /* ---------- 侧边栏 → 抽屉菜单 ---------- */
  .sidebar {
    width: 265px !important;
    min-width: 265px !important;
    transform: translateX(-100%);
    transition: transform .28s ease;
    z-index: 1000;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
    height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }
  /* 恢复抽屉内文字显示 (覆盖旧 700px 断点隐藏规则) */
  .sidebar .logo-text,
  .sidebar .nav-item span:not(.nav-icon),
  .sidebar-footer, .logo-ver { display: block; }
  .sidebar .nav-item span:not(.nav-icon) { display: inline; }
  .sidebar .nav-item { padding: 12px 16px; font-size: 15px; }
  .sidebar .nav-icon { width: 26px; font-size: 18px; }

  /* 遮罩 */
  .sidebar-mask {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.55);
    z-index: 960;
    opacity: 0; visibility: hidden;
    transition: opacity .28s ease;
  }
  .sidebar-mask.open { opacity: 1; visibility: visible; }

  /* 主内容区: 全宽 + 顶部栏占位 */
  .main-content {
    margin-left: 0 !important;
    padding-top: 50px;
    padding-bottom: 58px; /* 底部导航占位 */
  }

  /* ---------- 页面头部/筛选/搜索 收窄 ---------- */
  .page-header, .search-bar-wrapper, .tag-filter-row, .customer-grid, .pagination-bar,
  .detail-header, .customer-info-card {
    padding-left: 12px !important;
    padding-right: 12px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .page-header { padding-top: 14px !important; flex-wrap: wrap; gap: 8px; }
  .page-header .btn { min-height: 40px; }
  .search-bar-wrapper { margin-top: 10px !important; }
  .search-input { padding: 12px 14px 12px 40px; font-size: 15px; border-radius: 12px; }
  .tag-filter-row { padding-top: 10px !important; }
  .tag-filter { padding: 8px 16px; font-size: 13px; }

  /* 筛选行: 控件换行堆叠 */
  .page-header + div[style*="display:flex"] { flex-wrap: wrap; }
  .page-header + div[style*="display:flex"] .form-input,
  .page-header + div[style*="display:flex"] select { width: 100% !important; margin-bottom: 6px; min-height: 42px; font-size: 15px; }
  .page-header + div[style*="display:flex"] .btn { min-height: 42px; flex: 1; }
  /* 客户档案筛选行: 控件全宽堆叠 */
  #arch-filter-row { padding-left: 12px !important; padding-right: 12px !important; }
  #arch-filter-row .form-input, #arch-filter-row select { width: 100% !important; margin-bottom: 6px; min-height: 42px; font-size: 15px; }
  #arch-filter-row .btn { min-height: 42px; flex: 1; }
  #arch-filter-row input#arch-q { width: 100% !important; }

  /* 统计卡: 两列网格 */
  #arch-stats { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; padding: 10px 12px 0 !important; }

  /* ---------- 表格: 横向滑动容器 ---------- */
  .main-content table { min-width: 0 !important; }
  .main-content [style*="overflow:auto"] { -webkit-overflow-scrolling: touch; }

  /* ---------- 按钮 ---------- */
  .btn { min-height: 40px; padding: 9px 18px; font-size: 14px; }
  .btn-sm { min-height: 36px; padding: 7px 14px; }
  .btn-xs { min-height: 32px; }

  /* ---------- 弹窗: 底部弹出全屏化 ---------- */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-content {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
  }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 16px 18px; }
  .modal-actions { padding: 14px 18px; }
  .modal-actions .btn { flex: 1; justify-content: center; }

  /* 表单: 单列 + 大控件 */
  .form-grid { grid-template-columns: 1fr !important; }
  .form-grid .col-span-2 { grid-column: span 1 !important; }
  .form-input { min-height: 44px; font-size: 15px; }

  /* ---------- 底部导航 ---------- */
  .m-tabbar {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 56px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    z-index: 940;
    box-shadow: 0 -2px 10px rgba(0,0,0,.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .m-tabbar .mtb {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px;
    border: none; background: none;
    font-size: 11px; color: #94a3b8;
    cursor: pointer; font-family: inherit;
    padding: 4px 0;
  }
  .m-tabbar .mtb .ic { font-size: 20px; line-height: 1; }
  .m-tabbar .mtb.active { color: #2563eb; font-weight: 600; }

  /* 抽屉内"更多菜单"入口 */
  .m-more-nav { display: block; }
}

/* ---------- 客户档案手机卡片 (2026-08-29) ---------- */
#arch-cards-mobile { display: none; }
@media (max-width: 768px) {
  #arch-cards-mobile { display: none; }
}
.arch-m-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  cursor: pointer;
  transition: box-shadow .2s;
}
.arch-m-card:active { box-shadow: 0 2px 8px rgba(37,99,235,.12); }
.arch-m-card .r1 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; gap: 8px; }
.arch-m-card .nm { font-size: 15px; font-weight: 600; color: #0f172a; display: flex; align-items: center; gap: 6px; min-width: 0; }
.arch-m-card .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arch-m-card .co { font-size: 12px; color: #2563eb; background: #eff6ff; padding: 2px 8px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.arch-m-card .r2 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.arch-m-card .fu { font-size: 12px; color: #94a3b8; }
.arch-m-card .fu.old { color: #dc2626; }
.arch-m-card .r3 { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed #f1f5f9; padding-top: 8px; }
.arch-m-card .ph { font-size: 13px; color: #475569; }
.arch-m-card .ops { display: flex; gap: 8px; }
.arch-m-card .ops button {
  min-width: 34px; height: 34px;
  border-radius: 9px; border: 1px solid #e2e8f0; background: #fff;
  font-size: 14px; cursor: pointer;
}

/* ============================================================
   替代 Tailwind CDN 的工具类 (2026-08-29 提速: 移除国外 CDN 依赖)
   覆盖 index.html 中全部 41 个 tailwind 风格类
   ============================================================ */
.flex { display: flex; }
.flex-1 { flex: 1; }
.h-screen { height: 100vh; }
.hidden { display: none; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mr-1 { margin-right: 4px; }
.pt-2 { padding-top: 8px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.py-12 { padding-top: 48px; padding-bottom: 48px; }
.py-16 { padding-top: 64px; padding-bottom: 64px; }
.border-t { border-top: 1px solid #f1f5f9; }
.border-slate-100 { border-color: #f1f5f9; }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.opacity-60 { opacity: 0.6; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-5xl { font-size: 48px; }
.text-[11px] { font-size: 11px; }
.text-[13px] { font-size: 13px; }
.text-[#dc2626] { color: #dc2626; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-800 { color: #1e293b; }
