/* ============================================================
   ALPHAVAULT CRM CONTACTS — crm-contacts.css v1.0
   Light mode default · Dark mode via body.crm-dark-mode
   100% responsive PC/Mobile · Extends crm-dashboard.css
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   §1 — CONTACTS PAGE — BASE & KPI GRID OVERRIDE (6 cards)
════════════════════════════════════════════════════════════ */
#contactsKPICards {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .crm-bottom-pad { height: 80px; }
  
  /* ════════════════════════════════════════════════════════════
     §2 — AI SUMMARY BANNER
  ════════════════════════════════════════════════════════════ */
  #contactsAISummary { margin-bottom: 16px; }
  
  .crm-widget-ai-summary {
    background: linear-gradient(
      135deg,
      rgba(139, 92, 246, 0.07) 0%,
      rgba(102, 126, 234, 0.05) 100%
    );
    border-color: rgba(139, 92, 246, 0.18);
  }
  
  .crm-ai-summary-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  
  .crm-ai-summary-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 0;
  }
  
  .crm-ai-summary-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--crm-purple), #6d28d9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.4);
  }
  
  .crm-ai-summary-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--crm-text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    flex-wrap: wrap;
  }
  
  .crm-ai-summary-text {
    font-size: 12px;
    color: var(--crm-text-muted);
    line-height: 1.65;
  }
  
  .crm-ai-summary-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
  }
  
  /* ════════════════════════════════════════════════════════════
     §3 — TOOLBAR
  ════════════════════════════════════════════════════════════ */
  #contactsToolbar { margin-bottom: 10px; }
  
  .crm-accounts-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    flex-wrap: wrap;
  }
  
  .crm-tb-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
  }
  
  .crm-tb-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
  }
  
  /* ── Search ─────────────────────────────────────────────── */
  .crm-accounts-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 180px;
    max-width: 340px;
  }
  
  .crm-accounts-search-icon {
    position: absolute;
    left: 11px;
    font-size: 11px;
    color: var(--crm-text-faint);
    pointer-events: none;
    z-index: 1;
  }
  
  .crm-accounts-search-input {
    width: 100%;
    height: 32px;
    background: var(--crm-input-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 0 30px 0 32px;
    font-family: inherit;
    font-size: 12px;
    color: var(--crm-text);
    outline: none;
    transition: var(--crm-transition);
  }
  
  .crm-accounts-search-input::placeholder { color: var(--crm-text-faint); }
  
  .crm-accounts-search-input:focus {
    border-color: var(--crm-primary);
    background: rgba(102, 126, 234, 0.06);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  }
  
  .crm-accounts-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--crm-text-faint);
    font-size: 10px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: var(--crm-transition);
  }
  
  .crm-accounts-search-clear:hover { color: var(--crm-text); }
  
  /* ── Contact Count ──────────────────────────────────────── */
  .crm-accounts-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--crm-text);
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .crm-accounts-count-total {
    font-weight: 500;
    color: var(--crm-text-faint);
    margin-left: 3px;
  }
  
  /* ── Toolbar Buttons ────────────────────────────────────── */
  .crm-tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 10px;
    background: var(--crm-input-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--crm-text-muted);
    cursor: pointer;
    transition: var(--crm-transition);
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .crm-tb-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--crm-text);
    border-color: var(--crm-border-hover);
  }
  
  body.crm-dark-mode .crm-tb-btn:hover { background: rgba(255, 255, 255, 0.08); }
  
  .crm-tb-btn.active {
    background: rgba(102, 126, 234, 0.12);
    color: var(--crm-primary);
    border-color: rgba(102, 126, 234, 0.25);
  }
  
  .crm-tb-btn-label { font-size: 11px; }
  
  .crm-filter-badge-btn { gap: 5px; position: relative; }
  
  .crm-filter-count-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 10px;
    background: var(--crm-primary);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* ── Toolbar Select ─────────────────────────────────────── */
  .crm-tb-select {
    height: 32px;
    padding: 0 8px;
    background: var(--crm-input-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--crm-text-muted);
    outline: none;
    cursor: pointer;
    transition: var(--crm-transition);
    flex-shrink: 0;
  }
  
  .crm-tb-select:focus {
    border-color: var(--crm-primary);
    color: var(--crm-text);
  }
  
  /* ── View Mode Group ────────────────────────────────────── */
  .crm-view-mode-group {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--crm-input-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 3px;
    flex-shrink: 0;
  }
  
  .crm-view-mode-btn {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: var(--crm-text-faint);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--crm-transition);
    padding: 0;
  }
  
  .crm-view-mode-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--crm-primary);
  }
  
  .crm-view-mode-btn.active {
    background: var(--crm-primary);
    color: #fff;
  }
  
  /* ── Divider ────────────────────────────────────────────── */
  .crm-tb-divider {
    width: 1px;
    height: 20px;
    background: var(--crm-border);
    flex-shrink: 0;
    margin: 0 2px;
  }
  
  /* ── Toolbar Skeleton ───────────────────────────────────── */
  .crm-toolbar-skeleton {
    min-height: 56px;
    pointer-events: none;
  }
  
  .crm-toolbar-skeleton-search {
    flex: 1;
    max-width: 340px;
    height: 32px;
    border-radius: 8px;
  }
  
  .crm-toolbar-skeleton-btn {
    width: 90px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
  }
  
  /* ════════════════════════════════════════════════════════════
     §4 — FILTERS PANEL
  ════════════════════════════════════════════════════════════ */
  #contactsFiltersPanel { margin-bottom: 10px; }
  
  .crm-filters-panel {
    display: none;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 16px;
    animation: crmFadeIn 0.2s ease;
  }
  
  .crm-filters-panel.open { display: block; }
  
  .crm-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }
  
  .crm-filter-group { display: flex; flex-direction: column; }
  
  .crm-filter-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--crm-text-faint);
    margin-bottom: 6px;
  }
  
  .crm-filter-select {
    width: 100%;
    background: var(--crm-input-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 7px 10px;
    font-family: inherit;
    font-size: 12px;
    color: var(--crm-text);
    outline: none;
    cursor: pointer;
    transition: var(--crm-transition);
  }
  
  .crm-filter-select:focus {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  }
  
  /* Toggle checkbox */
  .crm-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
  }
  
  .crm-toggle-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--crm-primary);
    cursor: pointer;
  }
  
  .crm-toggle-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--crm-text-muted);
  }
  
  /* Reset row */
  .crm-filters-reset-row {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--crm-border);
    display: flex;
    justify-content: flex-end;
  }
  
  .crm-btn-ghost {
    background: transparent;
    border-color: var(--crm-border);
    color: var(--crm-text-muted);
  }
  
  .crm-btn-ghost:hover {
    background: var(--crm-input-bg);
    color: var(--crm-text);
  }
  
  /* ════════════════════════════════════════════════════════════
     §5 — CONTACTS GRID VIEW
  ════════════════════════════════════════════════════════════ */
  #contactsList { margin-bottom: 0; }
  
  .crm-contacts-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
  }
  
  /* ── Contact Card ─────────────────────────────────────────── */
  .crm-contact-card {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: var(--crm-transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  .crm-contact-card:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.09);
    transform: translateY(-2px);
  }
  
  .crm-contact-card.selected {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15),
                0 6px 20px rgba(0, 0, 0, 0.08);
  }
  
  .crm-contact-card.overdue {
    border-left: 3px solid var(--crm-red);
    background: rgba(239, 68, 68, 0.03);
  }
  
  .crm-contact-card.dormant { opacity: 0.8; }
  
  /* ── Card Header ────────────────────────────────────────── */
  .crm-contact-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }
  
  /* ── Avatar Wrapper ─────────────────────────────────────── */
  .crm-contact-avatar-wrap {
    position: relative;
    flex-shrink: 0;
  }
  
  .crm-contact-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }
  
  /* Base avatar (div fallback) */
  .crm-contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    user-select: none;
  }
  
  /* Avatar size modifiers */
  .crm-contact-avatar-sm {
    width: 36px !important;
    height: 36px !important;
    font-size: 12px !important;
  }
  
  .crm-contact-avatar-xs {
    width: 28px !important;
    height: 28px !important;
    font-size: 10px !important;
  }
  
  /* Health ring (border around avatar) */
  .crm-contact-health-ring {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid transparent;
    pointer-events: none;
  }
  
  /* Health dot (bottom-right) */
  .crm-contact-health-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--crm-surface);
  }
  
  /* Scores group (top-right of card) */
  .crm-contact-card-scores {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  
  .crm-contact-ai-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
  }
  
  .crm-contact-health-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
  }
  
  /* ── Card Body ──────────────────────────────────────────── */
  .crm-contact-card-body { flex: 1; min-width: 0; }
  
  .crm-contact-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--crm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
  }
  
  .crm-contact-title {
    font-size: 11px;
    color: var(--crm-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
  }
  
  .crm-contact-company {
    font-size: 11px;
    color: var(--crm-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .crm-contact-account-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--crm-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--crm-transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  
  .crm-contact-account-link:hover { opacity: 0.75; }
  
  /* ── Tags ───────────────────────────────────────────────── */
  .crm-contact-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }
  
  .crm-contact-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    white-space: nowrap;
  }
  
  /* ── Stats Row ──────────────────────────────────────────── */
  .crm-contact-card-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }
  
  .crm-contact-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--crm-text-faint);
    font-weight: 600;
  }
  
  /* ── Follow-up / Overdue Badges ─────────────────────────── */
  .crm-contact-overdue-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 20px;
    background: rgba(239, 68, 68, 0.12);
    color: var(--crm-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
    animation: crmPulse 2.5s ease-in-out infinite;
  }
  
  .crm-contact-followup-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 20px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--crm-amber);
    border: 1px solid rgba(245, 158, 11, 0.2);
  }
  
  /* ── Warm Path Mini (on card) ───────────────────────────── */
  .crm-warm-path {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 10px;
    color: var(--crm-text-faint);
    background: var(--crm-input-bg);
    border-radius: 6px;
    padding: 5px 8px;
    line-height: 1.4;
  }
  
  .crm-warm-path strong {
    color: var(--crm-text-muted);
    font-weight: 700;
  }
  
  /* ── Card Actions (revealed on hover) ───────────────────── */
  .crm-contact-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
  }
  
  .crm-contact-card:hover .crm-contact-card-actions { opacity: 1; }
  
  .crm-contact-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--crm-border);
    background: var(--crm-input-bg);
    color: var(--crm-text-faint);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--crm-transition);
    flex-shrink: 0;
  }
  
  .crm-contact-action-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--crm-primary);
    border-color: rgba(102, 126, 234, 0.25);
  }
  
  .crm-contact-action-btn-xs {
    width: 24px !important;
    height: 24px !important;
    font-size: 9px !important;
  }
  
  /* ════════════════════════════════════════════════════════════
     §6 — CONTACTS LIST VIEW
  ════════════════════════════════════════════════════════════ */
  .crm-contacts-list-view {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
  }
  
  .crm-contacts-list-header {
    display: flex;
    gap: 8px;
    padding: 9px 16px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--crm-text-faint);
    background: var(--crm-input-bg);
    border-bottom: 1px solid var(--crm-border);
    min-width: 680px;
  }
  
  .crm-contact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--crm-border);
    cursor: pointer;
    transition: var(--crm-transition);
    min-width: 680px;
  }
  
  .crm-contact-row:last-child { border-bottom: none; }
  
  .crm-contact-row:hover { background: var(--crm-surface-hover); }
  
  .crm-contact-row.selected {
    background: rgba(102, 126, 234, 0.06);
    border-left: 3px solid var(--crm-primary);
  }
  
  .crm-contact-row.overdue {
    background: rgba(239, 68, 68, 0.03);
    border-left: 3px solid var(--crm-red);
  }
  
  .crm-list-contact-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--crm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .crm-list-contact-title {
    font-size: 10px;
    color: var(--crm-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
  }
  
  .crm-list-sub {
    font-size: 11px;
    color: var(--crm-text-faint);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* ════════════════════════════════════════════════════════════
     §7 — CONTACTS COMPACT VIEW
  ════════════════════════════════════════════════════════════ */
  .crm-contacts-compact-view {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
  }
  
  .crm-contact-compact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border-bottom: 1px solid var(--crm-border);
    cursor: pointer;
    transition: var(--crm-transition);
  }
  
  .crm-contact-compact-row:last-child { border-bottom: none; }
  
  .crm-contact-compact-row:hover { background: var(--crm-surface-hover); }
  
  .crm-contact-compact-row.selected {
    background: rgba(102, 126, 234, 0.06);
    border-left: 3px solid var(--crm-primary);
  }
  
  .crm-contact-compact-row.overdue {
    border-left: 3px solid var(--crm-red);
    background: rgba(239, 68, 68, 0.02);
  }
  
  .crm-compact-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--crm-text);
    flex: 2;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .crm-compact-company {
    font-size: 11px;
    color: var(--crm-text-faint);
    flex: 2;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .crm-compact-tag {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .crm-compact-health {
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    min-width: 30px;
    text-align: center;
  }
  
  .crm-compact-date {
    font-size: 10px;
    color: var(--crm-text-faint);
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
  }
  
  .crm-compact-actions {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
  }
  
  /* ════════════════════════════════════════════════════════════
     §8 — PAGINATION
  ════════════════════════════════════════════════════════════ */
  #contactsPagination { margin-bottom: 14px; }
  
  .crm-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    flex-wrap: wrap;
  }
  
  .crm-pagination-info {
    font-size: 11px;
    color: var(--crm-text-faint);
    font-weight: 600;
  }
  
  .crm-pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
  }
  
  .crm-page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border-radius: 7px;
    border: 1px solid var(--crm-border);
    background: var(--crm-input-bg);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--crm-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--crm-transition);
  }
  
  .crm-page-btn:hover:not(.disabled):not(.active) {
    background: rgba(102, 126, 234, 0.1);
    color: var(--crm-primary);
    border-color: rgba(102, 126, 234, 0.25);
  }
  
  .crm-page-btn.active {
    background: var(--crm-primary);
    color: #fff;
    border-color: transparent;
  }
  
  .crm-page-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
  
  .crm-page-ellipsis {
    font-size: 12px;
    color: var(--crm-text-faint);
    padding: 0 4px;
    line-height: 30px;
  }
  
  /* ════════════════════════════════════════════════════════════
     §9 — LOADING SKELETONS (contacts-specific)
  ════════════════════════════════════════════════════════════ */
  .crm-card-skeleton {
    height: 230px !important;
    border-radius: var(--crm-radius-lg) !important;
  }
  
  /* ════════════════════════════════════════════════════════════
     §10 — SIDEBAR BACKDROP (mobile)
  ════════════════════════════════════════════════════════════ */
  .crm-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    z-index: 999;
  }
  
  /* Header divider in context menus */
  .crm-ctx-divider {
    border: none;
    border-top: 1px solid var(--crm-border);
    margin: 4px 0;
  }
  
  /* ════════════════════════════════════════════════════════════
     §11 — DARK MODE — Grid / List / Compact / Toolbar
  ════════════════════════════════════════════════════════════ */
  body.crm-dark-mode .crm-contact-card {
    background: rgba(30, 41, 59, 0.88);
  }
  body.crm-dark-mode .crm-contact-card:hover {
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  }
  body.crm-dark-mode .crm-contacts-list-view    { background: rgba(30, 41, 59, 0.88); }
  body.crm-dark-mode .crm-contacts-compact-view { background: rgba(30, 41, 59, 0.88); }
  body.crm-dark-mode .crm-accounts-toolbar      { background: rgba(30, 41, 59, 0.88); }
  body.crm-dark-mode .crm-filters-panel         { background: rgba(30, 41, 59, 0.88); }
  body.crm-dark-mode .crm-pagination            { background: rgba(30, 41, 59, 0.88); }
  body.crm-dark-mode .crm-contact-row:hover     { background: rgba(255,255,255,0.03); }
  body.crm-dark-mode .crm-contact-compact-row:hover { background: rgba(255,255,255,0.03); }
  body.crm-dark-mode .crm-filter-select         { background: rgba(255,255,255,0.06); color: var(--crm-text); }
  body.crm-dark-mode .crm-tb-select             { background: rgba(255,255,255,0.06); color: var(--crm-text); }
  body.crm-dark-mode .crm-widget-ai-summary {
    background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(102,126,234,0.08));
  }
  
  /* ════════════════════════════════════════════════════════════
     §12 — LIGHT MODE POLISH — Grid
  ════════════════════════════════════════════════════════════ */
  body:not(.crm-dark-mode) .crm-contact-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  }
  body:not(.crm-dark-mode) .crm-accounts-toolbar {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  }
  body:not(.crm-dark-mode) .crm-pagination {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  }
  body:not(.crm-dark-mode) .crm-contacts-list-view,
  body:not(.crm-dark-mode) .crm-contacts-compact-view {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  }
  
  /* ════════════════════════════════════════════════════════════
     §13 — RESPONSIVE — Toolbar & Grid
  ════════════════════════════════════════════════════════════ */
  
  /* Ultra-wide */
  @media (min-width: 1600px) {
    #contactsKPICards {
      grid-template-columns: repeat(6, 1fr);
    }
    .crm-contacts-grid-view {
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
  }
  
  /* Large */
  @media (max-width: 1400px) {
    #contactsKPICards { grid-template-columns: repeat(3, 1fr); }
  }
  
  /* Tablet */
  @media (max-width: 1200px) {
    #contactsKPICards { grid-template-columns: repeat(3, 1fr); }
    .crm-contacts-grid-view {
      grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    }
  }
  
  /* Mobile ≤ 768px */
  @media (max-width: 768px) {
    #contactsKPICards  { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  
    .crm-accounts-toolbar {
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
      padding: 10px 12px;
    }
    .crm-tb-left { flex-direction: column; align-items: stretch; }
    .crm-accounts-search-wrap { max-width: 100%; }
    .crm-tb-right { flex-wrap: wrap; }
  
    .crm-contacts-grid-view {
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
    }
  
    .crm-contact-card-actions { opacity: 1; }
  
    .crm-contacts-list-header { display: none; }
    .crm-contact-row { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
  
    .crm-filters-grid { grid-template-columns: 1fr 1fr; }
  
    .crm-ai-summary-card { flex-direction: column; }
    .crm-ai-summary-actions { width: 100%; }
  
    .crm-tb-btn-label { display: none; }
    .crm-tb-btn      { padding: 0 8px; }
  }
  
  /* Small mobile ≤ 480px */
  @media (max-width: 480px) {
    #contactsKPICards          { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .crm-contacts-grid-view    { grid-template-columns: 1fr; }
    .crm-filters-grid          { grid-template-columns: 1fr; }
    .crm-pagination-controls   { gap: 2px; }
  }
  
  /* Landscape mobile */
  @media (max-width: 768px) and (orientation: landscape) {
    #contactsKPICards {
      grid-template-columns: repeat(3, 1fr);
      gap: 6px;
    }
    .crm-contacts-grid-view {
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
    }
  }
  
  /* ════════════════════════════════════════════════════════════
     END — crm-contacts.css v1.0 (Part 1/2)
     © AlphaVault AI — All rights reserved
  ════════════════════════════════════════════════════════════ */

