/* ════════════════════════════════════════════════════════════
   BLACKOUT CRM — DESIGN SYSTEM
   styles.css  |  v1.0.0
   Estructura:
     1. CSS Reset & Base
     2. Design Tokens (CSS Custom Properties)
     3. Typography
     4. Layout — App Shell, Sidebar, Topbar
     5. Components — Cards, Buttons, Badges, Forms
     6. Kanban Board
     7. Contact Panel (Slide-over)
     8. Modal
     9. Toasts
    10. Utilities & Animations
    11. Dark/Light Theme overrides
    12. Responsive
════════════════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────────────────
   1. CSS Reset & Base
──────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden; /* Managed per-region */
  transition: background var(--transition-slow), color var(--transition-slow);
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea { font-family: inherit; }

/* ────────────────────────────────────────────────────────────
   2. Design Tokens — DARK MODE (default)
──────────────────────────────────────────────────────────── */
:root,
[data-theme="dark"] {
  /* Brand */
  --brand-primary:    #7c3aed;
  --brand-secondary:  #a78bfa;
  --brand-accent:     #06b6d4;

  /* Backgrounds */
  --bg-base:          #0c0f1a;
  --bg-surface:       #111827;
  --bg-elevated:      #1a2133;
  --bg-hover:         rgba(255,255,255,0.04);
  --bg-active:        rgba(124,58,237,0.18);

  /* Glass */
  --glass-bg:         rgba(17, 24, 39, 0.65);
  --glass-border:     rgba(255,255,255,0.08);
  --glass-blur:       blur(14px);
  --glass-shadow:     0 8px 32px rgba(0,0,0,0.45);

  /* Text */
  --text-primary:     #f1f5f9;
  --text-secondary:   #94a3b8;
  --text-muted:       #475569;
  --text-inverse:     #0c0f1a;

  /* Borders */
  --border-subtle:    rgba(255,255,255,0.07);
  --border-default:   rgba(255,255,255,0.12);
  --border-strong:    rgba(255,255,255,0.22);

  /* Sidebar */
  --sidebar-bg:       rgba(10, 13, 24, 0.82);
  --sidebar-width:    240px;
  --sidebar-width-collapsed: 68px;

  /* Topbar */
  --topbar-height:    60px;
  --topbar-bg:        rgba(17, 24, 39, 0.75);

  /* Status Colors — 12 Pipeline States */
  --col-prospecto:    #6366f1;  /* State 1: Indigo */
  --col-calificado:   #06b6d4;  /* State 3: Cyan */
  --col-propuesta:    #f59e0b;  /* State 5: Amber */
  --col-negociacion:  #ec4899;  /* State 7: Pink */
  --col-ganado:       #10b981;  /* State 4: Emerald */
  
  --state-2:  #8b5cf6;  /* Violet */
  --state-6:  #ef4444;  /* Red */
  --state-8:  #64748b;  /* Slate */
  --state-9:  #a78bfa;  /* Purple Light */
  --state-10: #67e8f9;  /* Cyan Light */
  --state-11: #6ee7b7;  /* Green Light */
  --state-12: #fcd34d;  /* Yellow */

  /* Analytics Colors */
  --orange:       #FF8C00;
  --orange-dark:  #FF6B00;
  --green:        #22c55e;
  --red:          #ef4444;
  --amber:        #f59e0b;
  --blue:         #3b82f6;

  /* Semantic Colors */
  --color-success:    #10b981;
  --color-warning:    #f59e0b;
  --color-danger:     #ef4444;
  --color-info:       #06b6d4;

  /* Priority */
  --priority-high:    #ef4444;
  --priority-medium:  #f59e0b;
  --priority-low:     #6366f1;

  /* Typography */
  --font-body:        'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:        'JetBrains Mono', 'Fira Code', monospace;

  /* Radius */
  --radius-sm:        6px;
  --radius-md:        10px;
  --radius-lg:        16px;
  --radius-xl:        22px;
  --radius-full:      9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Transitions */
  --transition-fast:  150ms cubic-bezier(0.4,0,0.2,1);
  --transition-base:  220ms cubic-bezier(0.4,0,0.2,1);
  --transition-slow:  350ms cubic-bezier(0.4,0,0.2,1);

  /* Scrollbar */
  --scrollbar-thumb:  rgba(148,163,184,0.25);
  --scrollbar-track:  transparent;
}

/* ────────────────────────────────────────────────────────────
   2b. Design Tokens — LIGHT MODE
──────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --brand-primary:    #6d28d9;
  --brand-secondary:  #5b21b6;
  --bg-base:          #f0f4fa;
  --bg-surface:       #ffffff;
  --bg-elevated:      #f8faff;
  --bg-hover:         rgba(0,0,0,0.04);
  --bg-active:        rgba(124,58,237,0.08);

  --glass-bg:         rgba(255,255,255,0.68);
  --glass-border:     rgba(0,0,0,0.09);
  --glass-shadow:     0 8px 32px rgba(0,0,0,0.10);

  --text-primary:     #0f172a;
  --text-secondary:   #475569;
  --text-muted:       #64748b;
  --text-inverse:     #f1f5f9;

  --border-subtle:    rgba(0,0,0,0.06);
  --border-default:   rgba(0,0,0,0.10);
  --border-strong:    rgba(0,0,0,0.18);

  --sidebar-bg:       rgba(255,255,255,0.88);
  --topbar-bg:        rgba(255,255,255,0.80);

  --scrollbar-thumb:  rgba(71,85,105,0.25);
}

/* ────────────────────────────────────────────────────────────
   3. Typography
──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.panel-section__title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* ────────────────────────────────────────────────────────────
   4. Layout — App Shell, Sidebar, Topbar
──────────────────────────────────────────────────────────── */

/* App Shell */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ─── SIDEBAR ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  transition: width var(--transition-slow), transform var(--transition-slow);
  position: relative;
  z-index: 100;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

/* Logo */
.sidebar__logo {
  padding: var(--space-5) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 72px;
  flex-shrink: 0;
  position: relative;
}

.sidebar__logo {
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 72px;
  flex-shrink: 0;
  position: relative;
}

/* Collapsed: shrink logo area to match icon row */
.sidebar.collapsed .sidebar__logo {
  padding: var(--space-3) 0;
  min-height: 72px;
}

.sidebar__logo-expanded {
  height: 36px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  transition: opacity var(--transition-base), filter var(--transition-base);
  opacity: 1;
  pointer-events: auto;
}

.sidebar__logo-collapsed {
  height: 44px;
  width: 44px;
  object-fit: contain;
  transition: opacity var(--transition-base), filter var(--transition-base);
  opacity: 0;
  pointer-events: none;
  position: absolute;
  /* Center inside 68px-wide collapsed sidebar */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Force white logo in dark mode */
[data-theme="dark"] .sidebar__logo-expanded,
[data-theme="dark"] .sidebar__logo-collapsed {
  filter: brightness(0) invert(1);
}

/* Collapsed state: hide large logo, show icon */
.sidebar.collapsed .sidebar__logo-expanded {
  opacity: 0;
  pointer-events: none;
}

.sidebar.collapsed .sidebar__logo-collapsed {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar Toggle Button */
.sidebar__toggle {
  width: 100%;
  height: 44px;
  padding: 0;
  border: none;
  border-top: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sidebar__toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar.collapsed .sidebar__toggle i {
  transform: scaleX(-1);
}

/* Nav */
.sidebar__nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar__menu { display: flex; flex-direction: column; gap: var(--space-1); }

.sidebar__item {}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}

/* COLLAPSED: center icons perfectly */
.sidebar.collapsed .sidebar__link {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  padding: var(--space-2) 0;
  justify-content: center;
  gap: 0;
  border: 1px solid transparent;
}

.sidebar__link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Collapsed hover — glass pill */
.sidebar.collapsed .sidebar__link:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.sidebar__item.active .sidebar__link {
  background: var(--bg-active);
  color: var(--brand-secondary);
}

/* Active indicator bar */
.sidebar__item.active .sidebar__link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--brand-primary);
  border-radius: 0 2px 2px 0;
}

.sidebar__icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9375rem;
}

/* Collapsed icons: glass pill container */
.sidebar.collapsed .sidebar__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 0;
  font-size: 1rem;
}

.sidebar.collapsed .sidebar__item.active .sidebar__icon {
  color: var(--brand-secondary);
}

.sidebar__label {
  transition: opacity var(--transition-base), width var(--transition-base);
  overflow: hidden;
}

.sidebar.collapsed .sidebar__label {
  opacity: 0;
  width: 0;
}

/* Footer */
.sidebar__footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;   /* never compress */
  overflow: hidden;
}

.sidebar.collapsed .sidebar__footer {
  justify-content: center;
  padding: var(--space-3) 0;
}

