/* =============================================
   HIPTO FIELD — Design System
   Mobile-first responsive
   ============================================= */

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

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

:root {
  --navy:         #1e3a5f;
  --indigo:       #6366f1;
  --indigo-light: #eef2ff;
  --sidebar-w:    220px;
  --topbar-h:     56px;
  --radius-lg:    16px;
  --radius-md:    12px;
  --radius-sm:    8px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.08);
  --text-dark:    #111827;
  --text-mid:     #6b7280;
  --text-light:   #9ca3af;
  --bg-page:      #f4f6f9;
  --border:       #f0f0f0;
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg-page);
  color: var(--text-dark);
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 99px; }

/* =============================================
   LAYOUT — SIDEBAR + MAIN
   ============================================= */

#appRoot {
  display: flex;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden; /* le scroll horizontal se fait dans #mainContent */
}

/* ── SIDEBAR ── */
#sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s ease;
}

/* Sur mobile : sidebar masquée par défaut (slide depuis gauche) */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    z-index: 50;
    box-shadow: var(--shadow-md);
  }
  #sidebar.open {
    transform: translateX(0);
  }
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo .logo-text {
  font-size: 20px; font-weight: 800; letter-spacing: -0.5px; line-height: 1;
}
.sidebar-logo .logo-text .logo-h  { color: var(--navy); }
.sidebar-logo .logo-text .logo-ip { color: var(--navy); }
.sidebar-logo .logo-text .logo-to { color: #6366f1; }

.sidebar-logo .logo-badge {
  display: inline-block; font-size: 9px; font-weight: 600;
  background: #fff4ed; color: #f97316;
  border-radius: 4px; padding: 1px 5px;
  letter-spacing: 0.3px; flex-shrink: 0;
}

.sidebar-nav { flex: 1; padding: 10px 0; }

/* Groupe de navigation */
.nav-group { margin-bottom: 2px; }

.nav-group-header {
  display: flex; align-items: center;
  padding: 7px 16px;
  cursor: pointer; user-select: none;
  color: var(--text-dark);
  font-size: 12px; font-weight: 600;
  transition: background .15s;
  gap: 6px;
}
.nav-group-header:hover { background: #f9fafb; }
.nav-group-header .group-icon { width: 16px; color: var(--text-mid); flex-shrink: 0; }
.nav-group-header .group-label { flex: 1; }
.nav-group-header .chevron { font-size: 10px; color: var(--text-light); transition: transform .2s; }
.nav-group-header.open .chevron { transform: rotate(180deg); }

.nav-items { overflow: hidden; }
.nav-items.collapsed { display: none; }

.nav-item-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px 6px 38px;
  font-size: 12px; font-weight: 400;
  color: #4b5563;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.nav-item-link:hover { background: #f9fafb; color: var(--text-dark); }
.nav-item-link.active {
  background: var(--indigo-light);
  color: var(--indigo);
  font-weight: 500;
}

.nav-item-standalone {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--text-dark);
  text-decoration: none;
  cursor: pointer;
  transition: background .12s;
}
.nav-item-standalone:hover { background: #f9fafb; }
.nav-item-standalone.active { background: var(--indigo-light); color: var(--indigo); }

/* ── SIDEBAR FOOTER ── */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 8px; }
.sidebar-user .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo) 0%, #818cf8 100%);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name  { font-size: 11px; font-weight: 600; color: var(--text-dark); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-user .user-email { font-size: 10px; color: var(--text-light); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-user .logout-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: 14px;
  padding: 4px; border-radius: 6px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.sidebar-user .logout-btn:hover { color: #ef4444; background: #fef2f2; }

/* ── OVERLAY SIDEBAR MOBILE ── */
#sidebarOverlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 45;
  display: none;
}
#sidebarOverlay.open { display: block; }

/* ── MAIN CONTENT ── */
#mainContent {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow-x: auto; /* permet le scroll horizontal sur la zone de contenu */
}

@media (max-width: 768px) {
  #mainContent { margin-left: 0; }
}

/* ── TOP BAR ── */
#topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.topbar-search {
  display: flex; align-items: center; gap: 6px;
  background: #f9fafb; border: 1px solid #f0f0f0;
  border-radius: var(--radius-sm); padding: 6px 10px;
  font-size: 13px; color: var(--text-mid); cursor: pointer;
  transition: border-color .15s;
}
.topbar-search:hover { border-color: #d1d5db; }
.topbar-search kbd {
  background: #f3f4f6; color: var(--text-light);
  font-size: 10px; border-radius: 4px; padding: 1px 5px;
  font-family: inherit;
}

/* Masquer barre de recherche sur petits écrans */
@media (max-width: 640px) {
  .topbar-search { display: none; }
}

.topbar-icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-mid); font-size: 14px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.topbar-icon-btn:hover { background: #f3f4f6; color: var(--text-dark); }

.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo) 0%, #818cf8 100%);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}

