/* ============================================================
   STEVENY LEADS — STYLE PRINCIPAL
   ============================================================ */

:root {
  /* Charte graphique Steveny */
  --primary: #25323e;
  --primary-light: #484f54;
  --primary-dark: #1a1b19;
  --accent: #f28500;
  --accent-light: #ffb84d;
  --accent-dark: #c96e00;
  --surface: #484f54;
  --surface-light: #c7cfd1;
  --surface-muted: #d6d6d6;

  /* Couleurs sémantiques */
  --blue: #3b82c4;
  --blue-light: #e8f1fa;
  --blue-dark: #25323e;
  --orange: #f28500;
  --orange-light: #fff4e6;
  --green: #2f855a;
  --green-light: #f0fff4;
  --red: #c53030;
  --red-light: #fff5f5;
  --purple: #6b46c1;

  /* Niveaux de gris — mappés sur la charte */
  --gray-50: #f5f6f7;
  --gray-100: #eceef0;
  --gray-200: #d6d6d6;
  --gray-300: #c7cfd1;
  --gray-400: #9ca3af;
  --gray-500: #484f54;
  --gray-600: #3d4349;
  --gray-700: #2e3439;
  --gray-800: #25323e;
  --gray-900: #1a1b19;

  --sidebar-width: 240px;
  --header-height: 60px;
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; outline: none; }
textarea { resize: vertical; }

/* ---- UTILITY ---- */
.hidden { display: none !important; }
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }
.p-0 { padding: 0 !important; }

/* ============================================================
   SCREENS
   ============================================================ */
.screen { display: none; }
.screen.active { display: block; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#screen-login {
  min-height: 100vh;
  background: linear-gradient(145deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
#screen-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 40px,
    rgba(242,133,0,0.04) 40px,
    rgba(242,133,0,0.04) 80px
  );
}
#screen-login.active { display: flex; }

.login-wrapper { width: 100%; max-width: 420px; position: relative; z-index: 1; }

.login-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  border-top: 4px solid var(--accent);
}

.login-logo { text-align: center; margin-bottom: 32px; }

.login-logo-img {
  height: 52px;
  display: block;
  margin: 0 auto 12px;
  filter: none;
}

.login-logo-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.login-logo-title span { color: var(--accent); }

.login-logo p {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 4px;
}

.login-form .form-group { margin-bottom: 16px; }

.login-form .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-form .form-group label i { margin-right: 6px; color: var(--gray-400); }

.login-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--gray-800);
}

.login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242,133,0,0.12);
}

.login-error {
  background: var(--red-light);
  border: 1px solid #fca5a5;
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--border-radius);
  font-size: 13px;
  margin-bottom: 12px;
}

.forgot-password {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--accent);
  margin-top: 12px;
}
.forgot-password:hover { text-decoration: underline; }

.login-demo {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.login-demo p {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 8px;
  text-align: center;
}

.demo-accounts { display: flex; flex-direction: column; gap: 6px; }

.demo-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: var(--gray-50);
  font-size: 13px;
  color: var(--gray-700);
  transition: all 0.15s;
  text-align: left;
}
.demo-btn:hover { background: var(--gray-100); border-color: var(--accent); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#screen-app { min-height: 100vh; flex-direction: column; }
#screen-app.active { display: flex; }

/* ---- HEADER ---- */
.app-header {
  height: var(--header-height);
  background: var(--primary-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 0;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  border-bottom: 2px solid var(--accent);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: var(--sidebar-width);
}

.sidebar-toggle {
  width: var(--header-height);
  height: var(--header-height);
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.sidebar-toggle:hover { color: var(--accent); }

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.01em;
}

.app-logo img {
  height: 28px;
  display: block;
  filter: brightness(0) invert(1);
}

.app-logo .logo-text span { color: var(--accent); }

.header-center { flex: 1; padding: 0 20px; }

.breadcrumb { font-size: 13px; color: rgba(255,255,255,0.45); }

.header-right { display: flex; align-items: center; gap: 8px; }

.header-btn {
  position: relative;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.header-btn:hover { background: rgba(242,133,0,0.2); color: var(--accent); }

.badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.header-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.header-user:hover { background: rgba(255,255,255,0.08); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: white; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.5); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  min-width: 210px;
  z-index: 200;
  overflow: hidden;
  display: none;
  border-top: 3px solid var(--accent);
}
.user-dropdown.open { display: block; }

.user-dropdown .dropdown-header {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.user-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--gray-700);
  text-align: left;
  transition: background 0.1s;
}
.user-dropdown button:hover { background: var(--gray-50); color: var(--accent); }
.user-dropdown hr { border: none; border-top: 1px solid var(--gray-200); }

/* ---- APP LAYOUT ---- */
.app-layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  border-right: none;
  position: fixed;
  top: var(--header-height);
  left: 0; bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.25s ease;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}
