/* ============================================
   CRM System — Apple Design System
   ============================================ */

:root {
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --link-blue: #0066cc;
  --link-dark: #2997ff;
  --bg-light: #f5f5f7;
  --bg-white: #ffffff;
  --bg-dark: #000000;
  --text-primary: #1d1d1f;
  --text-secondary: rgba(0,0,0,0.8);
  --text-tertiary: rgba(0,0,0,0.48);
  --text-white: #ffffff;
  --text-white-secondary: rgba(255,255,255,0.8);
  --border-light: rgba(0,0,0,0.06);
  --border-medium: rgba(0,0,0,0.1);
  --shadow-card: rgba(0,0,0,0.04) 0px 1px 3px, rgba(0,0,0,0.04) 0px 4px 12px;
  --shadow-elevated: rgba(0,0,0,0.22) 3px 5px 30px 0px;
  --sidebar-width: 220px;
  --topbar-height: 48px;
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 11px;
  --radius-xl: 12px;
  --radius-pill: 980px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--text-primary);
  background: var(--bg-light);
  -webkit-font-smoothing: antialiased;
}

/* ========== TOP NAV (Glass) ========== */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: rgba(29,29,31,0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.top-nav .brand {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-white);
  letter-spacing: -0.28px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav .brand-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

/* 品牌图标 — 兼容文字图标和图片图标 */
.top-nav .brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  font-size: 16px;
  color: var(--blue);
}

.top-nav .brand-icon img,
.top-nav .brand-icon.brand-icon-img {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  object-fit: contain;
}

.top-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-nav .user-name {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-white-secondary);
  letter-spacing: -0.224px;
}

.top-nav .user-role {
  font-size: 11px;
  font-weight: 500;
  color: var(--blue);
  letter-spacing: -0.12px;
  background: rgba(0,113,227,0.15);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.top-nav .btn-logout {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-white-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  letter-spacing: -0.224px;
  transition: color 0.15s;
}

.top-nav .btn-logout:hover { color: var(--text-white); }

/* ========== SIDEBAR ========== */
.admin-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar-height);
}

.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border-light);
  padding: 20px 0;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 8px 6px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.224px;
  transition: background 0.12s;
  margin-bottom: 2px;
}

.sidebar a:hover { background: rgba(0,0,0,0.04); }

.sidebar a.active {
  background: rgba(0,113,227,0.08);
  color: var(--blue);
  font-weight: 500;
}

.sidebar a .icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
}

.main-content-full {
  flex: 1;
  padding: 32px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.page-heading {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.28px;
  line-height: 1.14;
  margin-bottom: 24px;
}

/* ========== STAT CARDS ========== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.2s;
}

a.stat-card:hover { box-shadow: var(--shadow-elevated); }

.stat-card .stat-value {
  font-size: 34px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.28px;
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: -0.224px;
  margin-top: 4px;
}

/* ========== CARDS & PANELS ========== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
  overflow: hidden;
}

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

.card-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.374px;
}

.card-body {
  padding: 20px 24px;
}

.card-body.no-padding { padding: 0; }

/* ========== TABLE ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  letter-spacing: -0.224px;
}

.data-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr { transition: background 0.1s; }

.data-table tbody tr:hover { background: rgba(0,0,0,0.015); }

/* ========== TAG ========== */
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: -0.12px;
  margin: 1px 3px;
  background: rgba(0,113,227,0.08);
  color: var(--blue);
}

