@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --primary: #1B4F72;
  --primary-light: #2E86C1;
  --accent: #F39C12;
  --accent-light: #F8C471;
  --success: #1E8449;
  --danger: #C0392B;
  --warning: #D68910;
  --info: #2980B9;
  --bg: #F4F6F8;
  --card-bg: #FFFFFF;
  --text: #1C2833;
  --text-muted: #7F8C8D;
  --border: #E5E8EC;
  --shadow: 0 2px 12px rgba(27,79,114,0.08);
  --shadow-lg: 0 8px 32px rgba(27,79,114,0.12);
  --radius: 12px;
  --radius-lg: 18px;
  --navbar-h: 60px;
  --bottomnav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
  padding-top: var(--navbar-h);
  padding-bottom: var(--bottomnav-h);
}

/* ===== NAVBAR ===== */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  background: var(--primary);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 1000;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.topnav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: white;
  text-decoration: none;
  letter-spacing: -0.3px;
  flex: 1;
}
.topnav-brand span { color: var(--accent); }
.topnav-action {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  font-size: 16px;
  transition: background 0.2s;
}
.topnav-action:hover { background: rgba(255,255,255,0.25); color: white; }
.topnav-badge { position: relative; }
.topnav-badge .badge {
  position: absolute;
  top: -2px; right: -2px;
  font-size: 9px;
  padding: 2px 4px;
  background: var(--accent) !important;
  color: #fff;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 1000;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item i { font-size: 20px; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}
.bottom-nav-fab {
  background: var(--accent);
  color: white !important;
  border-radius: 50%;
  width: 52px; height: 52px;
  margin-top: -20px;
  box-shadow: 0 4px 16px rgba(243,156,18,0.4);
  border: 3px solid white;
  flex: 0 0 auto;
  align-self: center;
  margin-left: auto;
  margin-right: auto;
}
.bottom-nav-fab i { font-size: 22px !important; }

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 12px 16px;
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 16px; }

/* ===== STAT CARDS ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.stat-primary::before { background: var(--primary-light); }
.stat-card.stat-success::before { background: var(--success); }
.stat-card.stat-warning::before { background: var(--warning); }
.stat-card.stat-danger::before { background: var(--danger); }
.stat-card.stat-info::before { background: var(--info); }
.stat-card.stat-accent::before { background: var(--accent); }
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.stat-icon {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 36px;
  opacity: 0.06;
}

/* ===== PROSPECT CARDS ===== */
.prospect-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 13px 14px;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.prospect-card:active { transform: scale(0.98); box-shadow: none; }
.prospect-card:hover { color: inherit; text-decoration: none; }