.sidebar.collapsed { transform: translateX(-100%); }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section { padding: 0 8px; }

.nav-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--border-radius);
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  transition: all 0.15s;
  cursor: pointer;
  margin-bottom: 1px;
  position: relative;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }

.nav-item.active {
  background: rgba(242,133,0,0.15);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.nav-badge-alert { background: var(--red); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-role-info { font-size: 11px; color: rgba(255,255,255,0.4); text-align: center; }

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
  transition: margin-left 0.25s ease;
  background: var(--gray-100);
}
.main-content.expanded { margin-left: 0; }

/* ---- PAGES ---- */
.page { display: block; }
.page.hidden { display: none; }

.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.result-count { font-size: 13px; color: var(--gray-500); }

/* ---- KPI GRID ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); max-width: 700px; }

.kpi-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
}
.kpi-blue { border-left-color: var(--blue); }
.kpi-orange { border-left-color: var(--orange); }
.kpi-green { border-left-color: var(--green); }
.kpi-red { border-left-color: var(--red); }

.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.kpi-blue .kpi-icon { background: var(--blue-light); color: var(--blue); }
.kpi-orange .kpi-icon { background: var(--orange-light); color: var(--orange); }
.kpi-green .kpi-icon { background: var(--green-light); color: var(--green); }
.kpi-red .kpi-icon { background: var(--red-light); color: var(--red); }

.kpi-content { flex: 1; min-width: 0; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.kpi-label { font-size: 13px; color: var(--gray-500); margin-top: 4px; font-weight: 500; }
.kpi-trend { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }
.trend-neutral { color: var(--gray-500); }

/* ---- DASHBOARD GRID ---- */
.dashboard-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; margin-bottom: 16px; }
.dashboard-grid-3 { grid-template-columns: 1fr 1fr 220px; }
/* 3e colonne du dashboard : cartes de répartition empilées (marque, type) */
.dashboard-side-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---- CARDS ---- */
.card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h3 i { color: var(--accent); }
.card-body { padding: 16px 20px; }
.card-body.p-0 { padding: 0; }

/* ---- ALERTS ---- */
.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--border-radius);
  margin-bottom: 8px;
  font-size: 13px;
}
.alert-item > i { font-size: 18px; flex-shrink: 0; }
.alert-item > div { flex: 1; }
.alert-item > div strong { display: block; font-weight: 600; }
.alert-item > div span { color: var(--gray-500); font-size: 12px; }
.alert-warning { background: #fffbeb; border: 1px solid #fcd34d; }
.alert-warning > i { color: var(--orange); }
.alert-danger { background: var(--red-light); border: 1px solid #fca5a5; }
.alert-danger > i { color: var(--red); }
.alert-info { background: var(--blue-light); border: 1px solid #93c5fd; }
.alert-info > i { color: var(--blue); }

/* ---- FILTERS BAR ---- */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 200px;
}
.search-box i { position: absolute; left: 10px; color: var(--gray-400); font-size: 13px; }
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: 13px;
  transition: border-color 0.2s;
  background: white;
}
.search-box input:focus { border-color: var(--accent); }

.select-filter {
  padding: 8px 28px 8px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: white;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 16px;
  transition: border-color 0.2s;
}
.select-filter:focus { border-color: var(--accent); }

/* ---- DATE INPUTS NATIFS ---- */
.input-date {
  padding: 7px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: white;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s;
}
.input-date:hover, .input-date:focus {
  border-color: var(--accent);
  outline: none;
}
.date-input-label {
  font-size: 12px;
  color: var(--gray-500);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.date-input-label i { color: var(--accent); }

/* ---- DATE RANGE PICKER ---- */
.date-range-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: white;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color 0.2s;
  white-space: nowrap;
}
.date-range-btn:hover { border-color: var(--accent); color: var(--accent); }
.date-range-btn i { color: var(--accent); }

.date-picker-popup {
  position: fixed;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  padding: 16px;
  min-width: 300px;
  display: none;
  border-top: 3px solid var(--accent);
}
.date-picker-popup.open { display: block; }

.date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.date-picker-header span { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.date-picker-nav {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px; color: var(--gray-600);
}
.date-picker-nav:hover { background: var(--gray-100); }

.date-picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 4px;
}
.date-picker-weekdays span { font-size: 10px; font-weight: 600; color: var(--gray-400); padding: 4px 0; }

.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.date-cell {
  text-align: center;
  padding: 6px 2px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray-700);
  transition: all 0.1s;
}
.date-cell:hover { background: var(--orange-light); }
.date-cell.today { font-weight: 700; color: var(--accent); }
.date-cell.selected { background: var(--accent); color: white; }
.date-cell.in-range { background: var(--orange-light); color: var(--accent-dark); }
.date-cell.disabled { color: var(--gray-300); pointer-events: none; }
.date-cell.other-month { color: var(--gray-300); }