.sidebar__user-info {
  flex: 1;
  min-width: 0;
  transition: opacity var(--transition-base);
}

.sidebar.collapsed .sidebar__user-info,
.sidebar.collapsed .sidebar__logout {
  opacity: 0;
  pointer-events: none;
}

.sidebar__user-name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  display: block;
  font-size: 0.6875rem;
  color: var(--brand-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar__logout {
  color: var(--text-muted);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}

.sidebar__logout:hover {
  color: var(--color-danger);
  background: rgba(239,68,68,0.1);
}

/* ─── MAIN WRAPPER ────────────────────────────── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

/* ─── TOPBAR ──────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--topbar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  gap: var(--space-4);
  flex-shrink: 0;
  z-index: 50;
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar__hamburger {
  color: var(--text-secondary);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.topbar__hamburger:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Search */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar__icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  pointer-events: none;
}

.search-bar__input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 7px 14px 7px 36px;
  font-size: 0.8125rem;
  color: var(--text-primary);
  width: 280px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), width var(--transition-base);
  outline: none;
}

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

.search-bar__input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
  width: 340px;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px;
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.theme-toggle:hover { background: var(--bg-hover); }

.theme-toggle__track {
  width: 36px;
  height: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-base);
  flex-shrink: 0;
}

[data-theme="light"] .theme-toggle__track {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform var(--transition-base), background var(--transition-base);
}

[data-theme="light"] .theme-toggle__thumb {
  transform: translateX(16px);
  background: #fff;
}

.theme-toggle__icon {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.theme-toggle__icon--dark { display: block; }
.theme-toggle__icon--light { display: none; }
[data-theme="light"] .theme-toggle__icon--dark { display: none; }
[data-theme="light"] .theme-toggle__icon--light { display: block; color: var(--brand-primary); }

/* Topbar Icon Buttons */
.topbar__icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.topbar__icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Topbar User */
.topbar__user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.topbar__user:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
}

.topbar__user-meta { display: flex; flex-direction: column; }

.topbar__user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar__user-email {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.topbar__chevron {
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-left: 2px;
}

/* ─── PAGE CONTENT ────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-track { background: var(--scrollbar-track); }
.page-content::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* Views */
.view { display: none; flex-direction: column; gap: var(--space-6); min-width: 0; }
.view.active { display: flex; }

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.page-header__left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  margin-left: auto;
}

/* Placeholder Views */
.placeholder-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  color: var(--text-muted);
  padding: var(--space-10);
  font-size: 0.875rem;
}

.placeholder-view__icon {
  font-size: 3rem;
  opacity: 0.25;
}

/* ────────────────────────────────────────────────────────────
   5. Components
──────────────────────────────────────────────────────────── */

/* ── Avatar ──────────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 2px var(--bg-surface);
}

.avatar--sm { width: 30px; height: 30px; font-size: 0.625rem; }
.avatar--xs { width: 22px; height: 22px; font-size: 0.5625rem; }

/* ── Badge ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 700;
  background: var(--brand-primary);
  color: #fff;
  line-height: 1;
}

/* Notification badge */
.topbar__icon-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  min-width: unset;
  padding: 0;
  font-size: 0.5rem;
  background: var(--color-danger);
}

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124,58,237,0.35);
}

.btn--primary:hover {
  background: #6d28d9;
  box-shadow: 0 6px 20px rgba(124,58,237,0.5);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn--ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ── View Toggle ─────────────────────────────── */
.view-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.view-toggle__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.view-toggle__btn.active {
  background: var(--brand-primary);
  color: #fff;
}

.view-toggle__btn:not(.active):hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ── Glass Card ──────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
}

/* ── Tags ────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.tag--stage {
  background: rgba(124,58,237,0.2);
  color: var(--brand-secondary);
  border: 1px solid rgba(124,58,237,0.3);
}

.tag--priority {
  background: rgba(239,68,68,0.15);
  color: #b42318;
  border: 1px solid rgba(239,68,68,0.25);
}

[data-theme="dark"] .tag--priority { color: #fecaca; }

/* ── Form Controls ───────────────────────────── */
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}

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

/* Consistent select chevron and breathing room across every form. */
select,
.selector-input,
.contacts-filter-select,
select.modal-form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364758b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px;
  padding-right: 46px;
}

select:focus,
.selector-input:focus,
.contacts-filter-select:focus,
select.modal-form-input:focus {
  background-position: right 16px center;
}

.panel-stage-select,
.panel-assignee-select {
  width: 100%;
  padding-right: 2.75rem;
}

.panel-stage-select { margin-bottom: var(--space-3); }

/* ────────────────────────────────────────────────────────────
   6. Kanban Board
──────────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  align-items: flex-start;
  flex: 1;
  min-height: 0;
}

.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-track { background: var(--scrollbar-track); }
.kanban-board::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ─── Column ──────────────────────────────────── */
.kanban-col {
  width: 260px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
}

.kanban-col__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  /* Top accent border via linear-gradient */
  position: relative;
  overflow: hidden;
}

.kanban-col__header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--col-accent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kanban-col__title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.kanban-col__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-col__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
}

.kanban-col__title[contenteditable="true"] {
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 1px;
}

.kanban-col__count { flex-shrink: 0; }

.kanban-col__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  position: relative;
}

.kanban-col__color-btn {
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.kanban-col__color-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Color Picker Popover */
.color-picker {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.color-picker.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.color-picker__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.4); }

/* Column Body (drop zone) */
.kanban-col__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  min-height: 120px;
  transition: background var(--transition-fast);
}

.kanban-col__body.drag-over {
  background: rgba(124,58,237,0.08);
  border-color: var(--brand-primary);
}

/* Add card button */
.kanban-col__add-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  width: 100%;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.kanban-col__add-card:hover {
  color: var(--brand-secondary);
  background: var(--bg-hover);
}

/* ─── Deal Card ───────────────────────────────── */
.deal-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 12px 12px 14px;
  cursor: grab;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

.deal-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
  pointer-events: none;
}

.deal-card:hover {
  border-color: var(--border-default);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}

.deal-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  transform: rotate(1deg) scale(1.02);
}

/* Priority indicator strip */
.deal-card__priority {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.deal-card__priority--high   { background: var(--priority-high); }
.deal-card__priority--medium { background: var(--priority-medium); }
.deal-card__priority--low    { background: var(--priority-low); }
.deal-card__priority--won    { background: var(--col-ganado); }

[data-theme="light"] .deal-card {
  background: rgba(255,255,255,0.46);
  border-color: rgba(148,163,184,0.2);
}
[data-theme="light"] .deal-card__priority--high { background: #fda4af; }
[data-theme="light"] .deal-card__priority--medium { background: #fbbf24; }
[data-theme="light"] .deal-card__priority--low { background: #a5b4fc; }
[data-theme="light"] .deal-card__priority--won { background: #6ee7b7; }

.deal-priority {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.35;
}

.deal-priority--high {
  color: #9f1239;
  background: rgba(255,228,230,0.78);
  border: 1px solid #fecdd3;
}
.deal-priority--medium {
  color: #92400e;
  background: rgba(254,243,199,0.82);
  border: 1px solid #fde68a;
}
.deal-priority--low {
  color: #3730a3;
  background: rgba(224,231,255,0.78);
  border: 1px solid #c7d2fe;
}
.deal-priority--won {
  color: #047857;
  background: rgba(209,250,229,0.78);
  border: 1px solid #a7f3d0;
}

[data-theme="dark"] .deal-priority--high {
  color: #fecaca;
  background: rgba(239,68,68,0.16);
  border-color: rgba(239,68,68,0.35);
}
[data-theme="dark"] .deal-priority--medium {
  color: #fde68a;
  background: rgba(245,158,11,0.16);
  border-color: rgba(245,158,11,0.35);
}
[data-theme="dark"] .deal-priority--low {
  color: #c7d2fe;
  background: rgba(99,102,241,0.18);
  border-color: rgba(99,102,241,0.35);
}
[data-theme="dark"] .deal-priority--won {
  color: #a7f3d0;
  background: rgba(16,185,129,0.16);
  border-color: rgba(16,185,129,0.35);
}

.deal-card__body { padding-left: 10px; margin-bottom: 12px; }

.deal-card__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
  line-height: 1.35;
}

.deal-card__company {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.deal-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 10px;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.deal-card__value {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-secondary);
  white-space: nowrap;
}

.deal-card__avatars {
  display: flex;
  gap: -4px;
}

.deal-card__avatars .avatar { box-shadow: 0 0 0 2px var(--glass-bg); }

.deal-card__date {
  font-size: 0.6875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Won card overlay */
.deal-card--won {
  background: linear-gradient(135deg, rgba(16,185,129,0.08), var(--bg-elevated));
}

[data-theme="light"] .deal-card--won {
  background: linear-gradient(135deg, rgba(209,250,229,0.34), rgba(255,255,255,0.42));
}

/* ─── New Status Column ───────────────────────── */
.kanban-col--new-status {
  width: 200px;
  min-width: 200px;
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
}

.btn-new-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-default);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
  min-height: 80px;
}

.btn-new-status i { font-size: 1.25rem; }

.btn-new-status:hover {
  border-color: var(--brand-primary);
  color: var(--brand-secondary);
  background: rgba(124,58,237,0.05);
}

/* ─── List View ───────────────────────────────── */
.list-view { flex: 1; }

.deals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.deals-table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.deals-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.deals-table tbody tr:hover { background: var(--bg-hover); }

.deals-table tbody td {
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  vertical-align: middle;
}

/* ────────────────────────────────────────────────────────────
   7. Contact Panel (Slide-over)
──────────────────────────────────────────────────────────── */
.contact-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--glass-border);
  box-shadow: -8px 0 40px rgba(0,0,0,0.4);
  z-index: 300;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
}

.contact-panel.open {
  transform: translateX(0);
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 290;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.panel-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Panel Header Bar (title + buttons in ONE row) */
.contact-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
  flex-shrink: 0;
  gap: var(--space-3);
  position: relative;
}

/* Accent top line */
.contact-panel__header::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent), transparent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.contact-panel__header-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.contact-panel__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.contact-panel__expand {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  position: relative;
}