/* ============================================================
   ALPHAVAULT CRM CONTACTS — crm-contacts.css v1.0
   PART 2/2 — Detail Panel · Tabs · AI · Forms · Dark · Responsive
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   §14 — CONTACT DETAIL PANEL — STRUCTURE
════════════════════════════════════════════════════════════ */
.crm-contact-panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 800;
    transition: opacity 0.3s ease;
  }
  
  .crm-contact-detail-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: calc(100vw - 20px);
    background: var(--crm-sidebar-bg);
    border-left: 1px solid var(--crm-border);
    flex-direction: column;
    z-index: 900;
    overflow: hidden;
    box-shadow: -6px 0 30px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.34, 1.1, 0.64, 1);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  .crm-contact-detail-panel.open {
    display: flex;
    transform: translateX(0);
  }
  
  /* ── Panel Header (scrollable zone) ─────────────────────── */
  .crm-contact-panel-header {
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border-bottom: 1px solid var(--crm-border);
    max-height: 52vh;
  }
  
  .crm-contact-panel-header::-webkit-scrollbar { width: 3px; }
  .crm-contact-panel-header::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
  }
  body.crm-dark-mode .crm-contact-panel-header::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.06);
  }
  
  /* ── Panel Tabs strip ───────────────────────────────────── */
  .crm-contact-panel-tabs {
    display: flex;
    gap: 2px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--crm-border);
    background: var(--crm-input-bg);
    flex-shrink: 0;
    overflow-x: auto;
  }
  
  .crm-contact-panel-tabs::-webkit-scrollbar { height: 0; }
  
  .crm-panel-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 7px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--crm-text-faint);
    cursor: pointer;
    transition: var(--crm-transition);
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .crm-panel-tab:hover {
    background: rgba(102, 126, 234, 0.08);
    color: var(--crm-text-muted);
  }
  
  .crm-panel-tab.active {
    background: rgba(102, 126, 234, 0.14);
    color: var(--crm-primary);
  }
  
  .crm-panel-tab i { font-size: 10px; }
  
  /* ── Panel Content (tab body, scrollable) ───────────────── */
  .crm-contact-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  
  .crm-contact-panel-content::-webkit-scrollbar { width: 3px; }
  .crm-contact-panel-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
  }
  body.crm-dark-mode .crm-contact-panel-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
  }
  
  /* ── Panel Loading placeholder ──────────────────────────── */
  .crm-panel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
  }
  
  /* ════════════════════════════════════════════════════════════
     §15 — PANEL HEADER CONTENT
     Topbar · Identity · Scores · AI Badge · Social · Banners
  ════════════════════════════════════════════════════════════ */
  
  /* ── Topbar (close + action buttons) ───────────────────── */
  .crm-panel-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 6px;
    flex-shrink: 0;
  }
  
  .crm-panel-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--crm-border);
    background: var(--crm-input-bg);
    color: var(--crm-text-faint);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--crm-transition);
    flex-shrink: 0;
  }
  
  .crm-panel-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--crm-red);
    border-color: rgba(239, 68, 68, 0.2);
  }
  
  .crm-panel-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  
  .crm-panel-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--crm-border);
    background: var(--crm-input-bg);
    color: var(--crm-text-faint);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--crm-transition);
    flex-shrink: 0;
  }
  
  .crm-panel-action-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--crm-primary);
    border-color: rgba(102, 126, 234, 0.25);
  }
  
  .crm-panel-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--crm-red);
    border-color: rgba(239, 68, 68, 0.2);
  }
  
  /* ── Identity block ─────────────────────────────────────── */
  .crm-panel-identity {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 4px 20px 14px;
  }
  
  .crm-panel-avatar-wrap {
    position: relative;
    flex-shrink: 0;
  }
  
  .crm-panel-avatar-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }
  
  .crm-panel-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
  }
  
  .crm-panel-health-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 3px solid transparent;
    pointer-events: none;
  }
  
  .crm-panel-identity-info {
    flex: 1;
    min-width: 0;
  }
  
  .crm-panel-name {
    font-size: 18px;
    font-weight: 900;
    color: var(--crm-text);
    margin: 0 0 3px;
    line-height: 1.25;
    word-break: break-word;
  }
  
  .crm-panel-title {
    font-size: 12px;
    color: var(--crm-text-muted);
    margin-bottom: 4px;
    font-weight: 500;
  }
  
  .crm-panel-company {
    font-size: 12px;
    color: var(--crm-text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 3px;
  }
  
  .crm-panel-location {
    font-size: 11px;
    color: var(--crm-text-faint);
    display: flex;
    align-items: center;
    gap: 4px;
  }
  
  /* ── Score items row ────────────────────────────────────── */
  .crm-panel-scores-row {
    display: flex;
    gap: 8px;
    padding: 0 20px 12px;
  }
  
  .crm-panel-score-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: default;
    min-width: 0;
  }
  
  /* ── AI badge & score button ────────────────────────────── */
  .crm-panel-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 7px 16px;
    border-radius: 20px;
    width: 100%;
    justify-content: center;
    transition: var(--crm-transition);
  }
  
  .crm-panel-ai-score-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, 0.25);
    background: rgba(139, 92, 246, 0.08);
    color: var(--crm-purple);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--crm-transition);
    width: 100%;
    justify-content: center;
  }
  
  .crm-panel-ai-score-btn:hover {
    background: rgba(139, 92, 246, 0.16);
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.25);
  }
  
  /* ── Tags row ───────────────────────────────────────────── */
  .crm-panel-tags-row {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
  }
  
  /* ── Social buttons ─────────────────────────────────────── */
  .crm-panel-social-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  
  .crm-panel-social-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--crm-border);
    background: var(--crm-input-bg);
    color: var(--crm-text-faint);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--crm-transition);
  }
  
  .crm-panel-social-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--crm-primary);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2);
  }
  
  /* ── Overdue / Follow-up banners ────────────────────────── */
  .crm-panel-overdue-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--crm-red);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
  }
  
  .crm-panel-followup-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--crm-green);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
  }
  
  /* ════════════════════════════════════════════════════════════
     §16 — PANEL TAB BODY & SHARED SECTIONS
  ════════════════════════════════════════════════════════════ */
  .crm-panel-tab-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  
  .crm-panel-section {
    padding: 14px 0;
    border-bottom: 1px solid var(--crm-border);
  }
  
  .crm-panel-section:last-child { border-bottom: none; }
  
  .crm-panel-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    font-weight: 800;
    color: var(--crm-text);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }
  
  /* View all link (inside section title) */
  .crm-panel-view-all-btn {
    margin-left: auto;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(102, 126, 234, 0.08);
    color: var(--crm-primary);
    border: 1px solid rgba(102, 126, 234, 0.18);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--crm-transition);
    white-space: nowrap;
  }
  
  .crm-panel-view-all-btn:hover {
    background: rgba(102, 126, 234, 0.15);
  }
  
  /* ════════════════════════════════════════════════════════════
     §17 — OVERVIEW TAB
     Notes · Details Grid · Interaction Breakdown
     Warm Path · Colleagues · Quick Actions
  ════════════════════════════════════════════════════════════ */
  
  /* Notes text */
  .crm-panel-notes-text {
    font-size: 12px;
    color: var(--crm-text-muted);
    line-height: 1.7;
    background: var(--crm-input-bg);
    border-radius: 8px;
    padding: 10px 12px;
    white-space: pre-wrap;
    border: 1px solid var(--crm-border);
  }
  
  /* Details grid (label + value) */
  .crm-panel-details-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  
  .crm-panel-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--crm-border);
  }
  
  .crm-panel-detail-row:last-child { border-bottom: none; }
  
  .crm-panel-detail-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--crm-text-faint);
    min-width: 90px;
    flex-shrink: 0;
  }
  
  .crm-panel-detail-value {
    font-size: 12px;
    color: var(--crm-text-muted);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    word-break: break-word;
  }
  
  .crm-panel-detail-value a {
    color: var(--crm-primary);
    text-decoration: none;
    font-weight: 600;
  }
  
  .crm-panel-detail-value a:hover { opacity: 0.75; }
  
  /* Interaction type breakdown bars */
  .crm-panel-type-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .crm-type-breakdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .crm-type-breakdown-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 72px;
    font-size: 11px;
    font-weight: 600;
    color: var(--crm-text-muted);
    flex-shrink: 0;
  }
  
  .crm-type-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  
  .crm-type-breakdown-bar-wrap {
    flex: 1;
    height: 5px;
    background: var(--crm-input-bg);
    border-radius: 5px;
    overflow: hidden;
  }
  
  .crm-type-breakdown-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 3px;
  }
  
  .crm-type-breakdown-count {
    font-size: 11px;
    font-weight: 700;
    color: var(--crm-text-muted);
    min-width: 20px;
    text-align: right;
    flex-shrink: 0;
  }
  
  /* Warm Path (full version in overview tab) */
  .crm-warm-path-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    background: var(--crm-input-bg);
    border-radius: var(--crm-radius);
    margin-bottom: 6px;
    border: 1px solid var(--crm-border);
    transition: var(--crm-transition);
  }
  
  .crm-warm-path-item:last-child { margin-bottom: 0; }
  
  .crm-warm-path-item:hover {
    border-color: var(--crm-border-hover);
    background: var(--crm-surface-hover);
  }
  
  .crm-warm-path-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
  }
  
  .crm-warm-path-info { flex: 1; min-width: 0; }
  
  .crm-warm-path-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--crm-text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .crm-warm-path-meta {
    font-size: 10px;
    color: var(--crm-text-faint);
    line-height: 1.4;
  }
  
  /* Colleagues */
  .crm-panel-colleagues {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  
  .crm-panel-colleague-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: var(--crm-radius);
    cursor: pointer;
    transition: var(--crm-transition);
    border: 1px solid transparent;
  }
  
  .crm-panel-colleague-item:hover {
    background: var(--crm-input-bg);
    border-color: var(--crm-border);
  }
  
  .crm-panel-colleague-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--crm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .crm-panel-colleague-title {
    font-size: 10px;
    color: var(--crm-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
  }
  
  /* Quick Actions (in overview tab) */
  .crm-panel-quick-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  
  .crm-panel-qbtn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
    background: var(--crm-input-bg);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--crm-text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: var(--crm-transition);
    white-space: nowrap;
  }
  
  .crm-panel-qbtn:hover {
    background: rgba(102, 126, 234, 0.08);
    color: var(--crm-primary);
    border-color: rgba(102, 126, 234, 0.2);
  }
  
  .crm-panel-qbtn.primary {
    background: linear-gradient(135deg, var(--crm-primary), var(--crm-primary-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
  }
  
  .crm-panel-qbtn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(102, 126, 234, 0.45);
  }
  
  /* ════════════════════════════════════════════════════════════
     §18 — INTERACTIONS TAB (panel-specific extras)
  ════════════════════════════════════════════════════════════ */
  
  /* Action items box inside timeline */
  .crm-timeline-action-items {
    margin-top: 7px;
    padding: 8px 10px;
    background: rgba(245, 158, 11, 0.06);
    border-radius: 7px;
    border: 1px solid rgba(245, 158, 11, 0.14);
  }
  
  /* Drive link in timeline */
  .crm-panel-drive-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--crm-primary);
    text-decoration: none;
    padding: 3px 8px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 6px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    transition: var(--crm-transition);
  }
  
  .crm-panel-drive-link:hover {
    background: rgba(102, 126, 234, 0.15);
  }
  
  /* ════════════════════════════════════════════════════════════
     §19 — DEALS TAB (panel deal rows)
  ════════════════════════════════════════════════════════════ */
  .crm-panel-deal-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
    margin-bottom: 6px;
    transition: var(--crm-transition);
    cursor: pointer;
  }
  
  .crm-panel-deal-row:last-child { margin-bottom: 0; }
  
  .crm-panel-deal-row:hover {
    background: var(--crm-input-bg);
    box-shadow: var(--crm-shadow);
  }
  
  .crm-panel-deal-row.stagnant {
    border-left: 3px solid var(--crm-amber);
    background: rgba(245, 158, 11, 0.04);
  }
  
  .crm-panel-deal-row.muted {
    opacity: 0.62;
  }
  
  /* ════════════════════════════════════════════════════════════
     §20 — NETWORK / ORG CHART TAB
  ════════════════════════════════════════════════════════════ */
  .crm-org-chart {
    background: var(--crm-input-bg);
    border-radius: var(--crm-radius-lg);
    padding: 14px;
    border: 1px solid var(--crm-border);
    overflow-x: auto;
    margin-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Compact inline org chart (for panel overview Network section) */
  .crm-org-level {
    margin-bottom: 14px;
  }
  
  .crm-org-level:last-child { margin-bottom: 0; }
  
  .crm-org-level-label {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--crm-text-faint);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
  }
  
  .crm-org-level-contacts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .crm-org-contact-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 9px 8px;
    border-radius: 10px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    transition: var(--crm-transition);
    min-width: 68px;
    max-width: 90px;
    text-align: center;
  }
  
  .crm-org-contact-node:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: var(--crm-shadow);
    transform: translateY(-2px);
  }
  
  .crm-org-contact-node.current {
    border-color: var(--crm-primary);
    background: rgba(102, 126, 234, 0.08);
  }
  
  .crm-org-node-info { text-align: center; min-width: 0; }
  
  /* ════════════════════════════════════════════════════════════
     §21 — AI INTELLIGENCE TAB
     Likelihood Score · Outreach Draft · Intros · Comp Intel
  ════════════════════════════════════════════════════════════ */
  
  /* Main score display */
  .crm-ai-score-main {
    border-radius: var(--crm-radius-lg);
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
  }
  
  /* Outreach draft block */
  .crm-outreach-draft {
    background: var(--crm-input-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 14px;
  }
  
  .crm-outreach-draft-text {
    font-size: 12px;
    color: var(--crm-text-muted);
    line-height: 1.75;
    white-space: pre-wrap;
    font-family: 'Inter', sans-serif;
  }
  
  /* Introduction suggestion cards */
  .crm-intro-suggestion {
    background: var(--crm-input-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 14px;
    margin-bottom: 10px;
    transition: var(--crm-transition);
  }
  
  .crm-intro-suggestion:last-child { margin-bottom: 0; }
  
  .crm-intro-suggestion:hover {
    border-color: var(--crm-border-hover);
  }
  
  /* Competitive intel */
  .crm-comp-intel {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .crm-intel-block {
    background: var(--crm-input-bg);
    border-radius: var(--crm-radius);
    padding: 12px;
    border: 1px solid var(--crm-border);
  }
  
  .crm-intel-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
  }
  
  .crm-intel-item {
    font-size: 12px;
    color: var(--crm-text-muted);
    line-height: 1.55;
    padding: 3px 0;
  }
  
  /* ════════════════════════════════════════════════════════════
     §22 — DOCUMENTS TAB
  ════════════════════════════════════════════════════════════ */
  .crm-panel-doc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
    margin-bottom: 6px;
    transition: var(--crm-transition);
  }
  
  .crm-panel-doc-row:last-child { margin-bottom: 0; }
  
  .crm-panel-doc-row:hover {
    background: var(--crm-input-bg);
    border-color: var(--crm-border-hover);
  }
  
  .crm-doc-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
  }
  
  /* Drive CTA button (bottom of Documents tab) */
  .crm-panel-drive-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    background: linear-gradient(
      135deg,
      rgba(16, 185, 129, 0.08),
      rgba(5, 150, 105, 0.06)
    );
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--crm-radius-lg);
    text-decoration: none;
    color: var(--crm-green);
    font-size: 13px;
    font-weight: 700;
    margin-top: 14px;
    transition: var(--crm-transition);
  }
  
  .crm-panel-drive-cta:hover {
    background: linear-gradient(
      135deg,
      rgba(16, 185, 129, 0.14),
      rgba(5, 150, 105, 0.1)
    );
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
    transform: translateY(-1px);
  }
  
  /* ════════════════════════════════════════════════════════════
     §23 — TAG SELECTOR (Add / Edit Contact Form)
  ════════════════════════════════════════════════════════════ */
  .crm-tag-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px 0;
  }
  
  .crm-tag-option {
    display: inline-flex;
  }
  
  .crm-tag-option input[type="checkbox"] {
    display: none;
  }
  
  .crm-tag-option input[type="checkbox"]:checked + span {
    box-shadow: 0 0 0 2px var(--tag-color, #667eea);
    font-weight: 800 !important;
  }
  
  .crm-tag-option span {
    transition: var(--crm-transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
  }
  
  .crm-tag-option span:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  }
  
  /* ════════════════════════════════════════════════════════════
     §24 — DARK MODE — Panel, Tabs & Forms
  ════════════════════════════════════════════════════════════ */
  body.crm-dark-mode .crm-contact-detail-panel {
    background: #0f172a;
    border-left-color: rgba(255, 255, 255, 0.08);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.55);
  }
  
  body.crm-dark-mode .crm-contact-panel-tabs {
    background: rgba(255, 255, 255, 0.03);
  }
  
  body.crm-dark-mode .crm-panel-notes-text {
    background: rgba(255, 255, 255, 0.04);
  }
  
  body.crm-dark-mode .crm-warm-path-item {
    background: rgba(255, 255, 255, 0.04);
  }
  
  body.crm-dark-mode .crm-warm-path-item:hover {
    background: rgba(255, 255, 255, 0.06);
  }
  
  body.crm-dark-mode .crm-panel-colleague-item:hover {
    background: rgba(255, 255, 255, 0.04);
  }
  
  body.crm-dark-mode .crm-org-chart {
    background: rgba(255, 255, 255, 0.03);
  }
  
  body.crm-dark-mode .crm-org-contact-node {
    background: rgba(30, 41, 59, 0.9);
  }
  
  body.crm-dark-mode .crm-panel-deal-row:hover {
    background: rgba(255, 255, 255, 0.04);
  }
  
  body.crm-dark-mode .crm-panel-deal-row.stagnant {
    background: rgba(245, 158, 11, 0.07);
  }
  
  body.crm-dark-mode .crm-panel-doc-row:hover {
    background: rgba(255, 255, 255, 0.04);
  }
  
  body.crm-dark-mode .crm-outreach-draft {
    background: rgba(255, 255, 255, 0.04);
  }
  
  body.crm-dark-mode .crm-intro-suggestion {
    background: rgba(255, 255, 255, 0.04);
  }
  
  body.crm-dark-mode .crm-intro-suggestion:hover {
    background: rgba(255, 255, 255, 0.06);
  }
  
  body.crm-dark-mode .crm-intel-block {
    background: rgba(255, 255, 255, 0.04);
  }
  
  body.crm-dark-mode .crm-timeline-action-items {
    background: rgba(245, 158, 11, 0.08);
  }
  
  /* ════════════════════════════════════════════════════════════
     §25 — LIGHT MODE POLISH — Panel
  ════════════════════════════════════════════════════════════ */
  body:not(.crm-dark-mode) .crm-contact-detail-panel {
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.1);
  }
  
  body:not(.crm-dark-mode) .crm-panel-deal-row:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
  }
  
  body:not(.crm-dark-mode) .crm-org-contact-node:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  }
  
  /* ════════════════════════════════════════════════════════════
     §26 — RESPONSIVE — PANEL
  ════════════════════════════════════════════════════════════ */
  
  /* Ultra-wide */
  @media (min-width: 1600px) {
    .crm-contact-detail-panel { width: 480px; }
  }
  
  /* Tablet landscape */
  @media (max-width: 1200px) {
    .crm-contact-detail-panel { width: 400px; }
  }
  
  /* Mobile ≤ 768px — panel slides up from bottom */
  @media (max-width: 768px) {
    .crm-contact-detail-panel {
      top: auto;
      bottom: 0;
      left: 0;
      right: 0;
      width: 100%;
      max-width: 100%;
      height: 90vh;
      border-left: none;
      border-top: 1px solid var(--crm-border);
      border-radius: 20px 20px 0 0;
      transform: translateY(100%);
      transition: transform 0.32s cubic-bezier(0.34, 1.1, 0.64, 1);
    }
  
    .crm-contact-detail-panel.open {
      transform: translateY(0);
    }
  
    /* Pull handle visual */
    .crm-contact-detail-panel::before {
      content: '';
      display: block;
      width: 36px;
      height: 4px;
      background: var(--crm-border);
      border-radius: 2px;
      margin: 10px auto 0;
      flex-shrink: 0;
    }
  
    .crm-contact-panel-overlay { display: none; }
    .crm-contact-panel-overlay[style*="block"] { display: block !important; }
  
    /* Tabs: icon-only on mobile */
    .crm-panel-tab span { display: none; }
    .crm-panel-tab { padding: 7px 9px; }
    .crm-panel-tab i { font-size: 13px; }
  
    /* Tighter spacing */
    .crm-panel-identity { padding: 4px 14px 10px; }
    .crm-panel-topbar   { padding: 8px 12px 4px; }
    .crm-panel-scores-row { padding: 0 14px 10px; gap: 6px; }
    .crm-panel-tab-body  { padding: 16px; }
  
    .crm-panel-score-item { padding: 8px 10px; }
  
    /* Org chart compact */
    .crm-org-level-contacts { flex-wrap: wrap; }
    .crm-org-contact-node   { min-width: 58px; padding: 7px 6px; }
  
    /* Quick actions stack vertically */
    .crm-panel-quick-actions { flex-direction: column; }
    .crm-panel-qbtn { justify-content: center; }
  
    /* Contacts header: max-height increase */
    .crm-contact-panel-header { max-height: 48vh; }
  }
  
  /* Small mobile ≤ 480px */
  @media (max-width: 480px) {
    .crm-contact-detail-panel {
      height: 93vh;
      border-radius: 16px 16px 0 0;
    }
  
    .crm-contact-panel-tabs { gap: 1px; padding: 6px 8px; }
    .crm-panel-tab { padding: 6px 7px; }
  
    .crm-panel-scores-row { gap: 5px; }
    .crm-panel-score-item { padding: 7px 8px; }
  
    .crm-panel-identity { gap: 10px; }
    .crm-panel-avatar, .crm-panel-avatar-img { width: 52px; height: 52px; }
    .crm-panel-name { font-size: 16px; }
  }
  
  /* Landscape mobile */
  @media (max-width: 768px) and (orientation: landscape) {
    .crm-contact-detail-panel  { height: 92vh; border-radius: 16px 16px 0 0; }
    .crm-contact-panel-header  { max-height: 42vh; }
    .crm-panel-tab-body        { padding: 12px; }
  }
  
  /* ════════════════════════════════════════════════════════════
     §27 — PRINT
  ════════════════════════════════════════════════════════════ */
  @media print {
    .crm-contact-detail-panel,
    .crm-contact-panel-overlay,
    #contactsAISummary,
    #contactsQuickActions,
    #contactsToolbar,
    #contactsFiltersPanel,
    .crm-ai-fab,
    .crm-ai-chat-panel,
    .crm-sidebar-backdrop { display: none !important; }
  
    #contactsList  { overflow: visible; }
    #crmContent    { overflow: visible; }
  }
  
  /* ════════════════════════════════════════════════════════════
     §28 — ACCESSIBILITY
  ════════════════════════════════════════════════════════════ */
  .crm-contact-card:focus-visible,
  .crm-contact-row:focus-visible,
  .crm-contact-compact-row:focus-visible,
  .crm-panel-tab:focus-visible,
  .crm-page-btn:focus-visible,
  .crm-panel-qbtn:focus-visible,
  .crm-panel-action-btn:focus-visible {
    outline: 2px solid var(--crm-primary);
    outline-offset: 2px;
  }
  
  @media (prefers-reduced-motion: reduce) {
    .crm-contact-card,
    .crm-contact-row,
    .crm-contact-compact-row,
    .crm-contact-detail-panel,
    .crm-org-contact-node,
    .crm-panel-qbtn {
      transition: none !important;
      animation: none !important;
      transform: none !important;
    }
    .crm-contact-overdue-badge { animation: none; }
    .crm-type-breakdown-bar    { transition: none; }
  }
  
  /* iOS zoom prevention on inputs */
  @media (max-width: 768px) {
    .crm-accounts-search-input,
    .crm-filter-select,
    .crm-tb-select,
    .crm-form-input,
    .crm-form-select,
    .crm-form-textarea { font-size: 16px; }
  
    .crm-accounts-search-input:not(:focus),
    .crm-filter-select:not(:focus),
    .crm-tb-select:not(:focus),
    .crm-form-input:not(:focus),
    .crm-form-select:not(:focus),
    .crm-form-textarea:not(:focus) { font-size: 12px; }
  }
  
  /* ════════════════════════════════════════════════════════════
     §29 — GPU ACCELERATION
  ════════════════════════════════════════════════════════════ */
  .crm-contact-card,
  .crm-contact-detail-panel,
  .crm-contact-row,
  .crm-contact-compact-row,
  .crm-org-contact-node {
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  /* ════════════════════════════════════════════════════════════
     §30 — UTILITIES & MICRO-HELPERS
  ════════════════════════════════════════════════════════════ */
  
  /* Status dot (header) */
  .crm-status-wrap {
    display: flex;
    align-items: center;
  }
  
  /* Hidden FAB (when AI chat open) */
  .crm-ai-fab.hidden { display: none !important; }
  
  /* Enrichment loading bar (top of panel content) */
  .crm-enrichment-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--crm-primary), var(--crm-purple));
    animation: crmSlideIn 0.5s ease;
    z-index: 10;
  }
  
  /* Drag-over state (shared with dashboard) */
  .crm-drag-over {
    border-color: rgba(102, 126, 234, 0.5) !important;
    background: rgba(102, 126, 234, 0.04) !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2) !important;
  }
  
  /* "No data" text inside panel tabs */
  .crm-panel-empty-text {
    font-size: 12px;
    color: var(--crm-text-faint);
    text-align: center;
    padding: 20px 0;
    font-weight: 500;
  }
  
  /* Truncate utility */
  .crm-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Visually hidden (a11y) */
  .crm-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

/* ── Sidebar footer — user avatar image ─────────────────── */
#crmUserAvatarImg {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
    display: block;
    border: 2px solid rgba(102, 126, 234, 0.25);
  }
  
  /* ── Sidebar user dropdown — header avatar ───────────────── */
  #crmDropdownPhoto {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
    display: block;
    border: 2px solid rgba(102, 126, 234, 0.2);
  }
  
  /* ── Header avatar image (si photo réelle chargée) ───────── */
  .crm-header-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    display: block;
  }
  
  /* ════════════════════════════════════════════════════════════
     END — crm-contacts.css v1.0 (Part 2/2)
     © AlphaVault AI — All rights reserved
  ════════════════════════════════════════════════════════════ */