/* Hamburger : toujours dans le DOM, visible uniquement mobile */
.topbar-hamburger {
  display: none;
  background: none; border: none;
  cursor: pointer; color: var(--text-dark); font-size: 18px;
  padding: 4px; border-radius: var(--radius-sm);
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .topbar-hamburger { display: flex; align-items: center; justify-content: center; }
}

/* ── PAGE CONTENT ── */
#pageContent { padding: 20px; flex: 1; min-width: 0; }

@media (max-width: 640px) {
  #pageContent { padding: 12px; }
}

/* =============================================
   CARDS SYSTÈME
   ============================================= */

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.card-gradient-blue   { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); }
.card-gradient-purple { background: linear-gradient(135deg, #fdf4ff 0%, #ede9fe 100%); }
.card-gradient-amber  { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); }
.card-gradient-aurora { background: linear-gradient(120deg, #f0fdf4 0%, #eff6ff 50%, #fdf4ff 100%); }

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-header-left { display: flex; align-items: center; gap: 8px; }

.card-icon {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.card-icon.indigo  { background: #eef2ff; color: #6366f1; }
.card-icon.green   { background: #f0fdf4; color: #16a34a; }
.card-icon.purple  { background: #faf5ff; color: #9333ea; }
.card-icon.amber   { background: #fffbeb; color: #d97706; }
.card-icon.red     { background: #fef2f2; color: #dc2626; }
.card-icon.blue    { background: #eff6ff; color: #2563eb; }
.card-icon.navy    { background: #eff6ff; color: var(--navy); }

.card-title    { font-size: 13px; font-weight: 600; color: var(--text-dark); }
.card-subtitle { font-size: 12px; color: var(--text-light); }

.card-refresh {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: 13px;
  padding: 4px; border-radius: 50%;
  transition: color .15s, transform .3s;
}
.card-refresh:hover { color: var(--text-mid); transform: rotate(180deg); }

/* ── BADGE ── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  border-radius: 99px; padding: 2px 8px;
}
.badge-new    { background: #eef2ff; color: #6366f1; }
.badge-green  { background: #f0fdf4; color: #16a34a; }
.badge-blue   { background: #dbeafe; color: #2563eb; }
.badge-orange { background: #fff7ed; color: #ea580c; }
.badge-red    { background: #fef2f2; color: #dc2626; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }
.badge-tag    { background: #eef2ff; color: #6366f1; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 500; }

/* =============================================
   DASHBOARD — FILTRES + CHART
   ============================================= */

.dashboard-filters {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 130px; flex: 1 1 130px; }
.filter-label { font-size: 11px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-input, .filter-select {
  border: 1.5px solid #e5e7eb; border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 13px; color: var(--text-dark);
  background: #fff; outline: none; font-family: inherit;
  transition: border-color .15s;
  height: 36px; width: 100%;
}
.filter-input:focus, .filter-select:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

/* Boutons filtre */
.filter-actions { display: flex; gap: 6px; align-items: flex-end; flex-shrink: 0; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; height: 36px; white-space: nowrap; }
.btn-primary   { background: var(--navy); color: #fff; }
.btn-primary:hover   { background: #162d4a; }
.btn-secondary { background: #f3f4f6; color: var(--text-dark); }
.btn-secondary:hover { background: #e5e7eb; }
.btn-indigo    { background: var(--indigo); color: #fff; }
.btn-indigo:hover    { background: #4f46e5; }
.btn-danger    { background: #fef2f2; color: #dc2626; }
.btn-danger:hover    { background: #fee2e2; }
.btn-success   { background: #f0fdf4; color: #16a34a; }
.btn-success:hover   { background: #dcfce7; }
.btn-sm { padding: 5px 10px; font-size: 12px; height: 30px; }
.btn-icon { padding: 7px; width: 36px; justify-content: center; }

/* ── CHART CARD ── */
.chart-card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 18px;
  margin-bottom: 20px;
  min-width: 0;
}
.chart-card canvas { max-height: 260px; width: 100% !important; }

/* ── STATS KPI ── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.kpi-card {
  background: #fff; border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-label { font-size: 11px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--text-dark); line-height: 1.1; }
.kpi-sub   { font-size: 12px; color: var(--text-mid); }

/* =============================================
   TABLE CLIENTS — FILTRES
   ============================================= */

/* Barre de filtres inline dans la table */
.clients-filters {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.clients-filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-chip-group   { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.filter-chip-group .filter-label {
  font-size: 11px; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
/* Selects dans la barre de filtres clients */
.clients-filters .filter-select {
  border: 1.5px solid #e5e7eb; border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 12px; color: var(--text-dark);
  background: #fff; outline: none; font-family: inherit;
  height: 32px; flex: 1 1 130px; max-width: 180px;
}
.clients-filters .filter-select:focus { border-color: var(--indigo); }
@media (max-width: 640px) {
  .clients-filters .filter-select { max-width: 100%; flex: 1 1 calc(50% - 8px); }
  .filter-chip-group { gap: 6px; }
}

/* Lignes édition produits dans le formulaire */
.product-edit-row {
  background: #f9fafb; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.product-edit-label { font-size: 13px; color: var(--text-dark); display: flex; align-items: center; }
.product-edit-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.product-edit-fields .form-input { height: 34px; padding: 6px 10px; font-size: 12px; }

/* =============================================
   TABLE CLIENTS
   ============================================= */

.table-wrapper {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;  /* permet le scroll horizontal de la table */
  overflow-y: visible;
  min-width: 0;
}

.table-toolbar {
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.table-title { font-size: 15px; font-weight: 700; color: var(--text-dark); }

/* Zone de recherche */
.search-box {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid #e5e7eb; border-radius: var(--radius-sm);
  padding: 6px 10px; background: #fff;
  transition: border-color .15s;
  min-width: 200px; flex: 1 1 200px; max-width: 280px;
}
.search-box:focus-within { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.search-box i { color: var(--text-light); font-size: 12px; flex-shrink: 0; }
.search-box input { border: none; outline: none; font-size: 13px; color: var(--text-dark); background: transparent; width: 100%; font-family: inherit; min-width: 0; }
.search-box input::placeholder { color: var(--text-light); }

@media (max-width: 640px) {
  .search-box { max-width: 100%; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-toolbar > div { width: 100%; }
  .table-toolbar > div:last-child { display: flex; gap: 8px; flex-wrap: wrap; }
}

/* Scroll horizontal de la table */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.data-table thead { background: #f9fafb; }
.data-table th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 11px 14px; font-size: 13px; color: var(--text-dark);
  border-bottom: 1px solid #f9fafb;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: #f9fafb; cursor: pointer; }

/* Colonnes cachées sur mobile — supprimées : scroll horizontal à la place */
/* .col-hide-md et .col-hide-sm ne cachent plus rien : toutes les colonnes visibles en scroll */
@media (max-width: 640px) {
  .data-table { min-width: 700px; } /* force scroll horizontal pour afficher toutes les colonnes */
}

/* Indicateur de scroll horizontal sur mobile */
.table-scroll {
  position: relative;
}
@media (max-width: 900px) {
  .table-scroll::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 32px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.85));
    pointer-events: none;
    z-index: 1;
  }
}

/* Produits icônes */
.product-icons { display: flex; gap: 4px; flex-wrap: wrap; }
.product-icon {
  width: 24px; height: 24px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer;
  transition: transform .15s;
  flex-shrink: 0;
}
.product-icon:hover { transform: scale(1.15); }

/* Icônes produits — état VALIDÉ (coloré) */
/* 5 types d'icônes produits — état ACCORD (coloré) */
.product-icon.forfait-mobile { background: #dbeafe; color: #2563eb; }  /* SIM — bleu */
.product-icon.box-fixe       { background: #dcfce7; color: #16a34a; }  /* WiFi — vert */
.product-icon.gaz-only       { background: #fce7f3; color: #db2777; }  /* flamme — rose */
.product-icon.elec-only      { background: #fef9c3; color: #ca8a04; }  /* éclair — jaune */
.product-icon.energie        { background: #fef3c7; color: #d97706; }  /* dual énergie — orange */

/* Icônes produits — état EN ATTENTE (gris) */
.product-icon.pending {
  background: #f3f4f6 !important;
  color: #9ca3af !important;
  position: relative;
}

/* Tooltip hover "En attente de validation" */
.product-icon.pending::after {
  content: attr(data-tooltip-title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 100;
}
.product-icon.pending::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 100;
}
.product-icon.pending:hover::after,
.product-icon.pending:hover::before { opacity: 1; }

/* Badge "Optin non validée" rouge */
.optin-invalid {
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Tentatives badge */
.attempts-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-mid);
  white-space: nowrap;
}
.attempts-badge i { color: var(--text-light); }

/* Pagination */
.table-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-top: 1px solid var(--border);
  gap: 8px; flex-wrap: wrap;
}
.pagination-info { font-size: 12px; color: var(--text-light); }
.pagination-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 30px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text-dark);
  padding: 0 6px;
  transition: all .12s;
}
.page-btn:hover { border-color: var(--indigo); color: var(--indigo); }
.page-btn.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* =============================================
   MODAL CLIENT
   ============================================= */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
  z-index: 50;
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #fff; border-radius: var(--radius-lg);
  width: 100%; max-width: 760px;
  /* Hauteur fixe = toute la fenêtre moins les marges overlay (2×16px) */
  height: calc(100vh - 32px);
  max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn .2s ease;
  overflow: hidden;
}
#clientModalContent {
  display: flex; flex-direction: column;
  flex: 1 1 0; min-height: 0;
  overflow: hidden;
}
@keyframes modalIn { from { opacity:0; transform: scale(.96) translateY(8px); } to { opacity:1; transform: scale(1) translateY(0); } }

@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    height: 92vh;
    max-height: 92vh;
    max-width: 100%;
    overflow: hidden;
  }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 12px;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-dark); }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #f3f4f6; border: none; cursor: pointer;
  color: var(--text-mid); font-size: 13px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.modal-close:hover { background: #fee2e2; color: #dc2626; }

/* Onglets */
.modal-tabs {
  display: flex; gap: 0; padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.modal-tab {
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: var(--text-mid); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.modal-tab:hover { color: var(--text-dark); }
.modal-tab.active { color: var(--indigo); border-bottom-color: var(--indigo); font-weight: 600; }

.modal-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 20px;
}

/* Grille détails client */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 480px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-label { font-size: 11px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.4px; }
.detail-value { font-size: 13px; color: var(--text-dark); font-weight: 500; }
.detail-value.full { grid-column: 1 / -1; }

/* Logs d'appels — style carte blanche iOS */
.call-timeline { display: flex; flex-direction: column; gap: 12px; }
.call-entry {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 14px 16px;
  border: none;
  font-size: 14px;
  scroll-margin-top: 16px;   /* pour le scroll-into-view */
}
/* Mise en évidence quand on arrive depuis une icône produit */
.call-entry.highlighted {
  box-shadow: 0 0 0 2px var(--indigo), 0 4px 16px rgba(99,102,241,0.18);
  animation: highlightPulse 1.6s ease forwards;
}
@keyframes highlightPulse {
  0%   { box-shadow: 0 0 0 3px var(--indigo), 0 4px 16px rgba(99,102,241,0.3); }
  60%  { box-shadow: 0 0 0 3px var(--indigo), 0 4px 16px rgba(99,102,241,0.15); }
  100% { box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
}
.call-num    { font-size: 13px; font-weight: 400; color: #8e8e93; margin-bottom: 8px; }
.call-row    { display: flex; gap: 4px; line-height: 1.55; font-size: 15px; }
.call-label  { font-weight: 700; color: #1c1c1e; white-space: nowrap; }
.call-val    { color: #1c1c1e; font-weight: 400; }
.call-val.accord { color: #16a34a; font-weight: 600; }

/* =============================================
   PAGES : PARTENAIRES, ÉQUIPES, UTILISATEURS
   ============================================= */

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-title-block .page-title { font-size: 18px; font-weight: 700; color: var(--text-dark); }
.page-title-block .page-sub   { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* Cards liste */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
@media (max-width: 640px) {
  .cards-grid { grid-template-columns: 1fr; }
}

.list-card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .15s, transform .15s;
}
.list-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.list-card-header { display: flex; align-items: center; justify-content: space-between; }
.list-card-id     { font-size: 11px; color: var(--text-light); font-weight: 600; }
.list-card-actions { display: flex; gap: 4px; }
.list-card-name   { font-size: 14px; font-weight: 700; color: var(--text-dark); }
.list-card-sub    { font-size: 12px; color: var(--text-mid); }
.list-card-meta   { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

.meta-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f3f4f6; border-radius: 99px; padding: 3px 9px;
  font-size: 11px; color: var(--text-mid);
}
.meta-chip i { font-size: 10px; }

/* ── Boutons actions inline (ex: table équipes) ── */
.btn-team-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid #e5e7eb; background: #fff; color: var(--text-mid);
  transition: all .15s; white-space: nowrap;
  font-family: inherit;
}
.btn-team-action:hover { background: #f3f4f6; color: var(--text-dark); border-color: #d1d5db; }
.btn-team-action.danger { color: #dc2626; border-color: #fecaca; background: #fff; }
.btn-team-action.danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

/* Bouton icon action */
.action-btn {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: #f3f4f6; border: none; cursor: pointer;
  color: var(--text-mid); font-size: 12px;
  transition: all .12s;
}
.action-btn.edit:hover   { background: #eef2ff; color: var(--indigo); }
.action-btn.delete:hover { background: #fef2f2; color: #dc2626; }
.action-btn.view:hover   { background: #f0fdf4; color: #16a34a; }

/* ── MODAL FORM ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-input, .form-select, .form-textarea {
  width: 100%; border: 1.5px solid #e5e7eb; border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px; color: var(--text-dark);
  background: #fff; outline: none; font-family: inherit;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* ── TOAST ── */
.toast-container {
  position: fixed; bottom: 20px; right: 16px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); font-size: 13px; font-weight: 500;
  animation: toastIn .25s ease;
  min-width: 200px; max-width: 320px;
}
@keyframes toastIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
.toast.success { background: #f0fdf4; color: #15803d; border-left: 3px solid #16a34a; }
.toast.error   { background: #fef2f2; color: #dc2626; border-left: 3px solid #dc2626; }
.toast.info    { background: #eff6ff; color: #2563eb; border-left: 3px solid #3b82f6; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 40px 24px; color: var(--text-light); }
.empty-state i { font-size: 36px; margin-bottom: 10px; display: block; }
.empty-state p { font-size: 13px; }

/* ── SPINNER ── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid #e5e7eb; border-top-color: var(--indigo); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; align-items: center; justify-content: center; padding: 56px; }
.loading-center .spinner { width: 32px; height: 32px; border-width: 3px; }

/* =============================================
   QUICK ACCESS (conservé)
   ============================================= */
.quick-access-card {
  background: linear-gradient(120deg, #f0fdf4 0%, #eff6ff 50%, #fdf4ff 100%);
  border-radius: var(--radius-lg); padding: 18px;
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.qa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px; margin-top: 12px;
}
.qa-item {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border-radius: var(--radius-md);
  padding: 10px 12px; cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.qa-item:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.qa-item-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.qa-item-text { flex: 1; min-width: 0; }
.qa-item-name { font-size: 12px; font-weight: 600; color: var(--text-dark); }
.qa-item-desc { font-size: 11px; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =============================================
   LOGIN PAGE
   ============================================= */

.login-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, #f8fafc 40%, #1e3a5f 40%, #1e3a5f 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  padding: 32px; width: 100%; max-width: 420px;
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .logo-main { font-size: 32px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.login-logo .logo-main .lh { color: var(--navy); }
.login-logo .logo-main .li { color: #6366f1; }
.login-logo .logo-by { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.login-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.login-input {
  width: 100%; border: 2px solid #e5e7eb; border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 14px; color: var(--text-dark);
  background: #fff; outline: none; font-family: inherit;
  transition: border-color .15s;
}
.login-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,95,0.1); }

.login-btn {
  width: 100%; background: var(--navy); color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 13px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  cursor: pointer; transition: background .15s;
}
.login-btn:hover { background: #162d4a; }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }

.login-error {
  background: #fef2f2; border: 1px solid #fecaca;
  color: #dc2626; border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px; display: none;
}

/* =============================================
   DARK MODE (minimal)
   ============================================= */

body.dark {
  background: #0f172a;
  color: #e2e8f0;
}
body.dark #sidebar { background: #1e293b; border-color: #334155; }
body.dark #topbar  { background: #1e293b; border-color: #334155; }
body.dark .card, body.dark .chart-card, body.dark .kpi-card,
body.dark .table-wrapper, body.dark .list-card,
body.dark .dashboard-filters { background: #1e293b; }
body.dark .data-table thead { background: #0f172a; }
body.dark .data-table tbody tr:hover { background: #0f172a; }
body.dark .data-table td, body.dark .data-table th { border-color: #334155; }
body.dark .modal-box { background: #1e293b; }
body.dark .form-input, body.dark .form-select { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.dark .nav-item-link, body.dark .nav-item-standalone { color: #94a3b8; }
body.dark .nav-item-link:hover, body.dark .nav-item-standalone:hover { background: #0f172a; color: #e2e8f0; }
body.dark .nav-item-link.active, body.dark .nav-item-standalone.active { background: #312e81; color: #a5b4fc; }
body.dark .topbar-title { color: #e2e8f0; }