.contact-panel__expand:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(124,58,237,0.35);
}

/* Close button */
.contact-panel__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: static;
}

.contact-panel__close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Panel inner */
.contact-panel__inner {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 0;
}

.contact-panel__inner::-webkit-scrollbar { width: 4px; }
.contact-panel__inner::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; }

/* Hero */
.contact-panel__hero {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding-top: var(--space-2);
  width: 100%;
  min-width: 0;
}

.contact-panel__avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(124,58,237,0.4);
}

.contact-panel__name {
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.contact-panel__deal-name {
  min-width: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  overflow-wrap: anywhere;
}

.contact-panel__meta {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.contact-panel__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}

/* Sections */
.panel-section {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
}

/* ── Lead Score ───────────────────────────────── */
.lead-score {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.lead-score__bar-bg {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.lead-score__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}

.lead-score__bar::after {
  content: '';
  position: absolute;
  right: 0; top: 0;
  width: 6px; height: 100%;
  background: rgba(255,255,255,0.6);
  border-radius: 50%;
  animation: scorePulse 2s ease-in-out infinite;
}

@keyframes scorePulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.1; }
}

.lead-score__labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lead-score__value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.lead-score__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
}

.lead-score__badge--hot {
  background: rgba(239,68,68,0.15);
  color: #b42318;
  border: 1px solid rgba(239,68,68,0.3);
}

.lead-score__badge--warm {
  background: rgba(245,158,11,0.15);
  color: #fcd34d;
}

.lead-score__badge--cold {
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
}

[data-theme="dark"] .lead-score__badge--hot {
  color: #fecaca;
}
[data-theme="light"] .lead-score__badge--warm {
  color: #8a4b00;
  border: 1px solid rgba(245,158,11,0.3);
}
[data-theme="light"] .lead-score__badge--cold {
  color: #3730a3;
  border: 1px solid rgba(99,102,241,0.25);
}

/* ── Contact Info List ────────────────────────── */
.contact-info-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.contact-info-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* The div that wraps the icon — explicit size + flex center */
.contact-info-list__icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* The <i> inside the box */
.contact-info-list__icon i {
  font-size: 0.875rem;
  color: var(--brand-primary);
  line-height: 1;
  display: block;
}

[data-theme="light"] .contact-info-list__icon {
  background: rgba(124, 58, 237, 0.07);
  border-color: rgba(124, 58, 237, 0.18);
}

.contact-info-list__label {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.contact-info-list__value {
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
}

.panel-value {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: var(--brand-secondary) !important;
}

/* ── Quick Actions ────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: var(--space-2);
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  font-size: 0.6875rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  min-width: 0;
}

.quick-action-btn i { font-size: 1rem; }

.quick-action-btn span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-action-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.quick-action-btn--whatsapp:hover { color: #25d366; border-color: #25d366; background: rgba(37,211,102,0.08); }
.quick-action-btn--email:hover    { color: var(--brand-accent); border-color: var(--brand-accent); background: rgba(6,182,212,0.08); }
.quick-action-btn--call:hover     { color: #10b981; border-color: #10b981; background: rgba(16,185,129,0.08); }
.quick-action-btn--note:hover     { color: var(--color-warning); border-color: var(--color-warning); background: rgba(245,158,11,0.08); }

/* ── Timeline ─────────────────────────────────── */
.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}

.timeline__item {
  display: flex;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  position: relative;
}

.timeline__item:last-child { padding-bottom: 0; }

.timeline__icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  flex-shrink: 0;
  z-index: 1;
  box-shadow: 0 0 0 3px var(--glass-bg);
}