.tag-green { background: rgba(52,199,89,0.1); color: #34c759; }
.tag-orange { background: rgba(255,149,0,0.1); color: #ff9500; }
.tag-red { background: rgba(255,59,48,0.1); color: #ff3b30; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.224px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.3;
}

.btn-primary {
  background: var(--blue);
  color: var(--text-white);
}

.btn-primary:hover { background: var(--blue-hover); }

.btn-secondary {
  background: #e8e8ed;
  color: var(--text-primary);
}

.btn-secondary:hover { background: #dcdce2; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--blue);
  color: var(--blue);
}

.btn-outline:hover { background: rgba(0,113,227,0.06); }

.btn-danger {
  background: #ff3b30;
  color: var(--text-white);
}

.btn-danger:hover { background: #e0352b; }

.btn-sm {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
}

.btn-xs {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}

.btn-pill {
  border-radius: var(--radius-pill);
  padding: 6px 18px;
  font-size: 14px;
  border: 1px solid var(--blue);
  color: var(--blue);
  background: transparent;
}

.btn-pill:hover {
  background: rgba(0,113,227,0.06);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========== FORM ========== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.224px;
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  letter-spacing: -0.224px;
  color: var(--text-primary);
  background: var(--bg-white);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}

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

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: -0.12px;
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-row .form-group { margin-bottom: 0; }

/* ========== TOOLBAR ========== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-left {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out, visibility 0.25s ease-out;
}

.modal-overlay.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  width: 520px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
  transform: translateY(-12px) scale(0.96);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.22s ease-out;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal h2 {
  font-size: 21px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.28px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ========== ALERT ========== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  letter-spacing: -0.224px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(255,59,48,0.08);
  color: #ff3b30;
}

.alert-success {
  background: rgba(52,199,89,0.08);
  color: #34c759;
}

/* ========== PAGINATION ========== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.pagination a,
.pagination span {
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-primary);
  letter-spacing: -0.224px;
  transition: background 0.12s;
}

.pagination a:hover { background: rgba(0,0,0,0.05); }

.pagination .current {
  background: var(--blue);
  color: var(--text-white);
}

/* ========== CUSTOMER DETAIL ========== */
.detail-layout {
  display: flex;
  gap: 24px;
}

.detail-main {
  flex: 1;
  min-width: 0;
}

.detail-sidebar {
  width: 380px;
  flex-shrink: 0;
}

/* ========== TIMELINE ========== */
.timeline-item {
  position: relative;
  padding-left: 28px;
  padding-bottom: 24px;
  border-left: 1.5px solid rgba(0,0,0,0.08);
}

.timeline-item:last-child { border-left-color: transparent; }

.timeline-item .dot {
  position: absolute;
  left: -5px; top: 4px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}

.timeline-item .time {
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: -0.12px;
  margin-bottom: 4px;
}

.timeline-item .content {
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: -0.224px;
  line-height: 1.5;
}

.timeline-item .tag-change {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  letter-spacing: -0.12px;
}

/* ---- Timeline delete button ---- */
.timeline-delete {
  position: absolute;
  top: 2px;
  right: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease-out, color 0.15s, background 0.15s;
  padding: 0;
}
.timeline-item:hover .timeline-delete { opacity: 1; }
.timeline-delete:hover {
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.08);
}

.timeline-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ========== AI CHAT ========== */
.ai-chat {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
}

.ai-chat .chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.28px;
}

/* ========== DROPDOWN ========== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown .dropdown-menu {
  display: none !important;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  z-index: 999;
  overflow: hidden;
  padding: 4px 0;
}

.dropdown .dropdown-menu.show { display: block !important; }

.dropdown .dropdown-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.224px;
  transition: background 0.1s;
  white-space: nowrap;
}

.dropdown .dropdown-menu a:hover { background: rgba(0,0,0,0.04); }

/* ========== BATCH UPLOAD ZONE ========== */
.batch-upload-zone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.batch-upload-zone:hover {
  border-color: var(--blue);
  background: rgba(0,113,227,0.02);
}

.ai-chat .chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chat .chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  letter-spacing: -0.224px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-chat .chat-msg.user {
  align-self: flex-end;
  background: var(--blue);
  color: var(--text-white);
}

.ai-chat .chat-msg.ai {
  align-self: flex-start;
  background: #f0f0f5;
  color: var(--text-primary);
}

.ai-chat .chat-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 8px;
}

.ai-chat .chat-input textarea {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  height: 44px;
  outline: none;
  letter-spacing: -0.224px;
  transition: border-color 0.12s;
}

.ai-chat .chat-input textarea:focus { border-color: var(--blue); }

.ai-chat .chat-input button {
  padding: 8px 16px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
}