.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar.converti { background: linear-gradient(135deg, #27AE60, #1E8449); }
.avatar.perdu { background: linear-gradient(135deg, #E74C3C, #C0392B); }
.avatar.nouveau { background: linear-gradient(135deg, #3498DB, #2980B9); }
.avatar.qualifie { background: linear-gradient(135deg, #F39C12, #D68910); }
.avatar.en_cours { background: linear-gradient(135deg, #808B96, #5D6D7E); }

.prospect-info { flex: 1; min-width: 0; }
.prospect-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prospect-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prospect-chevron { color: var(--text-muted); font-size: 14px; flex-shrink: 0; }

/* ===== BADGES ===== */
.badge-statut {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-nouveau { background: #EBF5FB; color: #2980B9; }
.badge-contacte { background: #EBF5FB; color: #1B4F72; }
.badge-qualifie { background: #FEF9E7; color: #D68910; }
.badge-en_cours { background: #F2F3F4; color: #5D6D7E; }
.badge-converti { background: #EAFAF1; color: #1E8449; }
.badge-perdu { background: #FDEDEC; color: #C0392B; }

/* ===== PAGE HEADER ===== */
.page-header {
  background: var(--primary);
  color: white;
  padding: 20px 16px 28px;
  margin-bottom: -16px;
}
.page-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.page-header p { font-size: 13px; opacity: 0.75; margin: 0; }

/* ===== MAIN CONTENT ===== */
.main-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===== SEARCH BAR ===== */
.search-bar { display: flex; gap: 8px; align-items: center; }
.search-bar .form-control {
  border-radius: 24px;
  border: 1.5px solid var(--border);
  padding: 10px 16px;
  font-size: 14px;
  background: white;
}
.search-bar .form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(46,134,193,0.1);
}
.btn-filter {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  display: flex; align-items: center;
  white-space: nowrap;
  font-size: 13px;
  gap: 4px;
  cursor: pointer;
}

/* ===== FORMS ===== */
.form-label {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(46,134,193,0.1);
  outline: none;
}
.form-section {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.form-section-header {
  padding: 12px 16px;
  background: #F8FAFB;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-section-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* ===== BUTTONS ===== */
.btn {
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #27AE60; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-light { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-accent { background: var(--accent); color: white; }
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:active { transform: scale(0.97); }

/* ===== TIMELINE ===== */
.timeline { position: relative; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 19px; top: 40px; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--bg);
  border: 2px solid var(--border);
}
.timeline-icon.positif { background: #EAFAF1; border-color: #27AE60; color: #1E8449; }
.timeline-icon.negatif { background: #FDEDEC; border-color: #E74C3C; color: #C0392B; }
.timeline-icon.sans_reponse { background: #FEF9E7; border-color: #F39C12; color: #D68910; }
.timeline-content { flex: 1; }
.timeline-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.timeline-date { font-size: 11px; color: var(--text-muted); }
.timeline-body {
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border-radius: 8px;
  padding: 10px;
  line-height: 1.5;
}

/* ===== PIPELINE ===== */
.pipeline-column {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  flex: 0 0 260px;
}
.pipeline-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
}
.pipeline-count {
  background: rgba(255,255,255,0.35);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 12px;
  margin-left: auto;
}
.pipeline-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.pipeline-card {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px;
  text-decoration: none;
  color: inherit;
  display: block;
  border: 1px solid var(--border);
  transition: transform 0.15s;
}
.pipeline-card:hover { transform: translateX(2px); color: inherit; }
.pipeline-card-name { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.pipeline-card-sub { font-size: 11px; color: var(--text-muted); }
.pipeline-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.pipeline-scroll::-webkit-scrollbar { height: 4px; }
.pipeline-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== ALERTS ===== */
.alert { border-radius: var(--radius); border: none; padding: 12px 16px; font-size: 13px; }
.alert-success { background: #EAFAF1; color: #1E8449; }
.alert-danger { background: #FDEDEC; color: #C0392B; }
.alert-warning { background: #FEF9E7; color: #D68910; }
.alert-info { background: #EBF5FB; color: #2980B9; }

/* ===== DETAIL PAGE ===== */
.detail-header {
  background: var(--primary);
  color: white;
  padding: 20px 16px;
}
.detail-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  border: 2px solid rgba(255,255,255,0.3);
}
.detail-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.detail-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.action-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s;
}
.action-btn:hover { background: rgba(255,255,255,0.25); color: white; }
.action-btn.danger { background: rgba(192,57,43,0.5); border-color: rgba(192,57,43,0.5); }

/* ===== INFO ROWS ===== */
.info-row {
  display: flex;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  align-items: flex-start;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  min-width: 100px;
  flex-shrink: 0;
  padding-top: 2px;
}
.info-value { font-size: 14px; font-weight: 500; color: var(--text); flex: 1; }

/* ===== FILTER DRAWER ===== */
.filter-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1100;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.filter-overlay.show { opacity: 1; pointer-events: all; }
.filter-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  z-index: 1200;
  padding: 16px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 85vh;
  overflow-y: auto;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.filter-drawer.show { transform: translateY(0); }
.filter-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 0 auto 16px;
}

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--primary) 0%, #0D2B45 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: white;
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(27,79,114,0.3);
}
.login-title { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; color: var(--text); }
.login-title span { color: var(--primary); }

/* ===== UTILITIES ===== */
.fw-600 { font-weight: 600; }
.text-primary-custom { color: var(--primary) !important; }
.tel-link { color: var(--primary-light); text-decoration: none; font-weight: 600; }
.tel-link:hover { color: var(--primary); }

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.main-content > * { animation: fadeSlideUp 0.25s ease forwards; }
.main-content > *:nth-child(2) { animation-delay: 0.05s; }
.main-content > *:nth-child(3) { animation-delay: 0.1s; }
.main-content > *:nth-child(4) { animation-delay: 0.15s; }

/* ===== DESKTOP ===== */
@media (min-width: 768px) {
  body { padding-top: 64px; padding-bottom: 0; }
  .topnav { height: 64px; padding: 0 24px; }
  .bottom-nav { display: none; }
  .main-content { padding: 24px; max-width: 1000px; margin: 0 auto; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .page-header { padding: 28px 24px 40px; }
}
@media (min-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(6, 1fr); }
}