.timeline__icon--email    { background: rgba(6,182,212,0.2);  color: var(--brand-accent); }
.timeline__icon--call     { background: rgba(16,185,129,0.2); color: #10b981; }
.timeline__icon--note     { background: rgba(245,158,11,0.2); color: var(--color-warning); }
.timeline__icon--meeting  { background: rgba(124,58,237,0.2); color: var(--brand-secondary); }
.timeline__icon--created  { background: rgba(148,163,184,0.2); color: var(--text-muted); }

.timeline__content { flex: 1; min-width: 0; padding-top: 4px; }

.timeline__action {
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 2px;
}

.timeline__time {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ────────────────────────────────────────────────────────────
   8. Modal
──────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal.open {
  opacity: 1;
  pointer-events: all;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.modal__box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 0;
  overflow: hidden;
  transform: scale(0.95) translateY(8px);
  transition: transform var(--transition-base);
}

.modal.open .modal__box {
  transform: scale(1) translateY(0);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal__close {
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.modal__close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal__body { padding: var(--space-6); }

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

.modal-colors {
  grid-template-columns: repeat(6, 1fr) !important;
}

/* ────────────────────────────────────────────────────────────
   9. Toasts
──────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: 500;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
  pointer-events: all;
  animation: toastIn var(--transition-base) forwards;
  max-width: 320px;
}

.toast i { font-size: 1rem; }
.toast--success i { color: var(--color-success); }
.toast--info    i { color: var(--color-info); }
.toast--warning i { color: var(--color-warning); }
.toast--error   i { color: var(--color-danger); }

.toast.toast--out { animation: toastOut var(--transition-base) forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ────────────────────────────────────────────────────────────
   10. Utilities & Animations
──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Fade in animation for views */
.view.active {
  animation: fadeUp 0.3s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Ghost drop placeholder */
.drag-placeholder {
  border: 2px dashed var(--brand-primary);
  border-radius: var(--radius-md);
  background: rgba(124,58,237,0.06);
  min-height: 80px;
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════════
   11. Executive Management Dashboard
════════════════════════════════════════════════════════════ */

.time-filter {
  display: flex;
  gap: var(--space-2);
}

.time-filter-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.time-filter-btn:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}

.time-filter-btn.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

/* KPI Grid for Executives */
.exec-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.exec-kpi-card {
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.exec-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.exec-kpi-icon--deals { background: rgba(124,58,237,0.2); color: var(--brand-secondary); }
.exec-kpi-icon--contacts { background: rgba(6,182,212,0.2); color: var(--brand-accent); }
.exec-kpi-icon--calls { background: rgba(16,185,129,0.2); color: var(--color-success); }
.exec-kpi-icon--conversion { background: rgba(245,158,11,0.2); color: var(--color-warning); }

.exec-kpi-content { flex: 1; }

.exec-kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 4px 0;
  font-weight: 600;
}

.exec-kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.exec-kpi-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Executive Management Section */
.exec-management {
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.exec-section-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-4) 0;
}

.exec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.exec-table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.exec-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.exec-table tbody tr:hover {
  background: var(--bg-hover);
}

.exec-table tbody td {
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  vertical-align: middle;
}

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 8px;
}

.role-badge.admin {
  background: rgba(124,58,237,0.2);
  color: var(--brand-secondary);
}

.role-badge.agent {
  background: rgba(6,182,212,0.2);
  color: var(--brand-accent);
}

.value-highlight {
  font-weight: 700;
  color: var(--brand-secondary);
}

.progress-bar {
  display: inline-block;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.btn-view-exec {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-view-exec:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Activity Section */
.exec-activity-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-6);
}

.exec-chart {
  padding: var(--space-6);
}

.chart-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-4) 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chart-placeholder {
  min-height: 280px;
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ════════════════════════════════════════════════════════════
   11B. CONTACTS SECTION (HUBSPOT STYLE)
════════════════════════════════════════════════════════════ */

.contacts-section {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: calc(100vh - 200px);
  min-width: 0;
}

/* Page Header Tabs */
.page-header__tabs {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.page-header__tab {
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-header__tab:hover,
.page-header__tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

/* Dashboard Tabs */
.dashboard-tabs {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  padding-bottom: 0;
}

.dashboard-tab {
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-tab:hover {
  color: var(--text-primary);
}

.dashboard-tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

/* Dashboard Panels */
.dashboard-panels {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.dashboard-panel {
  display: none;
}

.dashboard-panel.active {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3.5rem;
  margin-bottom: var(--space-4);
  opacity: 0.3;
}

.empty-state h3 {
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
}

.empty-state h3 {
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
}

/* ════════════════════════════════════════════════════════════
   API DASHBOARD PANELS (Meta Ads, GA4, etc.)
════════════════════════════════════════════════════════════ */

.api-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.api-panel-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.api-panel-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.api-icon {
  font-size: 1.5rem;
}

.api-icon--meta { color: #1877f2; }
.api-icon--google { color: #ea4335; }
.api-icon--linkedin { color: #0a66c2; }

.api-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
}

.api-status--ok { color: #10b981; }
.api-status--error { color: #ef4444; }

.api-panel-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.api-date-input {
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.8125rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.api-date-input:focus {
  border-color: var(--brand-primary);
}

/* KPI Row */
.api-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.api-kpi-row.kpi-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.api-kpi-row.kpi-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.api-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-4);
  min-width: 0;
  container-type: inline-size;
}

.api-kpi__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  overflow-wrap: break-word;
}

.api-kpi__value {
  font-size: clamp(1rem, 6cqi, 1.375rem);
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.2;
}

/* Data Table Card */
.api-table-card {
  padding: 0;
  overflow: hidden;
}

.api-table-title {
  padding: var(--space-4) var(--space-5);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.api-table-wrapper {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

.api-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.api-data-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.api-data-table thead th:hover {
  color: var(--text-primary);
}

.api-data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.api-data-table tbody tr:hover {
  background: var(--bg-hover);
}

.api-data-table tbody td {
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  white-space: nowrap;
}

.api-loading-cell {
  text-align: center !important;
  padding: var(--space-8) !important;
  color: var(--text-muted);
}

.api-error-cell {
  text-align: center !important;
  padding: var(--space-6) !important;
  color: #ef4444;
}

/* Metric badge pills */
.metric-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
}

.metric-pill--good { background: rgba(16,185,129,0.15); color: #10b981; }
.metric-pill--warn { background: rgba(245,158,11,0.15); color: #f59e0b; }
.metric-pill--bad  { background: rgba(239,68,68,0.15);  color: #ef4444; }

.btn--sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

/* Contacts Toolbar */
.contacts-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.contacts-search {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.contacts-search i {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
  pointer-events: none;
}

.contacts-search-input {
  flex: 1;
  padding: 8px 12px 8px 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.8125rem;
  outline: none;
  transition: all var(--transition-fast);
}

.contacts-search-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.contacts-toolbar-btn {
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.contacts-toolbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

/* Contacts Table */
.contacts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  flex: 1;
  overflow: auto;
}

.contacts-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 2;
}

.contacts-table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  user-select: none;
}

.checkbox-col { width: 40px; }
.nombre-col { width: 200px; min-width: 200px; }
.email-col { width: 200px; min-width: 200px; }
.tel-col { width: 140px; min-width: 140px; }
.propietario-col { width: 140px; min-width: 140px; }
.empresa-col { width: 160px; min-width: 160px; }
.actividad-col { width: 120px; min-width: 120px; }
.estado-col { width: 110px; min-width: 110px; }

.contacts-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.contacts-table tbody tr:hover {
  background: var(--bg-hover);
}

.contacts-table tbody tr.contact-row:hover {
  background-color: var(--bg-elevated);
}

.contacts-table tbody td {
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  vertical-align: middle;
  height: 48px;
}

/* Contact Name Cell */
.contact-name-cell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.contact-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.contact-name-cell strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Email Link */
.email-link {
  color: var(--brand-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.email-link:hover {
  text-decoration: underline;
}

/* Owner Badge */
.owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Pagination */
.contacts-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.page-indicator {
  font-weight: 600;
  color: var(--text-secondary);
}

.records-count {
  margin-left: auto;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--prospecto {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

.badge--calificado {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
}

.badge--propuesta {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge--negociacion {
  background: rgba(236, 72, 153, 0.15);
  color: #ec4899;
}

.badge--ganado {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* Score Badges */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
}

.score-hot {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.score-warm {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.score-cold {
  background: linear-gradient(135deg, #64748b, #475569);
}

.assignee-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.btn-contact-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: 0.75rem;
}

.btn-contact-action:hover {
  color: var(--brand-primary);
  background: var(--bg-hover);
}

/* ════════════════════════════════════════════════════════════
   12. EXPANDED CONTACT PANEL
════════════════════════════════════════════════════════════ */

.contact-panel__actions {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: flex;
  gap: var(--space-2);
  z-index: 10;
}

.contact-panel__expand,
.contact-panel__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.contact-panel__expand:hover,
.contact-panel__close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Expanded mode — full client management workspace */
/* ── EXPANDED: floating premium modal, NOT fullscreen ── */
.contact-panel.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1280px, 96vw);
  height: min(860px, 92vh);
  border-radius: var(--radius-xl, 20px);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 32px 80px rgba(0,0,0,0.5),
    0 0 0 1px rgba(124,58,237,0.15),
    inset 0 1px 0 rgba(255,255,255,0.06);
  z-index: 350;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  /* remove right: 0 from base panel */
  right: auto;
  translate: none;
}

/* Backdrop overlay when expanded */
.contact-panel.expanded::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: -1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.contact-panel.expanded .contact-panel__inner {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(280px, 300px) minmax(0, 1fr) 300px;
  gap: 0;
  overflow: hidden;
  padding: 0;
  min-height: 0;
}

/* Left col — profile, scrollable */
.contact-panel.expanded .cp-col-profile {
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* Center col — messaging */
.contact-panel.expanded .cp-col-timeline {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Right col — workspace */
.contact-panel.expanded .cp-col-workspace {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-subtle);
  overflow: hidden;
}

/* Collapsed mode — only profile column visible */
.cp-col-timeline,
.cp-col-workspace {
  display: none;
}

/* Expand icon toggle */
.contact-panel.expanded .contact-panel__expand i::before {
  content: '\f422'; /* fa-compress */
}

/* Workspace tabs in expanded panel */
.cp-workspace-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 var(--space-4);
  flex-shrink: 0;
}

.cp-workspace-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.cp-workspace-tab i {
  font-size: 0.9rem;
  line-height: 1;
}

.cp-workspace-tab span {
  line-height: 1.2;
  white-space: nowrap;
}

.cp-workspace-tab.active,
.cp-workspace-tab:hover {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.cp-workspace-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.cp-workspace-panel.active {
  display: flex;
}

/* Keep the AI workspace airy and contained inside the right panel. */
.cp-agent-chat {
  flex: 1;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: var(--space-5) var(--space-4) var(--space-4);
  gap: var(--space-3);
  background: transparent;
  border-radius: 0;
}

.cp-agent-chat .chat-bubble {
  max-width: min(88%, 280px);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-primary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: none;
}

.cp-agent-chat .chat-bubble p {
  margin: 0;
}

.cp-agent-chat + .chat-input-wrapper {
  margin: 0 var(--space-4) var(--space-4);
  flex-shrink: 0;
}

/* Compact checklist styling for the client workspace. */
.task-panel {
  gap: 0;
  overflow-y: auto;
  padding: var(--space-4);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.task-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 42px;
  padding: 9px 11px;
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.35;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.task-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.task-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--brand-primary);
  flex-shrink: 0;
}

.task-item input:checked + span {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.task-add {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.task-add .form-input {
  min-width: 0;
  padding: 8px 10px;
  font-size: 0.8125rem;
}

.task-add .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Timeline extended (only visible in expanded) */
.timeline-extended {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.timeline-extended .timeline__item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.timeline-extended .timeline__item:hover {
  border-color: var(--brand-primary);
}

/* Dashboard KPI styles */
.db-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.db-kpi-row.kpi-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.db-kpi-row.kpi-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.db-kpi-row.kpi-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.db-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  position: relative;
  overflow: hidden;
  min-width: 0;
  container-type: inline-size;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.db-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-primary), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.db-kpi:hover {
  transform: translateY(-2px);
}

.db-kpi:hover::before {
  opacity: 1;
}

.db-kpi__label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.db-kpi__value {
  font-size: clamp(1.15rem, 7cqi, 2rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  margin: var(--space-1) 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
  word-break: break-word;
}

.db-kpi__label {
  overflow-wrap: break-word;
}

.db-kpi__sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow-wrap: break-word;
}

.db-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-top: var(--space-1);
  width: fit-content;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.3;
}

.db-badge--ok   { background: rgba(16,185,129,0.12); color: #10b981; }
.db-badge--warn { background: rgba(245,158,11,0.12); color: #f59e0b; }
.db-badge--bad  { background: rgba(239,68,68,0.12);  color: #ef4444; }

/* Charts grid */
.db-charts-grid {
  display: grid;
  grid-template-columns: minmax(0,2fr) minmax(0,1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.db-charts-grid.chart-cols-wide { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
.db-charts-grid.chart-cols-even { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }

.db-chart-card { padding: var(--space-5); min-width: 0; overflow: hidden; }
.db-chart-card--wide { grid-column: auto; }

.db-chart-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.db-chart-title i { color: var(--brand-primary); }

/* Avatar */
.db-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Progress bars */
.db-prog-bg {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.db-prog-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

/* Funnel */
.db-funnel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.db-funnel-step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  position: relative;
}

.db-funnel-step::before {
  content: '';
  height: 28px;
  width: var(--w);
  background: var(--c);
  border-radius: var(--radius-sm);
  opacity: 0.75;
  transition: width 0.7s ease;
}

.db-funnel-label {
  position: absolute;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  pointer-events: none;
}

.db-funnel-val {
  position: absolute;
  right: var(--space-3);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* AI Box */
.db-ai-box {
  padding: var(--space-5);
  border: 1px solid rgba(124,58,237,0.3);
  background: linear-gradient(135deg, rgba(124,58,237,0.06), rgba(6,182,212,0.03));
}

.db-ai-box__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.db-ai-box__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--brand-primary);
  flex-shrink: 0;
}

.db-ai-box__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-primary);
}

.db-ai-box__sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.db-ai-box__content {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow-wrap: break-word;
}

.db-ai-box__content p {
  margin-bottom: var(--space-3);
}

.db-ai-box__content p:last-child {
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 1024px) {
  .exec-activity-section { grid-template-columns: 1fr; }
  .exec-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .exec-kpi-grid { grid-template-columns: 1fr; }
  .exec-table { font-size: 0.75rem; }
  .exec-table thead th,
  .exec-table tbody td { padding: var(--space-2); }
}
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-wrapper { width: 100%; }

  .contact-panel { width: 100%; }

  .search-bar__input { width: 200px; }
  .search-bar__input:focus { width: 240px; }

  .topbar__user-meta { display: none; }
}

@media (max-width: 640px) {
  .page-content { padding: var(--space-4); }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header__right { justify-content: flex-end; }
  .topbar { padding: 0 var(--space-4); }
  .kanban-col { width: 260px; min-width: 260px; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
}
/* ════════════════════════════════════════════════════════════
   BLACKOUT CRM — PHASE 2 STYLES
   styles-phase2.css  |  Nuevas Vistas & Componentes
════════════════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────────────────
   1. Logo Branding Fix (Dark Mode)
──────────────────────────────────────────────────────────── */

/* Force white logo in dark mode */
[data-theme="dark"] .sidebar__logo-img {
  filter: brightness(0) invert(1);
}

/* Keep original colors in light mode */
[data-theme="light"] .sidebar__logo-img {
  filter: none;
}

/* Better centering in sidebar logo container */
.sidebar__logo {
  display: flex;
  align-items: center;
  justify-content: center; /* Centered horizontally */
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  min-height: 72px;
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────
   2. Extended Color Palette (8 → 16 colors)
──────────────────────────────────────────────────────────── */

:root,
[data-theme="dark"] {
  /* Original 8 */
  --color-1:  #6366f1;  /* Indigo */
  --color-2:  #8b5cf6;  /* Violet */
  --color-3:  #06b6d4;  /* Cyan */
  --color-4:  #10b981;  /* Emerald */
  --color-5:  #f59e0b;  /* Amber */
  --color-6:  #ef4444;  /* Red */
  --color-7:  #ec4899;  /* Pink */
  --color-8:  #64748b;  /* Slate */
  
  /* New 8 pastel/soft tones */
  --color-9:  #a78bfa;  /* Purple Light */
  --color-10: #67e8f9;  /* Cyan Light */
  --color-11: #6ee7b7;  /* Green Light */
  --color-12: #fcd34d;  /* Yellow */
  --color-13: #fb7185;  /* Rose */
  --color-14: #d8b4fe;  /* Fuchsia Light */
  --color-15: #7c3aed;  /* Purple Dark */
  --color-16: #0ea5e9;  /* Sky */
}

/* ────────────────────────────────────────────────────────────
   3. PHASE 2 SPECIFIC COMPONENT STYLES
──────────────────────────────────────────────────────────── */

/* ════════════════════════════════════════════════════════════
   3A. CLIENT EXPANDED VIEW (3-Column Layout)
════════════════════════════════════════════════════════════ */

.client-view-grid {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: var(--space-6);
  align-items: start;
}

.client-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.client-col--profile {
  padding: var(--space-6);
  height: fit-content;
}

.client-col--workspace {
  padding: var(--space-6);
}

.client-col--widgets {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Profile Column */
.client-profile__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.client-profile__avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}

.client-profile__name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.client-profile__company {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

/* Selectors */
.client-profile__selectors {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.selector-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.selector-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.selector-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.8125rem;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.selector-input:hover,
.selector-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}

/* Info Block */
.client-info-block {
  padding: var(--space-4);
  background: var(--bg-hover);
  border-radius: var(--radius-md);
}

.client-info-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}

.client-info-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.client-info-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.client-info-item i {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.client-info-item div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.client-info-item .label {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.client-info-item .value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════
   WORKSPACE (Chat + IA Tabs)
════════════════════════════════════════════════════════════ */

.workspace-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-5);
  padding: 0 0 0 0;
}

.workspace-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
  outline: none;
}

.workspace-tab.active {
  color: var(--text-primary);
}

.workspace-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-primary);
  border-radius: 1px 1px 0 0;
}

.workspace-tab:hover {
  color: var(--text-primary);
}

/* Panels */
.workspace-panel {
  display: none;
  flex: 1;
}

.workspace-panel.active {
  display: flex;
  flex-direction: column;
}

/* ────────────────────────────────────────────────────────────
   CHAT INTERFACE
──────────────────────────────────────────────────────────── */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  min-height: 280px;
  max-height: 400px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.chat-msg--self {
  align-items: flex-end;
}

.chat-bubble {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  max-width: 75%;
  font-size: 0.8125rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-msg--other .chat-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.chat-msg--self .chat-bubble {
  background: var(--brand-primary);
  color: #fff;
}

.chat-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  padding: 0 var(--space-2);
}

/* Input Area */
.chat-input-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 8px;
  transition: border-color var(--transition-fast);
}

.chat-input-wrapper:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

.chat-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  padding: 8px;
  font-size: 0.8125rem;
  color: var(--text-primary);
}

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

.cp-agent-chat + .chat-input-wrapper {
  min-width: 0;
  padding: 4px 6px 4px 10px;
}

.cp-agent-chat + .chat-input-wrapper .chat-input {
  padding: 8px 4px;
  text-overflow: ellipsis;
}

.btn-send-chat {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.7rem;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-send-chat:hover {
  background: var(--brand-secondary);
  transform: translateY(-1px);
}

.chat-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8125rem;
  flex-shrink: 0;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.chat-action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.chat-send-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-primary);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.chat-send-btn:hover {
  background: #6d28d9;
}

/* ────────────────────────────────────────────────────────────
   IA SUMMARY PANEL
──────────────────────────────────────────────────────────── */

.ia-summary {
  padding: var(--space-6);
  background: linear-gradient(135deg, rgba(124,58,237,0.08), var(--glass-bg));
  border: 1px solid rgba(124,58,237,0.25);
  position: relative;
  overflow: hidden;
}

.ia-summary::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(124,58,237,0.2), transparent);
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
}

.ia-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
  color: var(--brand-secondary);
}

.ia-header i {
  font-size: 1.25rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.ia-header h3 {
  font-size: 0.875rem;
  font-weight: 700;
  margin: 0;
}

.ia-content {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

.ia-content p {
  margin-bottom: var(--space-2);
}

.ia-content p:last-child { margin-bottom: 0; }

.prob-high {
  color: var(--color-success);
  font-weight: 700;
}

/* ════════════════════════════════════════════════════════════
   WIDGETS (Right Column)
════════════════════════════════════════════════════════════ */

.widget {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-3);
}

.widget__title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.widget-action-btn {
  color: var(--text-muted);
  font-size: 0.75rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.widget-action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Score Bar */
.score-bar-bg {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: var(--radius-full);
  animation: scoreLoad 1s ease-out;
}

@keyframes scoreLoad {
  from { width: 0 !important; }
}

.score-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.score-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
}

.score-badge--hot {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
}

/* Widget content */
.widget__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.widget-date {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.widget-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.widget-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.widget-timeline li {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.widget-timeline i {
  color: var(--brand-secondary);
  font-size: 0.75rem;
}

.widget-note {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
  padding: var(--space-2);
  border-left: 3px solid var(--brand-primary);
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}

/* ════════════════════════════════════════════════════════════
   SOCIAL PLANNER
════════════════════════════════════════════════════════════ */

.social-month {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 150px;
}

/* Calendar */
.social-calendar {
  padding: var(--space-5);
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  text-align: center;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.calendar-header span {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-2);
  min-height: 400px;
}

.calendar-day {
  aspect-ratio: 1;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.calendar-day:hover {
  border-color: var(--brand-primary);
  background: var(--bg-hover);
}

.calendar-day.other-month {
  opacity: 0.3;
  cursor: default;
}

.calendar-day.today {
  border: 2px solid var(--brand-primary);
  background: rgba(124,58,237,0.08);
}

.calendar-day-num {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.calendar-day-posts {
  font-size: 0.625rem;
  color: var(--brand-secondary);
  overflow: hidden;
}

.calendar-post-indicator {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-secondary);
  margin-right: 2px;
}

/* Composer Modal */
.composer-modal {
  max-width: 500px;
}

.composer-textarea {
  width: 100%;
  min-height: 140px;
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition-fast);
  font-family: var(--font-body);
  margin-bottom: var(--space-4);
}

.composer-textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

.composer-textarea::placeholder { color: var(--text-muted); }

/* Drop zone */
.composer-drop-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  background: var(--bg-hover);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-4);
}

.composer-drop-zone:hover {
  border-color: var(--brand-primary);
  background: rgba(124,58,237,0.08);
}

.composer-drop-zone i {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.composer-drop-zone p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Platform checkboxes */
.composer-platforms {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.platform-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.platform-checkbox:hover {
  background: var(--bg-hover);
}

.platform-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.platform-checkbox i {
  font-size: 1rem;
  min-width: 24px;
}

/* ════════════════════════════════════════════════════════════
   AUTOMATIONS & EMAIL
════════════════════════════════════════════════════════════ */

.automation-tabs {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0;
}

.automation-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
  outline: none;
}

.automation-tab.active {
  color: var(--text-primary);
}

.automation-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-primary);
}

.automation-tab:hover { color: var(--text-primary); }

.automation-panel {
  display: none;
}

.automation-panel.active {
  display: block;
}

/* Workflow Builder */
.workflow-builder {
  padding: var(--space-6);
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-default);
  background: var(--bg-elevated);
  flex-shrink: 0;
  min-width: 200px;
  position: relative;
}

.workflow-step--trigger { border-color: #10b981; }
.workflow-step--condition { border-color: #f59e0b; }
.workflow-step--action { border-color: #06b6d4; }

.workflow-step__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.workflow-step--trigger .workflow-step__icon { color: #10b981; }
.workflow-step--condition .workflow-step__icon { color: #f59e0b; }
.workflow-step--action .workflow-step__icon { color: #06b6d4; }

.workflow-step__content { flex: 1; }

.workflow-step__label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0;
}

.workflow-step__text {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2px 0 0 0;
}

.workflow-arrow {
  color: var(--text-muted);
  font-size: 1rem;
  margin-left: var(--space-2);
}

/* Templates */
.templates-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-6);
}

.template-list {
  padding: var(--space-5);
  height: fit-content;
}

.template-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.template-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  transition: all var(--transition-fast);
}

.template-item:hover,
.template-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.template-item i { flex-shrink: 0; }

/* Editor */
.template-editor {
  padding: var(--space-6);
}

.editor-field {
  margin-bottom: var(--space-4);
}

.editor-field:last-of-type { margin-bottom: var(--space-5); }

.tag-hint {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: rgba(124,58,237,0.1);
  border-left: 3px solid var(--brand-primary);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.tag-hint i { color: var(--brand-secondary); }

/* ════════════════════════════════════════════════════════════
   ADS & ANALYTICS
════════════════════════════════════════════════════════════ */

.platform-filters {
  display: flex;
  gap: var(--space-2);
}

.platform-filter {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.platform-filter:hover,
.platform-filter.active {
  border-color: var(--brand-primary);
  color: var(--brand-secondary);
  background: var(--bg-hover);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.kpi-card {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.kpi-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.kpi-title i { font-size: 0.875rem; }

.kpi-compare {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.text-green { color: #10b981; }
.text-red { color: #ef4444; }

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.kpi-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-6);
}

.chart-container {
  padding: var(--space-6);
}

.chart-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.chart-placeholder {
  min-height: 300px;
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--text-muted);
}

.chart-placeholder i {
  font-size: 2rem;
  opacity: 0.4;
}

.chart-placeholder p {
  font-size: 0.8125rem;
  margin: 0;
}

/* ════════════════════════════════════════════════════════════
   INTEGRATIONS
════════════════════════════════════════════════════════════ */

.integrations-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.integration-card {
  flex: 1 1 160px;
  min-width: 160px;
  max-width: 220px;
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
}

.integration-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
  pointer-events: none;
}

.integration-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.meta-icon { background: rgba(0,150,255,0.15); color: #0096ff; }
.google-icon { background: rgba(234,67,53,0.15); color: #ea4335; }
.tiktok-icon { background: rgba(0,0,0,0.15); color: #000; }
.linkedin-icon { background: rgba(0,119,181,0.15); color: #0077b5; }
.mailchimp-icon { background: rgba(255,156,0,0.15); color: #ffc700; }
.whatsapp-icon { background: rgba(37,211,102,0.15); color: #25d366; }

[data-theme="light"] .tiktok-icon { color: #000; background: rgba(0,0,0,0.1); }

.integration-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  position: relative;
  z-index: 1;
}

.integration-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
  position: relative;
  z-index: 1;
}

.integration-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: relative;
  z-index: 1;
}

.integration-status.connected {
  color: #10b981;
}

.integration-status.disconnected {
  color: var(--text-muted);
}

.btn--sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  position: relative;
  z-index: 1;
}

/* ════════════════════════════════════════════════════════════
   Color Picker Extended (16 colors)
════════════════════════════════════════════════════════════ */

.color-picker__grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.color-picker__grid.modal-colors {
  grid-template-columns: repeat(8, 1fr);
}

/* ════════════════════════════════════════════════════════════
   Responsive
════════════════════════════════════════════════════════════ */

@media (max-width: 1440px) {
  .client-view-grid {
    grid-template-columns: 1fr;
  }

  .templates-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .client-view-grid { gap: var(--space-4); }
  .charts-grid { grid-template-columns: 1fr; }
  .integrations-grid { grid-template-columns: repeat(2, 1fr); }
  .composer-platforms { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .integrations-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   COMING SOON PLACEHOLDER
════════════════════════════════════════════════════════════ */
.coming-soon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-8);
  gap: var(--space-5);
  max-width: 640px;
  margin: 0 auto;
}

.coming-soon-icon {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 0 24px rgba(124,58,237,0.3));
}

.coming-soon-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.coming-soon-desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 480px;
}

.coming-soon-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-2);
}

.csf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.csf-chip i { color: var(--brand-primary); }

/* ════════════════════════════════════════════════════════════
   EXPANDED CONTACT PANEL — MobySuite / HubSpot style tabs
════════════════════════════════════════════════════════════ */
.contact-panel.expanded .cp-col-profile {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.contact-panel.expanded .cp-col-timeline {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Hub-style tab bar inside center column */
.cp-center-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 var(--space-5);
  flex-shrink: 0;
  gap: 2px;
  background: var(--bg-surface);
}

.cp-center-tab {
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cp-center-tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.cp-center-tab:hover {
  color: var(--text-primary);
}

.cp-center-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.cp-center-panel.active {
  display: flex;
}

.cp-activity-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  background: var(--bg-base);
}

.cp-activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cp-activity-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--glass-bg);
  border-color: var(--glass-border);
  box-shadow: none;
}

.cp-activity-card:hover {
  border-color: var(--border-default);
  background: var(--bg-hover);
}

.cp-activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cp-activity-icon--call {
  color: #047857;
  background: rgba(110,231,183,0.24);
}

.cp-activity-icon--missed {
  color: #b45309;
  background: rgba(253,230,138,0.3);
}

.cp-activity-copy {
  flex: 1;
  min-width: 0;
}

.cp-activity-title {
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
}

.cp-activity-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.6875rem;
  line-height: 1.35;
}

.cp-activity-action {
  width: 100%;
  margin-top: var(--space-5);
}

.cp-activity-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.cp-activity-form textarea {
  resize: none;
}

.cp-activity-form .btn {
  width: 100%;
}

/* WhatsApp style chat in center */
.cp-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--bg-base);
}

.cp-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.cp-chat-msg--in { align-self: flex-start; }
.cp-chat-msg--out { align-self: flex-end; }

.cp-chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  position: relative;
}

.cp-chat-msg--in .cp-chat-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 3px 12px 12px 12px;
  color: var(--text-primary);
}

.cp-chat-msg--out .cp-chat-bubble {
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.25);
  border-radius: 12px 3px 12px 12px;
  color: var(--text-primary);
}

.cp-chat-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
  padding: 0 4px;
}

.cp-chat-input-bar {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-3) var(--space-4);
  display: flex;
  gap: var(--space-2);
  align-items: center;
  background: var(--bg-surface);
  flex-shrink: 0;
}

.cp-chat-input-bar .form-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-full);
}

.cp-chat-actions {
  display: flex;
  gap: var(--space-1);
}

.cp-chat-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
}

.cp-chat-action-btn:hover {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.cp-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-primary);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.cp-send-btn:hover {
  background: var(--brand-secondary);
  transform: scale(1.05);
}

/* Right col in expanded (calendar/timeline/notes) */
.cp-col-workspace {
  display: none;
  flex-direction: column;
  border-left: 1px solid var(--border-subtle);
  overflow: hidden;
  background: var(--bg-surface);
}

.contact-panel.expanded .cp-col-workspace {
  display: flex;
}

/* ════════════════════════════════════════════════════════════
   FULL RESPONSIVENESS
════════════════════════════════════════════════════════════ */

/* Sidebar fix: never overflow, always show footer + toggle */
.sidebar {
  min-height: 0;
  overflow: hidden;
}

.sidebar__nav {
  min-height: 0;
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Collapsed sidebar: show avatar pill centered */
.sidebar.collapsed .sidebar__user-mini {
  display: flex;
  justify-content: center;
  width: 100%;
}

.sidebar.collapsed .sidebar__user-info,
.sidebar.collapsed .sidebar__logout {
  display: none;
}

/* Toggle always visible */
.sidebar__toggle {
  flex-shrink: 0;
}

/* ── Large desktop (1400px+) */
@media (min-width: 1400px) {
  .db-kpi-row { grid-template-columns: repeat(5, 1fr); }
  .db-charts-grid { grid-template-columns: 2fr 1fr; }
}

/* ── Desktop (1024–1400px) */
@media (max-width: 1400px) {
  .db-kpi-row { grid-template-columns: repeat(5, 1fr); }
}

/* ── Tablet landscape (769–1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 200px;
  }

  .db-kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .db-charts-grid {
    grid-template-columns: 1fr;
  }

  .contacts-table .propietario-col,
  .contacts-table .empresa-col {
    display: none;
  }

  .api-kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .contact-panel {
    width: min(420px, 95vw);
  }

  /* Expanded panel: 2 cols on tablet */
  .contact-panel.expanded .contact-panel__inner {
    grid-template-columns: 260px 1fr;
  }

  .contact-panel.expanded .cp-col-workspace {
    display: none;
  }
}

/* ── Tablet portrait (641–768px) */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 240px;
  }

  /* Sidebar becomes overlay on mobile */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 200;
    transition: transform var(--transition-slow);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  /* Topbar: show hamburger on mobile */
  .topbar__hamburger-mobile {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
  }

  .topbar__hamburger-mobile:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

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

  .db-kpi__value {
    font-size: 1.375rem;
  }

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

  .contact-panel {
    width: 100vw;
    right: 0;
  }

  .contact-panel.expanded .contact-panel__inner {
    grid-template-columns: 1fr;
  }

  .contact-panel.expanded .cp-col-timeline,
  .contact-panel.expanded .cp-col-workspace {
    display: none;
  }

  .contact-panel.expanded .cp-col-profile {
    width: 100%;
  }

  .contacts-table .tel-col,
  .contacts-table .actividad-col {
    display: none;
  }

  .contacts-toolbar {
    flex-wrap: wrap;
  }

  .dashboard-tabs {
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-tab {
    padding: var(--space-2) var(--space-3);
    font-size: 0.7rem;
  }
}

/* ── Phone (≤ 640px) */
@media (max-width: 640px) {
  .topbar {
    padding: 0 var(--space-3);
  }

  .search-bar__input {
    width: 180px;
  }

  .search-bar__input:focus {
    width: 220px;
  }

  .db-kpi-row {
    grid-template-columns: 1fr 1fr;
  }

  .db-kpi__value {
    font-size: 1.125rem;
  }

  .page-header {
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  .page-header__right {
    width: 100%;
    flex-wrap: wrap;
  }

  .api-kpi-row {
    grid-template-columns: 1fr 1fr;
  }

  .api-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .kanban-board {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .kanban-col {
    min-width: 280px;
  }

  .integrations-grid {
    gap: var(--space-3);
  }

  .integration-card {
    min-width: 140px;
  }
}

/* ════════════════════════════════════════════════════════════
   PREMIUM PANEL UPGRADES
════════════════════════════════════════════════════════════ */

/* Premium panel header */
.contact-panel__header {
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
}

.contact-panel__header::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent), transparent);
  opacity: 0.6;
}

/* Premium hero area */
.contact-panel__hero {
  padding: var(--space-5);
  background: linear-gradient(135deg,
    rgba(124,58,237,0.08),
    rgba(6,182,212,0.04)
  );
  border-radius: var(--radius-md);
  border: 1px solid rgba(124,58,237,0.12);
}

/* Premium avatar */
.contact-panel__avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(124,58,237,0.35);
}

/* Premium lead score bar */
.lead-score__bar {
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: var(--radius-full);
  transition: width 0.9s cubic-bezier(.16,1,.3,1);
}

/* Premium quick action buttons */
.quick-action-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-3) var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-action-btn i {
  font-size: 1.125rem;
}

.quick-action-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: rgba(124,58,237,0.08);
  transform: translateY(-1px);
}