.ai-chat .chat-input button:hover { background: var(--blue-hover); }
.ai-chat .chat-input button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== RANK BADGE ========== */
.rank-1 { color: #f5a623; }
.rank-2 { color: #a0a0a8; }
.rank-3 { color: #cd7f32; }

/* ========== RESPONSIVE ========== */

/* AI FAB and mobile cards — default hidden (desktop) */
 .ai-fab { display: none !important; }
 #mobileCards { display: none !important; }

@media (max-width: 834px) {
  .sidebar {
    width: 100%;
    position: relative;
    top: 0;
    height: auto;
    padding: 8px 0;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 12px;
  }

  .sidebar-section { padding: 0; margin: 0; display: flex; gap: 4px; }
  .sidebar-section-title { display: none; }
  .sidebar a { margin: 0; padding: 6px 12px; }

  .main-content { margin-left: 0; padding: 20px 16px; }

  .stat-row { grid-template-columns: repeat(2, 1fr); }

  /* Customer detail mobile */
  .detail-layout { flex-direction: column; }
  .detail-sidebar { width: 100%; display: none; }
  .detail-sidebar.ai-visible { display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 300; background: var(--bg-light); }
  .detail-sidebar.ai-visible .ai-chat { height: 100%; position: relative; top: 0; border-radius: 0; box-shadow: none; }
  .detail-sidebar.ai-visible .ai-chat .chat-header { display: flex; justify-content: space-between; align-items: center; }
  .detail-sidebar.ai-visible .ai-chat .chat-body { height: calc(100vh - 56px - 68px); }

  /* AI FAB visible on mobile */
  .ai-fab { display: flex; }
}

@media (max-width: 640px) {
  .stat-row { grid-template-columns: 1fr; }
  .page-heading { font-size: 22px; }
  .modal { padding: 20px; }

  /* Workspace: hide table, show cards */
  #tableCard { display: none; }
  #mobileCards { display: flex; flex-direction: column; gap: 12px; }
}

/* ========== MOBILE CUSTOMER CARDS (Workspace) ========== */

.cs-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.cs-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px 10px;
  gap: 8px;
}

.cs-card-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.28px;
  flex-shrink: 0;
}

.cs-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.cs-card-mid {
  padding: 0 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cs-card-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: -0.12px;
}

.cs-info-divider {
  color: var(--text-tertiary);
}

.cs-card-follow {
  text-align: right;
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: -0.12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cs-follow-time { color: var(--text-tertiary); }
.cs-follow-count { color: var(--blue); font-weight: 500; }

.cs-card-bottom {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border-light);
}

/* ========== AI FAB (Mobile) ========== */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px rgba(0,113,227,0.35);
  cursor: pointer;
  z-index: 250;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.ai-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(0,113,227,0.45);
}

.ai-fab:active { transform: scale(0.95); }

/* AI close button (mobile) */
.ai-close-btn {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
}

.detail-sidebar.ai-visible .ai-close-btn { display: flex; }

/* ========== CUSTOM FIELD RADIO CARDS ========== */
.cf-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cf-radio-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 2px solid var(--border-light);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.224px;
  transition: border-color 0.2s, background 0.2s;
}