.date-picker-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.date-preset-btn {
  padding: 4px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 100px;
  font-size: 11px;
  color: var(--gray-600);
  background: white;
  cursor: pointer;
  transition: all 0.1s;
}
.date-preset-btn:hover, .date-preset-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

.date-picker-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}
.date-range-display {
  font-size: 12px;
  color: var(--gray-500);
}

/* ---- LEADS TABLE ---- */
.leads-table-wrapper { overflow-x: auto; }

.leads-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.leads-table th {
  background: var(--primary);
  color: rgba(255,255,255,0.7);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--accent);
}
.leads-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: top;
  font-size: 13px;
}
.leads-table tr:last-child td { border-bottom: none; }
.leads-table tr:hover td { background: #fafbfc; }

.lead-client-name { font-weight: 600; color: var(--gray-900); margin-bottom: 2px; font-size: 14px; }
.lead-client-info { font-size: 12px; color: var(--gray-500); line-height: 1.7; }
.lead-client-info span { display: block; }

.lead-message {
  max-width: 300px;
  color: var(--gray-600);
  font-size: 12.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-meta { display: flex; flex-direction: column; gap: 4px; }
.lead-meta-vendeur { font-size: 12px; color: var(--gray-500); }
.lead-meta-date { font-size: 12px; color: var(--gray-400); }

.lead-actions-col { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---- STATUS BADGES ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-nouveau { background: #dbeafe; color: #1d4ed8; }
.status-en_cours { background: #fff4e6; color: #c96e00; }
.status-gagne { background: #dcfce7; color: var(--green); }
.status-perdu { background: #fee2e2; color: var(--red); }
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- TYPE BADGES (vente / après-vente / fleet) ---- */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.type-vente       { background: #e0f2fe; color: #0369a1; }
.type-apres_vente { background: #f3e8ff; color: #7e22ce; }
.type-fleet       { background: #d1fae5; color: #047857; }
.type-none        { background: var(--gray-100); color: var(--gray-500); }

/* ---- ROLE BADGES ---- */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.role-admin        { background: #ede9fe; color: var(--purple); }
.role-vendeur      { background: var(--blue-light); color: var(--blue-dark); }
.role-tech         { background: var(--green-light); color: var(--green); }
.role-responsable  { background: #fff3cd; color: #92600a; }

/* ---- BANNIÈRE PÉRIMÈTRE (Responsable local) ---- */
.perimeter-banner {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #fff8ee 0%, #fff3e0 100%);
  border: 1.5px solid #f28500;
  border-radius: var(--border-radius);
  padding: 10px 16px;
  margin: 12px 24px 4px 24px;
  font-size: 13px;
  color: var(--gray-700);
  gap: 6px;
  flex-wrap: wrap;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--border-radius);
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: all 0.15s;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #276749; }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #9b2c2c; }

.btn-warning { background: var(--orange); color: white; }
.btn-warning:hover { background: var(--accent-dark); }

.btn-outline { background: white; border: 1.5px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--accent); color: var(--accent); }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.btn-back { font-size: 13px; }

/* ---- COMPACT TABLE ---- */
.table-compact { width: 100%; border-collapse: collapse; }
.table-compact th {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  text-align: left;
  background: var(--primary);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.table-compact td {
  padding: 10px 16px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--gray-50);
  color: var(--gray-700);
}
.table-compact tr:last-child td { border-bottom: none; }
.table-compact tr:hover td { background: var(--gray-50); }

/* ---- BRAND STATS ---- */
.brand-stats-list { padding: 8px 0; }
.brand-stat-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; }
.brand-stat-name { width: 80px; font-size: 12.5px; font-weight: 500; color: var(--gray-700); flex-shrink: 0; }
/* Libellés de type plus longs (« Après-vente ») */
#typeStats .brand-stat-name { width: 92px; }
.brand-stat-bar-wrap { flex: 1; background: var(--gray-100); border-radius: 100px; height: 6px; }
.brand-stat-bar { height: 6px; border-radius: 100px; background: var(--accent); transition: width 0.5s ease; }
.brand-stat-count { font-size: 12px; font-weight: 600; color: var(--gray-600); width: 24px; text-align: right; }

/* ---- FILTER TABS ---- */
.filter-tab {
  padding: 7px 14px;
  border-radius: 100px;
  border: 1.5px solid var(--gray-200);
  background: white;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-600);
  transition: all 0.15s;
}
.filter-tab:hover { background: var(--gray-50); border-color: var(--accent); }
.filter-tab.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ---- NOTIFICATIONS ---- */
.notif-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.15s;
}
.notif-item:hover { box-shadow: var(--shadow-md); }
.notif-item.unread { border-left: 3px solid var(--accent); background: #fffaf5; }

.notif-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notif-icon-new { background: var(--orange-light); color: var(--orange); }
.notif-icon-reminder { background: var(--red-light); color: var(--red); }
.notif-icon-info { background: var(--green-light); color: var(--green); }

.notif-content { flex: 1; }
.notif-title { font-weight: 600; font-size: 13.5px; color: var(--gray-900); }
.notif-desc { font-size: 12.5px; color: var(--gray-500); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--gray-400); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.notif-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* ---- LEAD DETAIL ---- */
/* .lead-detail-grid remplacé par .lead-detail-2col dans la nouvelle mise en page */

.detail-section {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.detail-section-title {
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  background: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--accent);
}
.detail-section-title i { color: var(--accent); }

.detail-field {
  display: flex;
  padding: 10px 20px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.detail-field:last-child { border-bottom: none; }
.detail-field-label { width: 140px; flex-shrink: 0; color: var(--gray-500); font-weight: 500; }
.detail-field-value { color: var(--gray-800); font-weight: 500; }

/* .lead-actions-bar remplacé par .lead-detail-actions-panel */

.message-block {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.message-content {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.7;
  background: #fffaf5;
  font-style: italic;
}

/* .lead-bottom-grid remplacé par la colonne principale du nouveau layout */

.comments-list { padding: 0; max-height: 360px; overflow-y: auto; }
.comment-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.comment-item:last-child { border-bottom: none; }
.comment-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment-author { font-weight: 600; font-size: 12.5px; color: var(--gray-800); }
.comment-date { font-size: 11px; color: var(--gray-400); }
.comment-text { font-size: 13px; color: var(--gray-700); line-height: 1.5; }

.comment-form {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.comment-form textarea {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 8px;
}
.comment-form textarea:focus { border-color: var(--accent); }

.history-list { padding: 0; max-height: 300px; overflow-y: auto; }
.history-item {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 12.5px;
}
.history-item:last-child { border-bottom: none; }
.history-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 4px; flex-shrink: 0; }
.history-content { flex: 1; }
.history-action { color: var(--gray-700); }
.history-time { color: var(--gray-400); font-size: 11px; margin-top: 2px; }

/* ============================================================
   LEAD DETAIL — NOUVELLE MISE EN PAGE
   ============================================================ */

/* En-tête compact */
.lead-detail-header {
  background: white;
  border-radius: var(--border-radius);
  padding: 14px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-left: 4px solid var(--accent);
}
.lead-detail-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lead-detail-id {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  font-family: monospace;
  background: var(--gray-100);
  padding: 2px 7px;
  border-radius: 4px;
}
.lead-detail-marque {
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.lead-detail-site {
  font-size: 12px;
  color: var(--gray-500);
}
.expired-badge {
  font-size: 11px;
  background: #fee2e2;
  color: #c53030;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* Layout principal : main (gauche) + actions panel (droite) */
.lead-detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.lead-detail-main {
  min-width: 0;
}
.lead-detail-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Panneau d'actions */
.lead-detail-actions-panel {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: 16px;
}
.action-panel-header {
  background: var(--primary);
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid var(--accent);
}
.action-panel-header i { color: var(--accent); }
.action-panel-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--gray-100);
}
.action-panel-section:last-child { border-bottom: none; }
.action-panel-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.action-panel-title i { color: var(--accent); font-size: 13px; }
.action-panel-take {
  background: #fffaf5;
  border-left: 3px solid var(--accent);
}
.action-panel-comment textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 10px 12px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}
.action-panel-comment textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.action-panel-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 10px 12px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
  margin-top: 4px;
}
.action-panel-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Responsive : empiler sur petits écrans */
@media (max-width: 900px) {
  .lead-detail-layout {
    grid-template-columns: 1fr;
  }
  .lead-detail-actions-panel {
    position: static;
  }
  .lead-detail-2col {
    grid-template-columns: 1fr;
  }
}

/* ---- STATS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--accent);
}
.stat-value { font-size: 36px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 13px; color: var(--gray-500); margin-top: 6px; }
.stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ---- USERS TABLE ---- */
.users-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.users-table th {
  background: var(--primary);
  color: rgba(255,255,255,0.7);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--accent);
}
.users-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: var(--gray-50); }

.user-name-cell strong { display: block; font-weight: 600; color: var(--gray-900); }
.user-name-cell span { font-size: 12px; color: var(--gray-500); }

.roles-cell { display: flex; gap: 4px; flex-wrap: wrap; }
.affectations-cell { font-size: 12px; color: var(--gray-600); line-height: 1.6; }

.status-dot-active::before { content: '●'; color: var(--green); margin-right: 5px; }
.status-dot-inactive::before { content: '●'; color: var(--red); margin-right: 5px; }

.table-actions { display: flex; gap: 6px; }

/* ---- USER FORM (modal) ---- */
.user-form { display: grid; gap: 20px; }

.form-section {
  background: var(--gray-50);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.form-section-title {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--primary);
  border-bottom: 2px solid var(--accent);
}
.form-section-body {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-section-body.full { grid-template-columns: 1fr; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 5px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: 13px;
  background: white;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }

.password-field { position: relative; }
.password-field input { padding-right: 38px; }
.password-toggle {
  position: absolute;
  right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none;
  color: var(--gray-400); cursor: pointer; font-size: 14px;
  padding: 2px;
}
.password-toggle:hover { color: var(--accent); }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 16px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
}
.checkbox-item input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
  border-top: 4px solid var(--accent);
}
.modal-lg { max-width: 740px; }
.modal-sm { max-width: 400px; }

/* ---- Champ mot de passe avec bouton œil ---- */
.pwd-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pwd-input-wrap input {
  flex: 1;
  padding-right: 40px;
}
.pwd-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px 6px;
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s;
}
.pwd-toggle:hover { color: var(--accent); }

/* ---- Barre de force du mot de passe ---- */
.pwd-strength-bar {
  height: 4px;
  background: var(--gray-100);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.pwd-strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
}
.pwd-strength-fill.strength-weak   { background: #ef4444; }
.pwd-strength-fill.strength-fair   { background: #f59e0b; }
.pwd-strength-fill.strength-good   { background: #3b82f6; }
.pwd-strength-fill.strength-strong { background: #22c55e; }

.pwd-strength-label {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  font-weight: 600;
  min-height: 16px;
}
.pwd-strength-label.strength-weak   { color: #ef4444; }
.pwd-strength-label.strength-fair   { color: #f59e0b; }
.pwd-strength-label.strength-good   { color: #3b82f6; }
.pwd-strength-label.strength-strong { color: #22c55e; }

/* ---- Message de correspondance ---- */
.pwd-match-label {
  display: block;
  font-size: 11px;
  margin-top: 5px;
  font-weight: 600;
  min-height: 16px;
}
.pwd-match-label.match-ok   { color: #22c55e; }
.pwd-match-label.match-fail { color: #ef4444; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
}
.modal-header h3 { flex: 1; font-size: 15px; font-weight: 600; color: white; }

.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.25); color: white; }

.modal-body { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--gray-50);
}

/* ---- VENDEUR LIST (modal) ---- */
.vendeur-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.vendeur-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.15s;
}
.vendeur-item:hover { border-color: var(--accent); background: var(--orange-light); }
.vendeur-item.selected { border-color: var(--accent); background: var(--orange-light); }

.vendeur-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}
.vendeur-info { flex: 1; }
.vendeur-info strong { display: block; font-size: 13px; }
.vendeur-info span { font-size: 12px; color: var(--gray-500); }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--primary-dark);
  color: white;
  padding: 12px 20px;
  border-radius: var(--border-radius);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
  border-left: 4px solid var(--accent);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--orange); }

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--gray-400);
  text-align: center;
}
.empty-state i { font-size: 48px; margin-bottom: 16px; color: var(--gray-300); }
.empty-state h4 { font-size: 16px; color: var(--gray-600); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ---- MY STATS ---- */
.my-stats-comparison {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.comparison-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--gray-300);
}
.comparison-card.me { border-top-color: var(--accent); }
.comparison-card.site { border-top-color: var(--blue); }
.comparison-card.marque { border-top-color: var(--green); }
.comparison-card.groupe { border-top-color: var(--purple); }

.comparison-title { font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; }
.comparison-value { font-size: 28px; font-weight: 700; color: var(--gray-900); margin: 6px 0; }
.comparison-label { font-size: 12px; color: var(--gray-400); }

/* ---- STATS TRANSFERT ---- */
.mystats-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mystats-section-title i { color: var(--accent); }
.stat-card-transfer { border-top-color: #3b82f6; }
.stat-card .stat-sublabel {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 2px;
}

/* ---- ONGLETS GESTION DES COMPTES ---- */
.mgmt-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: 0;
}
.mgmt-tab {
  background: none;
  border: none;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color 0.15s, border-color 0.15s;
}
.mgmt-tab:hover { color: var(--gray-700); background: var(--gray-50); }
.mgmt-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: white; }
.mgmt-tab i { font-size: 13px; }

/* ---- BON DE COMMANDE ---- */
.bon-commande-field { background: #fffaf5; }
.action-panel-bc { background: #fffaf5; border-left: 3px solid var(--accent); }
.action-panel-input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  margin-top: 4px;
}
.action-panel-input:focus { outline: none; border-color: var(--accent); }

/* ---- RESPONSIVE ---- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .lead-detail-grid { grid-template-columns: 1fr; }
  .lead-bottom-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .my-stats-comparison { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   LOADER GLOBAL RÉSEAU (Étape 5)
   ============================================================ */
.global-loader {
  position: fixed;
  inset: 0;
  background: rgba(37, 50, 62, 0.25);
  backdrop-filter: blur(1px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
}
.global-loader.active { display: flex; }
.loader-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.55);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: steveny-spin 0.8s linear infinite;
}
@keyframes steveny-spin { to { transform: rotate(360deg); } }

/* Indicateur "Enregistrement…" inline (boutons en cours) */
.btn.is-saving { opacity: 0.7; pointer-events: none; }
.btn.is-saving::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: steveny-spin 0.7s linear infinite;
}

/* ============================================================
   ÉTAPE 8 — AMÉLIORATIONS VISUELLES
   ============================================================ */

/* ---- Skeletons de chargement ---- */
.skeleton-table { padding: 8px 0; }
.skeleton-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100, #eef0f1);
}
.skeleton-box {
  background: linear-gradient(90deg, #eceef0 25%, #f5f6f7 37%, #eceef0 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
  border-radius: 6px;
  height: 14px;
  flex: 1;
}
.skeleton-box.sk-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.skeleton-box.sk-sm { max-width: 80px; }
.skeleton-box.sk-md { max-width: 160px; }
@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---- Indicateur "Enregistrement…" ---- */
.saving-indicator {
  position: fixed;
  top: calc(var(--header-height, 60px) + 14px);
  right: 18px;
  display: none;
  align-items: center;
  gap: 9px;
  background: var(--primary, #25323e);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  z-index: 100001;
}
.saving-indicator.active { display: flex; }
.saving-indicator .dot {
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: var(--accent, #f28500);
  border-radius: 50%;
  animation: steveny-spin 0.7s linear infinite;
}

/* ---- Écran "session expirée" / erreur élégant ---- */
.session-screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--primary, #25323e);
  z-index: 100002;
  padding: 24px;
}
.session-screen.active { display: flex; }
.session-card {
  background: #fff;
  border-radius: 14px;
  max-width: 420px;
  width: 100%;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.session-card .session-icon {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(242,133,0,0.12);
  color: var(--accent, #f28500);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.session-card h2 { margin: 0 0 8px; font-size: 20px; color: var(--primary, #25323e); }
.session-card p { margin: 0 0 22px; font-size: 14px; color: var(--gray-500, #6b7280); line-height: 1.5; }

/* ---- Confirmation destructive : icône ---- */
.modal .confirm-icon {
  width: 52px; height: 52px;
  margin: 4px auto 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.modal .confirm-icon.danger { background: rgba(197,48,48,0.1); color: #c53030; }
.modal .confirm-icon.warning { background: rgba(242,133,0,0.12); color: var(--accent, #f28500); }
.modal-confirm-message { text-align: center; font-size: 14px; color: var(--gray-600, #4b5563); line-height: 1.55; }

/* ---- Backdrop sidebar mobile ---- */
.sidebar-backdrop {
  position: fixed;
  inset: var(--header-height, 60px) 0 0 0;
  background: rgba(0,0,0,0.4);
  display: none;
  z-index: 49;
}
.sidebar-backdrop.active { display: block; }

/* ---- Responsive : tables scrollables + sidebar mobile ---- */
@media (max-width: 768px) {
  .users-table, .table-compact { display: block; overflow-x: auto; white-space: nowrap; }
  .filters-bar { gap: 8px; }
  .filters-bar .select-filter, .filters-bar .input-date { flex: 1 1 auto; min-width: 0; }
  .page-header { flex-wrap: wrap; gap: 10px; }
  .lead-detail-layout { display: block; }
  .lead-detail-actions-panel { position: static; width: auto; margin-top: 16px; }
  .modal { width: 94%; max-width: 94%; }
  .kpi-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .my-stats-comparison { grid-template-columns: 1fr; }
}

/* ============================================================
   ÉTAPE 8b — Correctif header sur mobile (débordement)
   ============================================================ */
@media (max-width: 768px) {
  .app-header { padding-right: 10px; }
  /* Le bloc gauche ne doit plus imposer la largeur de la sidebar */
  .header-left { min-width: 0; flex: 0 1 auto; }
  /* Fil d'Ariane masqué pour gagner de la place */
  .header-center { display: none; }
  /* On garde l'avatar (cliquable), on masque le nom/rôle */
  .header-user { padding: 6px; gap: 0; }
  .header-user .user-info { display: none; }
  .logo-text { font-size: 15px; }
  /* Le menu reste dans l'écran */
  .user-dropdown { right: 0; left: auto; max-width: calc(100vw - 20px); }
}

/* ============================================================
   ÉTAPE 8c — Débordement horizontal mobile (tableaux larges)
   ============================================================ */
@media (max-width: 768px) {
  /* La page ne défile plus latéralement : seul le conteneur du tableau scrolle */
  html, body { overflow-x: hidden; }
  .app-layout, .main-content { max-width: 100vw; overflow-x: hidden; }

  /* Chaque tableau scrolle horizontalement dans SON cadre */
  #usersTableContainer,
  #leadsTableContainer,
  #myLeadsContainer,
  #marquesTableContainer,
  #concessionsTableContainer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .users-table, .table-compact { display: table; width: 100%; white-space: nowrap; }

  /* Le header (et le burger) reste toujours au-dessus et cliquable */
  .app-header { z-index: 200; }
}

/* ============================================================
   ÉTAPE 8d — Grilles inline (posées par le JS) : forcer le responsive
   ============================================================ */
@media (max-width: 768px) {
  /* max-width:100% est plus sûr que 100vw (évite la largeur de scrollbar) */
  .app-layout, .main-content { max-width: 100%; }
  /* !important bat les style="grid-template-columns:repeat(N,1fr)" inline */
  .stats-grid          { grid-template-columns: repeat(2, 1fr) !important; }
  .my-stats-comparison { grid-template-columns: repeat(2, 1fr) !important; }
  .checkbox-grid       { grid-template-columns: repeat(2, 1fr) !important; }
  /* Cartes de stats : pas de largeur mini qui déborde */
  .stat-card { min-width: 0; }
}
@media (max-width: 480px) {
  .stats-grid          { grid-template-columns: 1fr 1fr !important; }
  .my-stats-comparison { grid-template-columns: 1fr !important; }
  .checkbox-grid       { grid-template-columns: 1fr !important; }
}

/* ============================================================
   ÉTAPE 8e — Tableaux dans les cartes (Activité récente, Détail par marque)
   ============================================================ */
@media (max-width: 768px) {
  /* Les tableaux rendus dans une carte deviennent défilables horizontalement */
  .card-body.p-0 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card-body.p-0 .users-table,
  .card-body.p-0 .table-compact { min-width: 520px; }
}