.quick-action-btn--whatsapp:hover {
  border-color: #25d366;
  color: #25d366;
  background: rgba(37,211,102,0.08);
}

.quick-action-btn--email:hover {
  border-color: var(--brand-accent);
  color: var(--brand-accent);
  background: rgba(6,182,212,0.08);
}

.quick-action-btn--call:hover {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16,185,129,0.08);
}

/* Premium panel section */
.panel-section {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-4);
}

.panel-section:last-child {
  border-bottom: none;
}

/* Premium panel section title */
.panel-section__title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.panel-section__title i {
  color: var(--brand-primary);
}
/* ═══════════════════════════════════════════════════════════════
   CONTACTS MODULE — Enhanced (CSV Import · AI Segmentation ·
   Full HubSpot fields · Responsive table · New Contact Modal)
   ═══════════════════════════════════════════════════════════════ */

/* ── Contacts Page Header Actions ── */
.contacts-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Lifecycle Stats Bar ── */
.contacts-stats-bar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.csb-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: var(--glass-bg, rgba(255,255,255,0.05));
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.csb-pill:hover { border-color: var(--brand-primary); }
.csb-pill.active {
  border-color: var(--brand-primary);
  background: rgba(var(--brand-rgb, 124,58,237), 0.12);
}
.csb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.csb-label { color: var(--text-muted); }
.csb-count { font-weight: 700; color: var(--text-primary); }