.cf-radio-card:hover { border-color: var(--blue); background: #f5f9ff; }
.cf-radio-card.selected { border-color: var(--blue); background: #f0f6ff; }

.cf-radio-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.cf-radio-card.selected .cf-radio-dot { border-color: var(--blue); }

.cf-radio-dot::after {
  content: '';
  display: block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s;
}

.cf-radio-card.selected .cf-radio-dot::after { background: var(--blue); }

/* ========== UTILS ========== */
.text-muted { color: var(--text-tertiary); font-size: 14px; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* ============================================
   ANIMATIONS
   ============================================ */

/* ---- Keyframes ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---- Page content: fade + slide up ---- */
.main-content,
.main-content-full {
  animation: fadeInUp 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* ---- Cards: stagger fade-up ---- */
.stat-row .stat-card:nth-child(1) { animation: fadeInUp 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) 0.05s both; }
.stat-row .stat-card:nth-child(2) { animation: fadeInUp 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) 0.10s both; }
.stat-row .stat-card:nth-child(3) { animation: fadeInUp 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s both; }
.stat-row .stat-card:nth-child(4) { animation: fadeInUp 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) 0.20s both; }

.card {
  animation: fadeInUp 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* ---- Card hover lift ---- */
.stat-card,
.card {
  transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1),
              box-shadow 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.stat-card:hover,
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* ---- Table rows: stagger fade-in ---- */
.data-table tbody tr {
  animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.data-table tbody tr:nth-child(1)  { animation-delay: 0.05s; }
.data-table tbody tr:nth-child(2)  { animation-delay: 0.08s; }
.data-table tbody tr:nth-child(3)  { animation-delay: 0.11s; }
.data-table tbody tr:nth-child(4)  { animation-delay: 0.14s; }
.data-table tbody tr:nth-child(5)  { animation-delay: 0.17s; }
.data-table tbody tr:nth-child(6)  { animation-delay: 0.20s; }
.data-table tbody tr:nth-child(7)  { animation-delay: 0.23s; }
.data-table tbody tr:nth-child(8)  { animation-delay: 0.26s; }
.data-table tbody tr:nth-child(9)  { animation-delay: 0.29s; }
.data-table tbody tr:nth-child(10) { animation-delay: 0.32s; }
.data-table tbody tr:nth-child(n+11) { animation-delay: 0.35s; }

/* ---- Page heading fade-in ---- */
.page-heading {
  animation: fadeInDown 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) 0.08s both;
}

/* ---- Sidebar items: slide in from left ---- */
.sidebar-section a:nth-child(1)  { animation: slideInLeft 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.05s both; }
.sidebar-section a:nth-child(2)  { animation: slideInLeft 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.10s both; }
.sidebar-section a:nth-child(3)  { animation: slideInLeft 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s both; }
.sidebar-section a:nth-child(4)  { animation: slideInLeft 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.20s both; }
.sidebar-section a:nth-child(5)  { animation: slideInLeft 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.25s both; }
.sidebar-section a:nth-child(6)  { animation: slideInLeft 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.30s both; }
.sidebar-section a:nth-child(7)  { animation: slideInLeft 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.35s both; }
.sidebar-section a:nth-child(8)  { animation: slideInLeft 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.40s both; }

/* ---- Timeline items: stagger slide-in ---- */
.timeline-item {
  animation: slideInRight 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.timeline-item:nth-child(1)  { animation-delay: 0.05s; }
.timeline-item:nth-child(2)  { animation-delay: 0.10s; }
.timeline-item:nth-child(3)  { animation-delay: 0.15s; }
.timeline-item:nth-child(4)  { animation-delay: 0.20s; }
.timeline-item:nth-child(5)  { animation-delay: 0.25s; }
.timeline-item:nth-child(6)  { animation-delay: 0.30s; }
.timeline-item:nth-child(7)  { animation-delay: 0.35s; }
.timeline-item:nth-child(8)  { animation-delay: 0.40s; }
.timeline-item:nth-child(n+9) { animation-delay: 0.45s; }

/* ---- Alert: slide down ---- */
.alert {
  animation: fadeInDown 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* ---- Button press feedback ---- */
.btn:active {
  transform: scale(0.96);
  transition: transform 0.1s ease-out;
}

/* ---- FAB button: enhanced ---- */
.ai-fab {
  animation: scaleIn 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.3s both;
}

/* ---- Dropdown menu: scale + fade ---- */
.dropdown .dropdown-menu.show {
  animation: scaleIn 0.2s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  transform-origin: top left;
}

/* ---- AI chat messages: slide up ---- */
.ai-chat .chat-msg {
  animation: fadeInUp 0.25s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* ---- Toolbar: fade-in ---- */
.toolbar {
  animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) 0.05s both;
}

/* ---- Mobile customer cards: stagger ---- */
.cs-card:nth-child(1)  { animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) 0.05s both; }
.cs-card:nth-child(2)  { animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) 0.10s both; }
.cs-card:nth-child(3)  { animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s both; }
.cs-card:nth-child(4)  { animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) 0.20s both; }
.cs-card:nth-child(5)  { animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) 0.25s both; }
.cs-card:nth-child(6)  { animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) 0.30s both; }
.cs-card:nth-child(7)  { animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) 0.35s both; }
.cs-card:nth-child(n+8) { animation: fadeInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) 0.40s both; }

/* ========== LOGIN PAGE (保持独立) ========== */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #000;
}

.login-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 400px;
  box-shadow: var(--shadow-elevated);
  animation: fadeInUp 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.login-card h2 {
  font-size: 28px;
  font-weight: 600;
  text-align: center;
  color: var(--text-primary);
  letter-spacing: -0.28px;
  line-height: 1.14;
}

.login-card .subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  text-align: center;
  letter-spacing: -0.224px;
  margin-top: 4px;
  margin-bottom: 32px;
}

/* ========== INFO ROW (客户详情信息条) ========== */
.info-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.info-item .info-label {
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: -0.12px;
  margin-bottom: 2px;
}

.info-item .info-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.28px;
}