/* ── Tools Row: Import + AI ── */
.contacts-tools-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.1rem;
  width: 100%;
}

/* ── CSV Import Card ── */
.contacts-import-card {
  padding: 0;
  overflow: hidden;
  width: 100%;
}
.import-dropzone {
  min-height: 210px;
  padding: 2.5rem 2rem;
  text-align: center;
  border: 2px dashed var(--glass-border, rgba(255,255,255,0.1));
  border-radius: var(--radius-lg, 14px);
  cursor: pointer;
  transition: all 0.22s;
}
.import-dropzone.drag-over {
  border-color: var(--brand-primary);
  background: rgba(124,58,237,0.08);
  transform: scale(1.01);
}
.import-dropzone__icon {
  font-size: 2.2rem;
  margin-bottom: 0.65rem;
  background: linear-gradient(135deg, var(--brand-primary, #7c3aed), var(--brand-secondary, #06b6d4));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.import-dropzone__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.import-dropzone__sub { font-size: 0.82rem; color: var(--text-muted); }
.import-dropzone__browse {
  color: var(--brand-primary);
  cursor: pointer;
  font-weight: 500;
  text-decoration: underline;
}
.import-dropzone__hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.65rem;
  opacity: 0.7;
}

/* Import Preview */
.import-preview { padding: 1.1rem; }
.import-preview__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.07));
}
.import-preview__icon { font-size: 1.75rem; color: #22c55e; flex-shrink: 0; }
.import-preview__meta { flex: 1; min-width: 0; }
.import-preview__filename { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.import-preview__count { font-size: 0.78rem; color: var(--text-muted); }
.import-preview__table-wrap {
  max-height: 160px;
  overflow: auto;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.07));
}
.import-preview__table { width: 100%; border-collapse: collapse; font-size: 0.77rem; }
.import-preview__table th {
  background: rgba(255,255,255,0.05);
  padding: 5px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.import-preview__table td {
  padding: 4px 10px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.05));
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.import-preview__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ── AI Segmentation Card ── */
.contacts-ai-card {
  width: 100%;
  padding: 1.5rem;
}
.ai-seg__header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}
.ai-seg__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-primary, #7c3aed), var(--brand-secondary, #06b6d4));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.ai-seg__title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.ai-seg__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}
.ai-seg__input-row {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}
.ai-seg__input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
  border-radius: var(--radius-md, 10px);
  padding: 0.48rem 0.8rem;
  color: var(--text-primary);
  font-size: 0.83rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.ai-seg__input:focus { border-color: var(--brand-primary); }
.ai-seg__input::placeholder { color: var(--text-muted); opacity: 0.65; }
.ai-seg__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}
.ai-seg__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 9px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.74rem;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}
.ai-seg__chip:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: rgba(124,58,237,0.1);
}
.ai-seg__result {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.7rem;
  background: rgba(124,58,237,0.08);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius-md, 10px);
}
.ai-seg__result-icon { color: var(--brand-primary); font-size: 0.95rem; flex-shrink: 0; margin-top: 2px; }
.ai-seg__result-body { flex: 1; min-width: 0; }
.ai-seg__result-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.45rem;
}

/* ── Enhanced Contacts Toolbar ── */
.contacts-filter-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
  border-radius: var(--radius-sm, 6px);
  padding: 0.38rem 0.7rem;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.contacts-result-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 0.25rem;
}
.contacts-toolbar-right { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.contacts-view-switch {
  display: flex;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
}
.contacts-view-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.18s;
}
.contacts-view-btn.active { background: rgba(124,58,237,0.18); color: var(--brand-primary); }
.contacts-view-btn:hover:not(.active) { background: rgba(255,255,255,0.05); }

/* ── Contacts Table: Horizontal scroll + full columns ── */
.contacts-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 0 0; /* fits inside glass-card */
}
.contacts-table {
  width: 100%;
  min-width: 1100px; /* forces horizontal scroll on small screens */
  border-collapse: collapse;
}
.contacts-table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.07));
  background: rgba(255,255,255,0.025);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.contacts-table thead th.sortable-col { cursor: pointer; }
.contacts-table thead th.sortable-col:hover { color: var(--text-primary); }
.contacts-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  cursor: pointer;
}
.contacts-table tbody tr:hover { background: rgba(255,255,255,0.04); }

/* New cells */
.contact-score-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 90px;
}
.contact-score-bar-bg {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.contact-score-bar-fill { height: 100%; border-radius: 999px; }
.contact-score-num { font-size: 0.78rem; font-weight: 700; min-width: 26px; text-align: right; }

.lifecycle-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.lifecycle-badge--suscriptor { background: rgba(148,163,184,0.12); color: #94a3b8; }
.lifecycle-badge--lead       { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.lifecycle-badge--mql        { background: rgba(99,102,241,0.15);  color: #a5b4fc; }
.lifecycle-badge--sql        { background: rgba(139,92,246,0.15);  color: #c4b5fd; }
.lifecycle-badge--oportunidad{ background: rgba(249,115,22,0.15);  color: #fb923c; }
.lifecycle-badge--cliente    { background: rgba(34,197,94,0.15);   color: #4ade80; }

.contact-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.2rem;
}
.contact-row-action {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.15s;
}
.contact-row-action:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--glass-border, rgba(255,255,255,0.1));
  color: var(--text-primary);
}

/* ── Contacts Grid View ── */
.contacts-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.85rem;
  padding: 0.85rem;
}
.cgv-card {
  background: rgba(255,255,255,0.025);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.07));
  border-radius: var(--radius-md, 10px);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.18s;
}
[data-theme="light"] .cgv-card {
  background: rgba(255,255,255,0.28);
  border-color: rgba(148,163,184,0.16);
}
.cgv-card:hover { transform: translateY(-2px); border-color: var(--brand-primary); }
.cgv-top { display: flex; align-items: flex-start; gap: 0.65rem; margin-bottom: 0.65rem; }
.cgv-ava {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.cgv-name { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.cgv-sub  { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.cgv-body { font-size: 0.76rem; color: var(--text-muted); }
.cgv-body p { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.2rem; }
.cgv-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* ── New Contact Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  z-index: 800;
  animation: fadeIn 0.2s ease;
}
.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.97);
  z-index: 810;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.import-modal {
  max-width: 680px;
  border-radius: var(--radius-lg);
}
.import-modal__body {
  padding: 1.1rem 1.25rem 1.25rem;
}
.import-modal__intro {
  margin-bottom: 0.85rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}
.import-modal .contacts-import-card {
  background: transparent;
  border: 0;
}
.import-modal .import-dropzone {
  min-height: 220px;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translate(-50%, -45%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
.modal-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.07));
}
.modal-dialog__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.modal-dialog__close {
  background: none;
  border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
}
.modal-dialog__close:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }
.modal-dialog__body { padding: 1rem 1.25rem; }
.modal-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem 1.25rem;
  border-top: 1px solid var(--glass-border, rgba(255,255,255,0.07));
}
.modal-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0; }
.modal-form-group { margin-bottom: 0.85rem; }
.modal-form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.modal-form-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
  border-radius: var(--radius-md, 10px);
  padding: 0.52rem 0.8rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.modal-form-input:focus { border-color: var(--brand-primary); }
.modal-form-input::placeholder { color: var(--text-muted); opacity: 0.6; }

/* ── Responsive: Contacts ── */
@media (max-width: 1024px) {
  .contacts-tools-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  .contacts-header-actions { width: 100%; }
  .contacts-header-actions .btn { flex: 1; justify-content: center; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .contacts-stats-bar { gap: 0.4rem; }
  .csb-pill { font-size: 0.73rem; padding: 0.3rem 0.65rem; }
  .contacts-toolbar { flex-wrap: wrap; gap: 0.5rem; }
  .contacts-filter-select { flex: 1; min-width: 120px; }
  .contacts-table { min-width: 900px; }
  .modal-form-row { grid-template-columns: 1fr; }
  .modal-dialog { max-width: calc(100vw - 2rem); }
  .import-modal__body { padding: 0.9rem; }
}

@media (max-width: 480px) {
  .contacts-tools-row { display: grid; gap: 0.85rem; }
  .import-modal .import-dropzone { min-height: 190px; padding: 2rem 1rem; }
  .contacts-ai-card { padding: 1.1rem; }
  .ai-seg__input-row { flex-direction: column; }
  .ai-seg__input-row .btn { width: 100%; justify-content: center; }
  .contacts-view-switch { display: none; }
}

/* ════════════════════════════════════════════════════════════
   GLOBAL DASHBOARD DATE FILTER
════════════════════════════════════════════════════════════ */
.dashboard-toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-1);
}

/* Final select normalization: component backgrounds must not reset the chevron. */
select {
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364758b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  background-size: 14px !important;
  padding-right: 46px !important;
}

.global-date-filter {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
  width: 100%;
}

.global-date-filter__range {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.global-date-filter__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.global-date-filter__presets {
  display: flex;
  gap: var(--space-2);
}

.date-preset-btn {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.date-preset-btn:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}

.date-preset-btn.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.global-date-filter__hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* ════════════════════════════════════════════════════════════
   META ADS — PROJECT PERFORMANCE CARDS
════════════════════════════════════════════════════════════ */
.meta-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.meta-project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.meta-project-card__name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-project-card__metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.meta-project-card__metric-value {
  overflow-wrap: break-word;
}

.meta-project-card__metric-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.meta-project-card__metric-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.api-table-title__count {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: normal;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.action-pill--scale  { background: rgba(16,185,129,0.14); color: #10b981; }
.action-pill--watch  { background: rgba(245,158,11,0.14); color: #f59e0b; }
.action-pill--pause  { background: rgba(239,68,68,0.14);  color: #ef4444; }

.ai-heuristic-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: var(--space-2);
}

@media (max-width: 1024px) {
  .global-date-filter { width: 100%; justify-content: space-between; }
}

@media (max-width: 640px) {
  .global-date-filter { flex-direction: column; align-items: stretch; }
  .global-date-filter__presets { justify-content: space-between; }
  .date-preset-btn { flex: 1; text-align: center; }
}
