/* ============================================
   AMY ERP — Global Stylesheet
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #0f172a;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #6366f1;

  --bg: #f1f5f9;
  --bg-card: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #2563eb;
  --sidebar-hover: #1e293b;

  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --border: #e2e8f0;
  --border-dark: #cbd5e1;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.14);

  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --topbar-height: 60px;

  --font: 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }
a { cursor: pointer; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ====== SIDEBAR ====== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  transition: width 0.3s ease;
  z-index: 100;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .sidebar-toggle-btn { margin-left: auto; }

.sidebar-logo {
  height: var(--topbar-height);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}
.logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.logo-text { color: #fff; font-weight: 700; font-size: 16px; flex: 1; white-space: nowrap; }
.sidebar-toggle-btn {
  background: none; border: none; color: var(--sidebar-text);
  padding: 4px; border-radius: 6px; font-size: 14px;
  transition: color 0.2s;
}
.sidebar-toggle-btn:hover { color: #fff; }

.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 12px 0;
}
.nav-group { margin-bottom: 8px; }
.nav-group-label {
  font-size: 9px; font-weight: 600; letter-spacing: 0.08em;
  color: #475569; padding: 8px 16px 4px;
  white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  font-size: 13px; font-weight: 400;
  border-radius: 0;
  transition: all 0.15s;
  white-space: nowrap;
  position: relative;
}
.nav-item i { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--primary);
  color: #fff;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* ====== MAIN WRAPPER ====== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}
.main-wrapper.collapsed { margin-left: var(--sidebar-collapsed); }

/* ====== TOPBAR ====== */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.mobile-menu-btn {
  display: none; background: none; border: none;
  color: var(--text-muted); font-size: 18px;
}
.breadcrumb { font-size: 14px; font-weight: 600; color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
}
.topbar-search i { color: var(--text-muted); font-size: 12px; }
.topbar-search input {
  border: none; background: none; outline: none;
  font-size: 13px; color: var(--text); width: 160px;
}
.topbar-notif {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; cursor: pointer;
  color: var(--text-muted);
  transition: background 0.2s;
}
.topbar-notif:hover { background: var(--bg); }
.topbar-notif .badge {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.2s;
  font-size: 13px;
}
.topbar-user:hover { background: var(--bg); }
/* Sélecteur de site actif (multisite) */
.topbar-site {
  display: flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: var(--primary);
  border: 1px solid var(--primary); border-radius: 20px;
  padding: 4px 10px; font-size: 13px; font-weight: 600;
}
.topbar-site select {
  border: none; background: none; outline: none; cursor: pointer;
  color: var(--primary); font-weight: 600; font-size: 13px; font-family: var(--font);
  max-width: 180px;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

/* ====== CONTENT ====== */
.content { flex: 1; padding: 24px; overflow-x: hidden; }

/* ====== PAGE HEADER ====== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ====== CARDS ====== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ====== STATS CARDS ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.orange { background: #fef3c7; color: var(--warning); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.cyan { background: #cffafe; color: var(--accent); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-change { font-size: 11px; margin-top: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #4f46e5; }
.btn-ghost { background: none; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-icon { padding: 7px; border-radius: 8px; }

/* ====== BADGES ====== */
.badge-pill {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #ede9fe; color: #4c1d95; }
.badge-muted { background: #f1f5f9; color: var(--text-muted); }

/* ====== TABLE ====== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #f8fafc; }
thead th {
  padding: 11px 14px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text);
}
tfoot td {
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-top: 2px solid var(--border-dark);
  white-space: nowrap;
}
.table-actions { display: flex; gap: 6px; }
.action-btn {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-muted);
  transition: all 0.15s;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.action-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: #fee2e2; }

/* Menu d'actions d'une ligne (liste des BL) */
.row-menu {
  position: fixed; z-index: 900; min-width: 190px; padding: 6px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.row-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text);
  font-size: 13px; cursor: pointer;
}
.row-menu button i { width: 14px; color: var(--primary); }
.row-menu button:hover { background: var(--primary-light); }
.row-menu button.danger, .row-menu button.danger i { color: var(--danger); }

/* ====== TOOLBAR ====== */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px; flex: 1; min-width: 200px;
}
.toolbar-search i { color: var(--text-muted); font-size: 12px; }
.toolbar-search input {
  border: none; background: none; outline: none;
  font-size: 13px; width: 100%;
}
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-select {
  border: 1px solid var(--border); background: var(--bg);
  border-radius: 8px; padding: 7px 12px;
  font-size: 13px; color: var(--text); outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--primary); }

/* ====== FORM ====== */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control {
  border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px;
  font-size: 13px; color: var(--text);
  background: var(--bg-card); outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.form-control:disabled { background: #f8fafc; color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 11px; color: var(--text-muted); }
.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 13px; font-weight: 600;
  color: var(--primary); margin-bottom: 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* ====== TABS ====== */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 4px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 18px; border: none; background: none;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  border-radius: 8px 8px 0 0; transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: none; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ====== PARAMÈTRES : barre défilante (style familles de caisse) ====== */
.rg-tiles { margin-bottom: 18px; }
.rg-bar { display: flex; align-items: center; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 8px; box-shadow: var(--shadow); }
.rg-track { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; padding: 2px; }
.rg-track::-webkit-scrollbar { display: none; }
/* Boutons de famille : même forme que les pastilles, avec la couleur principale */
.rg-sep { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-bottom: 3px solid var(--primary); border-radius: 10px;
  padding: 9px 16px; cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s; }
.rg-sep i { color: var(--primary); font-size: 13px; }
.rg-sep:hover { transform: translateY(-1px); background: var(--bg-card); box-shadow: var(--shadow-md); }
.rg-tiles .tab-btn.rg-chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 9px 16px; margin: 0; border: 1px solid var(--border); border-bottom: 3px solid var(--tile); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 13px; font-weight: 600; transition: transform .15s, background .15s, color .15s, box-shadow .15s;
}
.rg-tiles .tab-btn.rg-chip i { color: var(--tile); font-size: 13px; }
.rg-tiles .tab-btn.rg-chip:hover { transform: translateY(-1px); background: var(--bg-card); box-shadow: var(--shadow-md); }
.rg-tiles .tab-btn.rg-chip.active { background: var(--tile); color: #fff; border-color: var(--tile); box-shadow: 0 4px 14px color-mix(in srgb, var(--tile) 35%, transparent); }
.rg-tiles .tab-btn.rg-chip.active i { color: #fff; }
.rg-tiles .tab-btn.rg-chip.danger:not(.active) span { color: var(--danger); }
.rg-arrow { flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; transition: all .15s; }
.rg-arrow:hover { color: var(--primary); border-color: var(--primary); }
.rg-info-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.rg-info { display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; color: var(--text);
  background: color-mix(in srgb, var(--tile) 9%, var(--bg-card)); border: 1px solid color-mix(in srgb, var(--tile) 35%, var(--border)); }
.rg-info[hidden] { display: none; }
.rg-info strong { display: block; margin-bottom: 2px; }
.rg-info-ico { width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; background: var(--tile); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 600px) { .rg-bar > .rg-arrow:not(.rg-info-btn) { display: none; } }

/* ====== MODAL ====== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 200;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: block; }
.modal {
  display: none; position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 201;
  width: 90vw; max-width: 900px; max-height: 90vh;
  flex-direction: column; overflow: hidden;
}
.modal.open { display: flex; }
.modal.modal-xl { max-width: 1100px; }
.modal.modal-sm { max-width: 480px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
/* Flèche « Retour » : visible seulement quand une fenêtre est ouverte par-dessus une autre */
.modal-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.modal-header #modalBackBtn { display: none; color: var(--primary); flex-shrink: 0; }
.modal-header #modalBackBtn.show { display: flex; }
.modal-header #modalBackBtn:hover { background: var(--primary-light); color: var(--primary); }
.modal.modal-min .modal-header #modalBackBtn { display: none; }
.modal-header-actions { display: flex; align-items: center; gap: 4px; }
.modal-header-actions #modalMaxBtn:hover { background: var(--primary-light); color: var(--primary); }
/* Fenêtre agrandie : presque tout l'écran */
.modal.modal-max { width: 98vw; max-width: none; height: 96vh; max-height: 96vh; }
/* Fenêtre réduite : petite barre en bas à droite, la saisie reste en mémoire */
.modal-header-actions #modalMinBtn:hover { background: var(--primary-light); color: var(--primary); }
.modal.modal-min {
  top: auto; left: auto; right: 16px; bottom: 16px; transform: none;
  width: 360px; max-width: calc(100vw - 32px); height: auto; max-height: none;
  border: 1px solid var(--primary); animation: none;
}
.modal.modal-min .modal-body, .modal.modal-min .modal-footer, .modal.modal-min #modalMaxBtn { display: none; }
.modal.modal-min .modal-header { border-bottom: none; padding: 10px 14px; }
.modal.modal-min .modal-header h3 {
  cursor: pointer; font-size: 14px; color: var(--primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Petit signal visuel quand on clique à côté de la fenêtre */
.modal.modal-shake { animation: modalShake 0.3s; }
@keyframes modalShake {
  0%, 100% { transform: translate(-50%, -50%); }
  25% { transform: translate(calc(-50% - 6px), -50%); }
  75% { transform: translate(calc(-50% + 6px), -50%); }
}
.modal-header button {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; width: 30px; height: 30px;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.modal-header button:hover { background: #fee2e2; color: var(--danger); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}

/* ====== PRODUCT IMAGE UPLOAD ====== */
.img-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px; text-align: center;
  cursor: pointer; transition: all 0.2s;
  position: relative;
}
.img-upload-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.img-upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.img-preview { width: 80px; height: 80px; border-radius: 10px; object-fit: cover; margin: 0 auto 8px; display: block; }

/* ====== QTE INDICATORS ====== */
.qte-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.qte-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  text-align: center;
}
.qte-card .qte-val { font-size: 22px; font-weight: 700; }
.qte-card .qte-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.qte-card.total .qte-val { color: var(--primary); }
.qte-card.reserved .qte-val { color: var(--warning); }
.qte-card.available .qte-val { color: var(--success); }
.qte-card.pending .qte-val { color: var(--info); }

/* ====== DOCUMENT ====== */
.doc-type-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.doc-type-tab {
  padding: 8px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 600; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-muted);
  cursor: pointer; transition: all 0.2s;
}
.doc-type-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.doc-type-tab.Q-ACHAT { border-color: #f59e0b; }
.doc-type-tab.Q-VENTE { border-color: #10b981; }
.doc-type-tab.Q-STOCK { border-color: #6366f1; }
.doc-type-tab.active.Q-ACHAT { background: #f59e0b; border-color: #f59e0b; }
.doc-type-tab.active.Q-VENTE { background: #10b981; border-color: #10b981; }
.doc-type-tab.active.Q-STOCK { background: #6366f1; border-color: #6366f1; }

/* ====== MARGE INDICATOR ====== */
.marge-indicator {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border);
  margin-bottom: 16px;
}
.marge-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.marge-bar { height: 100%; border-radius: 4px; transition: width 0.4s; }
.marge-bar.good { background: var(--success); }
.marge-bar.medium { background: var(--warning); }
.marge-bar.bad { background: var(--danger); }
.marge-pct { font-size: 15px; font-weight: 700; min-width: 56px; text-align: right; }
.marge-pct.good { color: var(--success); }
.marge-pct.medium { color: var(--warning); }
.marge-pct.bad { color: var(--danger); }

/* ====== PRODUCT DETAIL TABS ====== */
.product-detail-layout {
  display: grid; grid-template-columns: 280px 1fr;
  gap: 20px;
}

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state .btn i { font-size: inherit; margin: 0; opacity: 1; }
.empty-state h4 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ====== ALERT ====== */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ====== TOAST ====== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--secondary); color: #fff;
  padding: 12px 18px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  min-width: 240px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ====== RESPONSIVE ====== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); width: var(--sidebar-width); }
  .main-wrapper { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .topbar-search { display: none; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .product-detail-layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ============================================
   ESPACE COLLABORATIF (modules/collab-*.js)
   Mêmes variables et composants que le reste de l'ERP
   ============================================ */
.cl-nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
.sidebar.collapsed .cl-nav-badge { position: absolute; top: 4px; right: 8px; display: inline-flex; }

/* Avatars & sélection d'utilisateurs */
.cl-avatar { border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; letter-spacing: .02em; vertical-align: middle; }
.cl-avatar-group { display: inline-flex; align-items: center; }
.cl-avatar-group .cl-avatar { border: 2px solid var(--bg-card); margin-left: -7px; }
.cl-avatar-group .cl-avatar:first-child { margin-left: 0; }
.cl-avatar-more { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.cl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border: 1px solid var(--border); border-radius: 20px; font-size: 12px; cursor: pointer; transition: all .15s; background: var(--bg-card); }
.cl-chip:hover { border-color: var(--primary); }
.cl-chip input { display: none; }
.cl-chip:has(input:checked) { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* Sélection multiple avec recherche (modules/tag-picker.js) — règle générale */
.tp-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2, var(--bg-card)); cursor: text; transition: border-color .2s, box-shadow .2s; }
.tp-wrap.focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.tp-search-ico { color: var(--text-light); font-size: 12px; }
.tp-tags { display: contents; }
.tp-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 4px; border-radius: 6px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 500; max-width: 100%; }
.tp-tag:not(:has(.cl-avatar)) { padding-left: 9px; }
.tp-tag .cl-avatar { border: 1.5px solid rgba(255,255,255,.6); }
.tp-tag strong { font-weight: 700; }
.tp-tag-x { cursor: pointer; opacity: .8; font-size: 11px; padding: 2px; border-radius: 4px; }
.tp-tag-x:hover { opacity: 1; background: rgba(255,255,255,.2); }
.tp-input { flex: 1; min-width: 140px; border: none; outline: none; background: transparent; color: var(--text); font-size: 13px; padding: 4px 0; }
.tp-box { position: fixed; z-index: 100000; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; padding: 4px; }
.tp-head { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; position: sticky; top: -4px; background: var(--bg-card); }
.tp-head a { color: var(--primary); cursor: pointer; font-weight: 600; }
.tp-opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.tp-opt:hover, .tp-opt.active { background: var(--surface2, var(--bg)); }
.tp-opt.sel { color: var(--primary); font-weight: 600; }
.tp-opt .tp-ico { color: var(--text-light); width: 14px; }
.tp-opt.sel .tp-ico { color: var(--primary); }
.tp-opt-txt { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.tp-empty { padding: 10px; font-size: 12px; color: var(--text-muted); text-align: center; }
.cl-links { display: flex; flex-wrap: wrap; gap: 4px; }
.cl-link { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-link i { font-size: 10px; }
.cl-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.cl-late { color: var(--danger) !important; font-weight: 600; }
.cl-progress { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.cl-progress > div { height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s; }
.cl-check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 0; cursor: pointer; }
.cl-check input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.cl-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; font-size: 13px; }
.cl-detail-grid .form-label { margin-bottom: 4px; }

/* Bascule de vue (Kanban / Liste...) */
.cl-segment { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px; }
.cl-segment button { border: none; background: none; padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; transition: all .15s; }
.cl-segment button:hover { color: var(--text); }
.cl-segment button.active { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow); }

/* Kanban (tâches + pipeline) */
.cl-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); grid-template-columns: none; gap: 14px; overflow-x: auto; width: 100%; min-width: 0; padding-bottom: 8px; align-items: start; }
.cl-pipeline { grid-auto-columns: minmax(220px, 1fr); }
.cl-kanban-col { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; display: flex; flex-direction: column; min-height: 200px; transition: background .15s, border-color .15s; }
.cl-kanban-col.drag-over { background: var(--primary-light); border-color: var(--primary); border-style: dashed; }
.cl-kanban-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 0 2px 10px; background: var(--bg); color: var(--text); }
.cl-count { margin-left: auto; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); font-size: 11px; border-radius: 10px; padding: 0 8px; }
.cl-pipe-total { font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 0 2px 10px; margin-top: -4px; }
.cl-kanban-body { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.cl-kanban-empty { font-size: 12px; color: var(--text-light); text-align: center; padding: 18px 0; border: 1px dashed var(--border-dark); border-radius: var(--radius); }
.cl-kanban-add { margin-top: 10px; border: 1px dashed var(--border-dark); background: none; border-radius: 8px; padding: 7px; font-size: 12px; color: var(--text-muted); transition: all .15s; }
.cl-kanban-add:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-card); }
.cl-task-card { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px 10px 15px; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; overflow: hidden; }
.cl-task-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.cl-task-card.dragging { opacity: .45; }
.cl-task-prio { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.cl-task-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; line-height: 1.35; word-break: break-word; }
.cl-task-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.45; }
.cl-task-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.cl-task-card .cl-links { margin-bottom: 8px; }
.cl-task-foot { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-muted); padding-top: 8px; border-top: 1px solid var(--border); }

/* Commentaires */
.cl-comments { display: flex; flex-direction: column; gap: 12px; max-height: 260px; overflow-y: auto; }
.cl-comment { display: flex; gap: 10px; align-items: flex-start; }

/* Projets */
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cl-project-card { display: flex; flex-direction: column; }
.cl-project-card .card-body { flex: 1; }
.cl-project-color { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.cl-project-desc { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 37px; }
.cl-card-actions { display: flex; gap: 4px; padding: 8px 12px; border-top: 1px solid var(--border); background: #f8fafc; }
.cl-color-pick input { display: none; }
.cl-color-pick span { display: block; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--border); }
.cl-color-pick input:checked + span { border-color: var(--bg-card); box-shadow: 0 0 0 2px var(--text); }

/* Agenda */
.cl-agenda-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.cl-cal-head { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; padding-bottom: 8px; }
.cl-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cl-cal-day { min-height: 98px; border: 1px solid var(--border); border-radius: 8px; padding: 5px; cursor: pointer; transition: border-color .15s, background .15s; overflow: hidden; background: var(--bg-card); }
.cl-cal-day:hover { border-color: var(--primary); }
.cl-cal-day.other { background: #f8fafc; }
.cl-cal-day.other .cl-cal-num { color: var(--text-light); }
.cl-cal-day.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.cl-cal-num { font-size: 12px; font-weight: 600; margin-bottom: 3px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.cl-cal-day.today .cl-cal-num { background: var(--primary); color: #fff; }
.cl-cal-evt { font-size: 10.5px; font-weight: 500; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-cal-evt:hover { filter: brightness(.92); }
.cl-cal-more { font-size: 10px; color: var(--text-muted); padding-left: 4px; }
.cl-agenda-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 6px; }
.cl-agenda-item:last-child { border-bottom: none; }
.cl-agenda-item:hover { background: var(--bg); }
.cl-agenda-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.cl-agenda-label { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-agenda-sub { font-size: 11px; color: var(--text-muted); }

/* Messagerie */
.cl-chat { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - var(--topbar-height) - 150px); min-height: 480px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.cl-chat-side { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.cl-chat-side-head { padding: 12px; border-bottom: 1px solid var(--border); }
.cl-chat-list { flex: 1; overflow-y: auto; padding: 6px; }
.cl-chat-section { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-light); padding: 12px 8px 6px; }
.cl-chat-none { font-size: 12px; color: var(--text-muted); padding: 4px 8px 8px; }
.cl-chat-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; transition: background .15s; }
.cl-chat-item:hover { background: var(--bg); }
.cl-chat-item.active { background: var(--primary-light); }
.cl-chat-item-top, .cl-chat-item-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.cl-chat-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-chat-item-time { font-size: 10px; color: var(--text-light); white-space: nowrap; }
.cl-chat-item-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-unread { background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; }
.cl-canal-icon { border-radius: 10px; background: var(--primary-light); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 34px; height: 34px; font-size: 14px; }
.cl-chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.cl-chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.cl-chat-back { display: none; }
.cl-chat-msgs { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; background: #fafbfd; }
.cl-chat-day { text-align: center; margin: 14px 0 8px; position: relative; }
.cl-chat-day::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--border); }
.cl-chat-day span { position: relative; background: #fafbfd; padding: 0 12px; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.cl-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 75%; margin-top: 8px; }
.cl-msg.grouped { margin-top: 2px; }
.cl-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.cl-msg-av { width: 30px; flex-shrink: 0; }
.cl-msg-body { min-width: 0; display: flex; flex-direction: column; }
.cl-msg.mine .cl-msg-body { align-items: flex-end; }
.cl-msg-author { font-size: 11px; font-weight: 600; color: var(--text-muted); margin: 0 0 3px 4px; }
.cl-msg-bubble { background: var(--bg-card); border: 1px solid var(--border); padding: 8px 12px; border-radius: 14px 14px 14px 4px; font-size: 13px; line-height: 1.5; word-break: break-word; }
.cl-msg.mine .cl-msg-bubble { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 14px 14px 4px 14px; }
.cl-msg-time { font-size: 10px; color: var(--text-light); margin: 2px 6px 0; }
.cl-mention { background: var(--primary-light); color: var(--primary); font-weight: 600; border-radius: 4px; padding: 0 3px; }
.cl-msg.mine .cl-mention { background: rgba(255,255,255,.22); color: #fff; }
.cl-chat-input { position: relative; display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); }
.cl-chat-input textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font-size: 13px; outline: none; max-height: 140px; font-family: var(--font); color: var(--text); background: var(--bg-card); }
.cl-chat-input textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.cl-mention-box { position: absolute; bottom: 100%; left: 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); padding: 4px; min-width: 220px; z-index: 5; }
.cl-mention-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.cl-mention-opt:hover, .cl-mention-opt:first-child { background: var(--bg); }

/* Activité / notifications */
.cl-activity { display: flex; flex-direction: column; }
.cl-activity-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; border-bottom: 1px solid var(--border); border-radius: 6px; }
.cl-activity-item:last-child { border-bottom: none; }
.cl-activity-item.unread { background: #eff6ff; }
.cl-activity-icon { width: 32px !important; height: 32px !important; font-size: 13px !important; border-radius: 9px !important; }
.cl-activity-text { font-size: 12.5px; line-height: 1.45; }
.cl-activity-time { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* Appels */
.cl-calls-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.cl-dial-display { width: 100%; border: none; border-bottom: 2px solid var(--border); font-size: 26px; font-weight: 600; text-align: center; padding: 8px; outline: none; letter-spacing: .04em; color: var(--text); background: none; font-family: var(--font); }
.cl-dial-display:focus { border-color: var(--primary); }
.cl-dial-match { text-align: center; font-size: 12px; color: var(--success); font-weight: 600; min-height: 20px; margin: 8px 0 12px; }
.cl-dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cl-dialpad button { height: 52px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); font-size: 20px; font-weight: 600; color: var(--text); transition: all .12s; }
.cl-dialpad button:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.cl-dialpad button:active { transform: scale(.96); }
.cl-oncall { display: flex; flex-direction: column; align-items: center; text-align: center; }
.cl-oncall-pulse { width: 78px; height: 78px; border-radius: 50%; background: #d1fae5; color: var(--success); display: flex; align-items: center; justify-content: center; font-size: 30px; box-shadow: 0 0 0 10px rgba(16,185,129,.12), 0 0 0 20px rgba(16,185,129,.06); margin-top: 10px; }
.cl-oncall-timer { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 10px 0 16px; color: var(--success); }
.cl-annuaire { max-height: 430px; overflow-y: auto; padding: 0 12px 12px; }
.cl-annuaire-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.cl-annuaire-item:last-child { border-bottom: none; }

/* Réunions */
.cl-reu-list { display: flex; flex-direction: column; }
.cl-reu-item { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.cl-reu-item:hover { background: #f8fafc; }
.cl-reu-date { width: 52px; text-align: center; border-radius: 10px; background: #ede9fe; color: #6d28d9; padding: 6px 0; flex-shrink: 0; }
.cl-reu-day { font-size: 19px; font-weight: 700; line-height: 1.1; }
.cl-reu-month { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* Pipeline : étapes */
.cl-stepper { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.cl-step { flex: 1; min-width: 90px; text-align: center; padding: 7px 6px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; transition: all .15s; }
.cl-step:hover { border-color: var(--primary); color: var(--primary); }

/* Tableau de bord collaboratif */
.cl-dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cl-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.cl-row:last-child { border-bottom: none; }
.cl-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--success); cursor: pointer; flex-shrink: 0; }
.cl-row-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.cl-row-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; min-width: 70px; text-align: right; }

@media (max-width: 1100px) {
  .cl-agenda-layout, .cl-calls-layout, .cl-dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .cl-chat { grid-template-columns: 1fr; height: calc(100vh - var(--topbar-height) - 190px); }
  .cl-chat.show-list .cl-chat-main, .cl-chat.show-conv .cl-chat-side { display: none; }
  .cl-chat-back { display: inline-flex; }
  .cl-msg { max-width: 90%; }
  .cl-detail-grid { grid-template-columns: 1fr; }
  .cl-cal-day { min-height: 64px; }
  .cl-cal-evt { font-size: 0; height: 6px; padding: 0; }
}

/* ============================================
   Paramètres > WorkSpace (modules/parametres-workspace.js)
   ============================================ */
.ws-settings { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.ws-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: none; background: none; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; text-align: left; }
.ws-menu-item i { width: 16px; text-align: center; }
.ws-menu-item:hover { background: var(--bg); color: var(--text); }
.ws-menu-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.ws-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ws-toggle-row:last-child { border-bottom: none; }
.ws-switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.ws-switch input { opacity: 0; width: 0; height: 0; }
.ws-switch span { position: absolute; inset: 0; background: var(--border-dark); border-radius: 22px; transition: background .2s; }
.ws-switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.ws-switch input:checked + span { background: var(--primary); }
.ws-switch input:checked + span::before { transform: translateX(18px); }
.ws-theme-choice { min-width: 110px; padding: 16px 22px; border-radius: 10px; border: 2px solid var(--border); background: var(--bg); color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: center; }
.ws-theme-choice i { display: block; font-size: 22px; margin-bottom: 8px; }
.ws-theme-choice.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.ws-color { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--bg-card); box-shadow: 0 0 0 1px var(--border); color: #fff; cursor: pointer; transition: transform .15s; }
.ws-color:hover { transform: scale(1.12); }
.ws-color.active { box-shadow: 0 0 0 2px var(--text); }
.ws-integration { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.ws-integration:last-child { border-bottom: none; }
.ws-settings-menu { display: flex; flex-direction: column; gap: 4px; }
.ws-integ-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; color: var(--primary); flex-shrink: 0; }
@media (max-width: 768px) {
  .ws-settings { grid-template-columns: 1fr; }
  .ws-settings-menu { flex-direction: row; overflow-x: auto; }
  .ws-menu-item { width: auto; white-space: nowrap; }
}

/* ============================================
   THÈME WORKSPACE — s'impose à tout l'ERP
   (repris de workspace/style.css : couleurs, menu, barre du haut, formulaires, tableaux)
   ============================================ */
:root {
  --primary: #4f46e5; --primary-dark: #3730a3; --primary-light: #ede9fe; --primary-soft: #6366f1;
  --accent: #06b6d4; --success: #10b981; --warning: #f59e0b; --danger: #ef4444;
  --bg: #f8fafc; --bg-card: #ffffff; --surface2: #f1f5f9;
  --sidebar-bg: var(--bg-card); --sidebar-text: var(--text-muted); --sidebar-hover: var(--surface2); --sidebar-active: var(--primary);
  --text: #0f172a; --text-muted: #64748b; --text-light: #94a3b8;
  --border: #e2e8f0; --border-dark: #cbd5e1;
  --shadow: 0 1px 3px rgba(0,0,0,.08); --shadow-md: 0 4px 16px rgba(0,0,0,.1); --shadow-lg: 0 12px 40px rgba(0,0,0,.15);
  --success-bg: #d1fae5; --warning-bg: #fef3c7; --danger-bg: #fee2e2; --accent-bg: #cffafe;
}
.dark {
  --bg: #0f172a; --bg-card: #1e293b; --surface2: #162032;
  --border: #2d3f54; --border-dark: #3d5068;
  --text: #f1f5f9; --text-muted: #94a3b8; --text-light: #64748b; --secondary: #f1f5f9;
  --shadow: 0 1px 3px rgba(0,0,0,.3); --shadow-md: 0 4px 16px rgba(0,0,0,.4); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  --success-bg: #064e3b; --warning-bg: #451a03; --danger-bg: #450a0a; --accent-bg: #0e4f5f;
  color-scheme: dark;
}
body { font-size: 14px; line-height: 1.5; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 99px; }

/* Menu latéral */
.sidebar { background: var(--bg-card); border-right: 1px solid var(--border); }
.sidebar-logo { border-bottom: 1px solid var(--border); padding: 16px 14px; }
.logo-icon { width: 34px; height: 34px; border-radius: 9px; font-size: 15px; background: linear-gradient(135deg, var(--primary), var(--primary-soft)); }
.logo-text { color: var(--text); font-size: 15px; }
.sidebar-toggle-btn { width: 30px; height: 30px; border-radius: 7px; color: var(--text-muted); }
.sidebar-toggle-btn:hover { background: var(--surface2); color: var(--text); }
.sidebar-nav { padding: 10px 8px; }
.nav-group { margin-bottom: 6px; }
.nav-group-label { font-size: 10px; color: var(--text-light); padding: 10px 8px 4px; }
.nav-item { padding: 8px 10px; border-radius: var(--radius); color: var(--text-muted); font-weight: 500; font-size: 13.5px; margin-bottom: 2px; }
.nav-item i { font-size: 15px; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }
.nav-item.active::before { display: none; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); background: var(--surface2); overflow: hidden; }
.user-card .user-info { flex: 1; min-width: 0; }
.user-card .user-name { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.user-card .user-role { display: block; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.sidebar.collapsed .user-info, .sidebar.collapsed .user-card .ws-icon-btn { display: none; }

/* Barre du haut */
.topbar { background: var(--bg-card); box-shadow: none; padding: 0 16px; gap: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.breadcrumb i { color: var(--primary); }
.topbar-left { min-width: 180px; }
.topbar-center { flex: 1; max-width: 480px; margin: 0 auto; }
.topbar-search { border-radius: 8px; padding: 7px 12px; background: var(--surface2); width: 100%; }
.topbar-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.topbar-search input { flex: 1; width: auto; min-width: 0; }
.topbar-search kbd { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 11px; color: var(--text-muted); white-space: nowrap; font-family: inherit; }
.topbar-right { gap: 8px; }
.ws-icon-btn, .topbar-notif { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 15px; background: none; border: none; cursor: pointer; position: relative; flex-shrink: 0; }
.ws-icon-btn:hover, .topbar-notif:hover { background: var(--surface2); color: var(--text); }
.topbar-user { padding: 5px 10px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--border); font-weight: 500; color: var(--text); }
.topbar-user:hover { border-color: var(--primary); background: var(--surface2); }
.user-avatar { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), var(--primary-soft)); flex-shrink: 0; }
.ws-search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; z-index: 300; max-height: 360px; overflow-y: auto; }
.ws-search-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.ws-search-item i { width: 18px; text-align: center; color: var(--text-muted); }
.ws-search-item:hover, .ws-search-item.active { background: var(--primary-light); color: var(--primary); }
.ws-search-item:hover i, .ws-search-item.active i { color: var(--primary); }

/* Cartes, statistiques */
.card, .stat-card { background: var(--bg-card); box-shadow: var(--shadow); }
.card-title { font-weight: 700; }
.stat-card { padding: 20px; transition: box-shadow .2s, transform .2s; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; }
.stat-value { font-size: clamp(16px, 1.6vw, 22px); line-height: 1.1; overflow-wrap: anywhere; white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
.stat-label { margin-top: 4px; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-bg); }
.stat-icon.orange { background: var(--warning-bg); }
.stat-icon.cyan { background: var(--accent-bg); }
.stat-icon.red { background: var(--danger-bg); }
.dark .stat-icon.purple { background: #3b0764; color: #c4b5fd; }

/* Boutons */
.btn { border-radius: 8px; font-size: 13.5px; font-weight: 500; gap: 7px; }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost:hover { background: var(--surface2); }

/* Formulaires */
.form-label, .form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: .02em; }
.form-control, .filter-select, .toolbar-search { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13.5px; }
.form-control:focus, .filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.form-control:disabled { background: var(--bg); }
.form-section-title { color: var(--text); }
.form-hint { color: var(--text-muted); }

/* Onglets */
.tab-btn { color: var(--text-muted); border-radius: 8px 8px 0 0; }
.tab-btn:hover { background: var(--surface2); }

/* Tableaux */
thead tr, thead th { background: var(--surface2); }
thead th { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--text-muted); }
tbody tr:hover { background: var(--surface2); }
tbody td { border-color: var(--border); font-size: 13.5px; }

/* Badges */
.badge-success { background: var(--success-bg); }
.badge-warning { background: var(--warning-bg); }
.badge-danger { background: var(--danger-bg); }
.badge-muted { background: var(--surface2); }
.dark .badge-success { color: #6ee7b7; }
.dark .badge-warning { color: #fcd34d; }
.dark .badge-danger { color: #fca5a5; }
.dark .badge-info { background: #2e1065; color: #c4b5fd; }

/* Fenêtres, alertes, divers */
.modal { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.action-btn { background: var(--surface2); border-color: var(--border); color: var(--text-muted); }
.action-btn.danger:hover, .modal-header button:hover { background: var(--danger-bg); }
.cl-card-actions, .cl-cal-day.other, .cl-reu-item:hover { background: var(--surface2); }
.cl-chat-msgs, .cl-chat-day span { background: var(--bg); }
.dark .alert-info { background: #1e1b4b; color: #c7d2fe; border-color: #3730a3; }
.dark .alert-warning { background: #451a03; color: #fde68a; border-color: #78350f; }
.dark .alert-danger { background: #450a0a; color: #fecaca; border-color: #7f1d1d; }
.dark .alert-success { background: #064e3b; color: #a7f3d0; border-color: #065f46; }

/* Paramètres > WorkSpace : mêmes styles que les Paramètres du WorkSpace */
.ws-settings { grid-template-columns: 200px 1fr; gap: 20px; }
.ws-settings-menu { gap: 2px; }
.ws-menu-item { padding: 9px 12px; font-size: 13.5px; }
.ws-menu-item:hover { background: var(--surface2); }
.ws-menu-item.active { font-weight: 500; }
.ws-settings .form-section-title { font-size: 16px; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.ws-theme-choice { min-width: 0; padding: 16px 24px; background: var(--surface2); }
.ws-color { border: 3px solid transparent; box-shadow: none; }
.ws-color.active { box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--primary); }
.ws-integ-icon { background: var(--surface2); }

@media (max-width: 900px) {
  .topbar-center { display: none; }
  .topbar-left { min-width: 0; }
}

/* ---- Assistant de saisie des numéros de série (achat) ---- */
.sn-cell { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; min-width: 170px; }
.sn-open { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 5px 9px; border-radius: 6px; border: 1px dashed var(--primary); background: var(--primary-light); color: var(--primary); cursor: pointer; width: fit-content; }
.sn-open:hover { filter: brightness(.96); }
.sn-mini { display: flex; flex-wrap: wrap; gap: 3px; }
.sn-mini-chip { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); }
.sn-mini-more { font-size: 10px; color: var(--text-muted); align-self: center; }
.sn-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(15,23,42,.45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sn-panel { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 860px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.sn-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 20px 10px; }
.sn-title { font-size: 17px; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.sn-title i { color: var(--primary); }
.sn-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.sn-x { border: none; background: var(--bg); color: var(--text-muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.sn-prog { padding: 0 20px 12px; }
.sn-prog-top { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; flex-wrap: wrap; }
.sn-prog-msg { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; margin-left: auto; }
.sn-prog-msg.ok { background: var(--success-bg, #d1fae5); color: var(--success); }
.sn-prog-msg.bad { background: var(--danger-bg, #fee2e2); color: var(--danger); }
.sn-prog-msg.wait { background: var(--bg); color: var(--text-muted); }
.sn-bar { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; border: 1px solid var(--border); }
.sn-bar-fill { height: 100%; border-radius: 99px; transition: width .25s ease; background: var(--primary); }
.sn-bar-fill.ok { background: var(--success); }
.sn-bar-fill.bad { background: var(--danger); }
.sn-tools { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr; gap: 10px; padding: 0 20px 12px; }
.sn-tool { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.sn-tool-title { font-size: 12px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.sn-tool-title i { color: var(--primary); }
.sn-hint { font-size: 11px; color: var(--text-muted); }
.sn-scan { font-family: monospace; font-size: 14px; transition: box-shadow .2s, border-color .2s; }
.sn-scan.flash-ok { border-color: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.25); }
.sn-scan.flash-bad { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.25); }
.sn-gen { display: grid; grid-template-columns: 1fr 1fr 70px; gap: 6px; }
.sn-gen .form-control { font-size: 12px; padding: 5px 7px; }
.sn-drop { align-items: center; justify-content: center; text-align: center; border-style: dashed; border-width: 2px; cursor: pointer; transition: border-color .2s, background .2s; }
.sn-drop:hover, .sn-drop.over { border-color: var(--primary); background: var(--primary-light); }
.sn-drop-ico { font-size: 22px; color: var(--primary); }
.sn-listbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 20px 8px; flex-wrap: wrap; }
.sn-filters, .sn-actions { display: flex; gap: 6px; }
.sn-filter { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); cursor: pointer; }
.sn-filter.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sn-list { flex: 1; min-height: 140px; overflow: auto; margin: 0 20px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.sn-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); font-size: 12px; max-width: 100%; }
.sn-chip code { font-weight: 600; }
.sn-chip.bad { border-color: var(--danger); background: var(--danger-bg, #fee2e2); }
.sn-chip-idx { font-size: 10px; color: var(--text-muted); min-width: 16px; text-align: right; }
.sn-chip-err { font-size: 10px; color: var(--danger); }
.sn-chip button { border: none; background: transparent; color: var(--text-muted); cursor: pointer; width: 20px; height: 20px; border-radius: 5px; }
.sn-chip button:hover { background: var(--danger-bg, #fee2e2); color: var(--danger); }
.sn-empty { width: 100%; text-align: center; color: var(--text-muted); padding: 24px 0; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.sn-empty i { font-size: 26px; opacity: .5; }
.sn-foot { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); margin-top: 12px; flex-wrap: wrap; }
.sn-adjust { font-size: 12px; display: flex; gap: 6px; align-items: center; cursor: pointer; }
@media (max-width: 760px) { .sn-tools { grid-template-columns: 1fr; } }

/* ---- Module Tickets ---- */
.modal.modal-lg { max-width: 820px; }
.tk-prio { display: flex; gap: 4px; flex-wrap: wrap; }
.tk-prio-btn, .tk-st-btn { font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tk-prio-btn:hover, .tk-st-btn:hover { border-color: var(--primary); }
.tk-prio-btn.active, .tk-st-btn.active { color: #fff; border-color: transparent; }
.tk-prio-btn.active.tk-muted, .tk-st-btn.active.tk-muted { background: #64748b; }
.tk-prio-btn.active.tk-primary, .tk-st-btn.active.tk-primary { background: var(--primary); }
.tk-prio-btn.active.tk-warning, .tk-st-btn.active.tk-warning { background: var(--warning); }
.tk-prio-btn.active.tk-danger { background: var(--danger); }
.tk-st-btn.active.tk-info { background: var(--info); }
.tk-st-btn.active.tk-success { background: var(--success); }
.tk-statut { font-size: 12px; font-weight: 600; padding: 4px 8px; min-width: 110px; }
.tk-statut.tk-primary { color: var(--primary); }
.tk-statut.tk-warning { color: var(--warning); }
.tk-statut.tk-info { color: var(--info); }
.tk-statut.tk-success { color: var(--success); }
.tk-statut.tk-muted { color: var(--text-muted); }
.tk-fil { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow: auto; }
.tk-comment { padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; }
.tk-comment-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.tk-comment-head span, .tk-event span { color: var(--text-muted); font-size: 11px; }
.tk-event { font-size: 12px; color: var(--text-muted); padding: 2px 4px; }
.tk-event i { font-size: 6px; color: var(--primary); vertical-align: middle; margin-right: 4px; }

/* ---- Tickets : lien avec l'espace client (ERP) ---- */
.tk-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); vertical-align: middle; }
.tk-src { font-size: 10px; font-weight: 600; color: var(--primary); }
.tk-from-client { border-left: 3px solid var(--primary); }
.tk-note { background: var(--warning-bg, #fef3c7); border-style: dashed; }
.tk-interne { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-muted); margin: -4px 0 10px; cursor: pointer; }

/* ---- Espace client (espace-client.html) ---- */
.ec-body { background: var(--bg); min-height: 100vh; }
.ec-top { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 24px; background: var(--bg-card); border-bottom: 1px solid var(--border); }
.ec-brand { display: flex; align-items: center; gap: 10px; }
.ec-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.ec-brand span:not(.logo-icon) { font-size: 12px; color: var(--text-muted); }
.ec-user { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.ec-main { max-width: 860px; margin: 0 auto; padding: 28px 18px 60px; }
.ec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.ec-head h2, .ec-main h2 { font-size: 22px; font-weight: 700; }
.ec-head p { color: var(--text-muted); font-size: 13px; }
.ec-list { display: flex; flex-direction: column; gap: 10px; }
.ec-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 16px 18px; border: 1px solid var(--border); cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, transform .15s; }
.ec-item:hover { border-color: var(--primary); transform: translateY(-1px); }
.ec-item-main { min-width: 0; }
.ec-item-top { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.ec-item-title { font-weight: 600; font-size: 15px; margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-item-sub { font-size: 12px; color: var(--text-muted); }
.ec-item-side { display: flex; align-items: center; gap: 12px; color: var(--text-muted); flex-shrink: 0; }
.ec-new { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--primary); color: #fff; }
.ec-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 20% 10%, var(--primary-light), transparent 50%), var(--bg); }
.ec-login { width: 100%; max-width: 380px; padding: 30px; }
.ec-login h1 { font-size: 22px; font-weight: 700; text-align: center; }
.ec-login > p { text-align: center; font-size: 13px; color: var(--text-muted); margin: 4px 0 20px; }
.ec-login-ico { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 14px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.ec-err { color: var(--danger); font-size: 12px; min-height: 18px; margin: 8px 0; }
.ec-hint { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 14px; }
.ec-show-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ec-show-head h2 { margin: 4px 0; }
.ec-steps { display: flex; align-items: center; gap: 8px; margin: 18px 0 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.ec-step { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ec-step span { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.ec-step.done { color: var(--text); }
.ec-step.done span { background: var(--primary); border-color: var(--primary); color: #fff; }
.ec-step-line { flex: 1; height: 2px; background: var(--border); min-width: 16px; }
.ec-desc { white-space: pre-wrap; font-size: 14px; padding: 14px; margin: 16px 0; background: var(--bg); border-radius: 10px; }
.ec-fil { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.ec-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 14px; }
.ec-msg.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.ec-msg.them { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ec-msg-head { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; margin-bottom: 3px; opacity: .85; }
.ec-msg-body { white-space: pre-wrap; }
.ec-ev { align-self: center; font-size: 11px; color: var(--text-muted); text-align: center; }
.ec-ev i { font-size: 5px; vertical-align: middle; color: var(--primary); }
.ec-reply { border-top: 1px solid var(--border); padding-top: 14px; }
@media (max-width: 600px) {
  .ec-top { padding: 10px 14px; }
  .ec-user > span { display: none; }
  .ec-item-side .badge-pill { font-size: 10px; }
  .ec-step-line { min-width: 8px; }
  .ec-msg { max-width: 95%; }
}

/* ---- Menu « Mon apparence » (bouton en haut, modules/apparence.js) ---- */
.app-theme-menu { position: fixed; z-index: 100000; width: 280px; max-width: calc(100vw - 16px); background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.25); padding: 14px; }
.app-theme-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.app-theme-title i { color: var(--primary); }
.app-theme-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 10px 0 6px; }
.app-theme-row { display: flex; gap: 6px; flex-wrap: wrap; }
.app-theme-opt { flex: 1; min-width: 0; padding: 10px 4px; border-radius: 8px; border: 2px solid var(--border); background: var(--bg); color: var(--text-muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.app-theme-opt i { display: block; font-size: 16px; margin-bottom: 4px; }
.app-theme-opt.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.app-theme-color { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; color: #fff; font-size: 11px; cursor: pointer; }
.app-theme-color.active { box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--primary); }
.app-theme-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.ec-user .ws-icon-btn { width: 32px; height: 32px; }

/* ===== RH — Pointage ===== */
.pt-toolbar { display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end; padding:14px 16px; }
.pt-toolbar .form-control { min-width:160px; }
.pt-sep { width:1px; align-self:stretch; background:var(--border); margin:0 4px; }
/* Barre du pointage : période à gauche, actions à droite */
.pt-bar { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px; padding:12px 16px; }
.pt-bar-group { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.pt-month { display:flex; align-items:center; gap:4px; }
.pt-month .form-control { width:170px; }
.pt-emp { width:auto; min-width:190px; }
.pt-menu { position:relative; }
.pt-menu > summary { list-style:none; cursor:pointer; }
.pt-menu > summary::-webkit-details-marker { display:none; }
.pt-menu-list { position:absolute; right:0; top:calc(100% + 6px); z-index:50; min-width:230px; background:var(--bg-card); border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow-md); padding:6px; }
.pt-menu-item { display:flex; align-items:center; gap:10px; width:100%; padding:8px 10px; border:none; background:none; color:var(--text); font-size:13px; text-align:left; border-radius:6px; cursor:pointer; }
.pt-menu-item i { width:16px; color:var(--text-muted); }
.pt-menu-item:hover { background:var(--bg); color:var(--primary); }
.pt-menu-item:hover i { color:var(--primary); }
@media (max-width: 640px) { .pt-bar-group { width:100%; } .pt-emp { flex:1; } .pt-month { flex:1; } .pt-month .form-control { flex:1; width:auto; } }
.pt-kpis { display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:10px; margin-bottom:12px; }
/* .stat-card est en ligne (icône + texte) : ici on empile titre, valeur et détail */
.pt-kpi { padding:12px 14px !important; flex-direction:column; align-items:flex-start; justify-content:flex-start; gap:2px; min-width:0; }
.pt-kpi > div { max-width:100%; min-width:0; }
.pt-kpi-l { font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.03em; line-height:1.3; overflow-wrap:anywhere; }
.pt-kpi-v { font-size:22px; font-weight:700; margin-top:2px; line-height:1.15; white-space:nowrap; font-variant-numeric:tabular-nums; }
.pt-kpi-s { font-size:11px; color:var(--text-muted); margin-top:2px; line-height:1.35; overflow-wrap:anywhere; }
@media (max-width: 600px) {
  .pt-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .pt-kpi-v { font-size:19px; }
}
.pt-legend { display:flex; flex-wrap:wrap; gap:6px 14px; font-size:12px; margin:4px 0 10px; color:var(--text-muted); align-items:center; }
/* ===== RH — Planning ===== */
.pl-vues { display:inline-flex; gap:4px; }
.pl-per { font-size:13px; font-weight:600; min-width:150px; text-align:center; padding:0 6px; }
.pl-chip { display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:18px; padding:0 5px; border-radius:4px; font-size:10px; font-weight:700; }
.pl-dot { display:inline-block; width:10px; height:10px; border-radius:50%; vertical-align:middle; }
.pl-grid .pl-cell { height:38px; }
.pl-sem .pl-cell { min-width:92px; height:50px; }
.pl-sem .pl-chip { font-size:11px; height:20px; min-width:28px; }
.pl-hr { font-size:10px; font-weight:500; color:var(--text-muted); margin-top:2px; }
.pl-ferie { box-shadow:inset 0 -3px 0 #8b5cf6; }
.pl-nd { background:var(--bg); }
.pl-grp td { background:var(--bg) !important; font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.03em; padding:4px 10px !important; text-align:left; }
.pl-cycle th, .pl-cycle td { text-align:center; padding:4px; }
.pl-sel { min-width:96px; padding:4px 6px; font-size:12px; }
.pt-legend > span { display:inline-flex; align-items:center; gap:5px; }
.pt-code { display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:18px; padding:0 4px; border-radius:4px; font-size:10px; font-weight:700; }
.pt-wrap { overflow-x:auto; }
.pt-grid { border-collapse:separate; border-spacing:0; width:100%; font-size:11px; }
.pt-grid th, .pt-grid td { border-bottom:1px solid var(--border); border-right:1px solid var(--border); text-align:center; padding:0; }
.pt-grid thead th { background:var(--bg); color:var(--text-muted); font-weight:600; padding:6px 2px; min-width:26px; position:sticky; top:0; z-index:1; }
.pt-dow { font-size:9px; font-weight:500; opacity:.8; }
.pt-sticky { position:sticky; left:0; z-index:2; background:var(--bg-card); text-align:left !important; min-width:170px; padding:6px 10px !important; }
.pt-grid thead .pt-sticky { z-index:3; background:var(--bg); }
.pt-name { cursor:pointer; }
.pt-name:hover .pt-n { color:var(--primary); }
.pt-n { font-weight:700; font-size:12px; color:var(--text); }
.pt-h { font-size:10px; color:var(--text-muted); }
.pt-cell { height:34px; min-width:26px; font-weight:700; cursor:pointer; position:relative; transition:filter .12s, box-shadow .12s; }
.pt-cell:hover { filter:brightness(.92); box-shadow:inset 0 0 0 2px var(--primary); }
.pt-auto { background-image:repeating-linear-gradient(135deg, rgba(255,255,255,.45) 0 3px, transparent 3px 6px); }
.pt-dot { position:absolute; top:3px; right:3px; width:5px; height:5px; border-radius:50%; background:var(--primary); }
.pt-we { background-color:rgba(148,163,184,.10); }
.pt-repos { background-color:rgba(148,163,184,.18); }
.pt-future { opacity:.55; }
.pt-today { box-shadow:inset 0 2px 0 var(--primary), inset 0 -2px 0 var(--primary); }
.pt-grid thead th.pt-today { color:var(--primary); }
.pt-off { background:repeating-linear-gradient(135deg, var(--bg) 0 4px, transparent 4px 8px); cursor:default; }
.pt-tot { min-width:38px; padding:4px 6px !important; font-weight:600; color:var(--text); background:var(--bg-card); }
.pt-grid thead th.pt-tot { background:var(--bg); }
.pt-help { font-size:12px; color:var(--text-muted); margin-top:8px; line-height:1.5; }
.pt-status-btns { display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.pt-sbtn { border:none; border-radius:8px; padding:8px 14px; font-weight:600; font-size:13px; cursor:pointer; font-family:inherit; transition:transform .1s; }
.pt-sbtn:hover { transform:translateY(-1px); }
.pt-chk { display:inline-flex; align-items:center; gap:6px; font-size:13px; padding:6px 10px; border:1px solid var(--border); border-radius:8px; cursor:pointer; }

/* ============================================
   BULLE FLOTTANTE (modules/bulle.js) — sous les fenêtres (z-index 200) pour laisser passer les formulaires
   ============================================ */
.wb-bubble { position: fixed; z-index: 190; width: 56px; height: 56px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--primary), var(--primary-soft, var(--primary-dark))); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(79,70,229,.35), var(--shadow-md); cursor: grab; touch-action: none; user-select: none; transition: transform .15s, box-shadow .15s; }
.wb-bubble:hover { transform: scale(1.06); }
.wb-bubble:active { cursor: grabbing; }
.wb-bubble:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; }
.wb-bubble.wb-oncall { background: linear-gradient(135deg, var(--success), #059669); box-shadow: 0 0 0 6px rgba(16,185,129,.25), var(--shadow-md); }
.wb-badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--bg-card); line-height: 1; }
.wb-panel { position: fixed; z-index: 190; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.wb-panel.wb-mobile { left: 8px; right: 8px; bottom: 76px; top: auto; height: min(70vh, 520px); }
.wb-head { display: flex; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface2, var(--bg)); }
.wb-tabs { display: flex; gap: 4px; flex: 1; min-width: 0; }
.wb-tab { position: relative; flex: 1; min-width: 0; border: none; background: none; color: var(--text-muted); padding: 7px 6px; border-radius: 8px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.wb-tab span:not(.wb-badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-tab:hover { color: var(--text); background: var(--bg-card); }
.wb-tab.active { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow); }
.wb-tab .wb-badge { position: static; border: none; min-width: 17px; height: 17px; font-size: 10px; }
.wb-icon-btn { border: none; background: none; color: var(--text-muted); width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.wb-icon-btn:hover { background: var(--surface2, var(--bg)); color: var(--primary); }
.wb-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.wb-list { flex: 1; overflow-y: auto; padding: 6px; }
.wb-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-light); padding: 10px 8px 4px; }
.wb-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; }
.wb-item:hover { background: var(--surface2, var(--bg)); }
.wb-item-main { flex: 1; min-width: 0; }
.wb-item-top { display: flex; justify-content: space-between; gap: 6px; }
.wb-item-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-item-time { font-size: 11px; color: var(--text-light); flex-shrink: 0; }
.wb-item-sub { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-empty { margin: auto; padding: 28px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.wb-empty i { display: block; font-size: 26px; margin-bottom: 10px; opacity: .55; }
.wb-sub { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--border); }
.wb-sub-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-msgs { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.wb-msg { max-width: 85%; align-self: flex-start; }
.wb-msg.mine { align-self: flex-end; text-align: right; }
.wb-msg-author { font-size: 11px; font-weight: 600; color: var(--text-muted); margin: 0 0 2px 4px; }
.wb-msg-bubble { display: inline-block; text-align: left; padding: 7px 11px; border-radius: 14px; background: var(--surface2, var(--bg)); font-size: 13px; line-height: 1.4; word-break: break-word; }
.wb-msg.mine .wb-msg-bubble { background: var(--primary); color: #fff; }
.wb-msg.mine .wb-msg-bubble .cl-mention { color: #fff; text-decoration: underline; }
.wb-msg-time { font-size: 10px; color: var(--text-light); margin: 2px 4px 0; }
.wb-input { display: flex; gap: 6px; align-items: flex-end; padding: 8px; border-top: 1px solid var(--border); }
.wb-input textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px; background: var(--bg); color: var(--text); max-height: 90px; }
.wb-input textarea:focus { outline: none; border-color: var(--primary); }
.wb-seg { margin: 10px 10px 0; display: flex; }
.wb-seg button { flex: 1; justify-content: center; }
.wb-search { margin: 8px 10px 0; min-width: 0; }
.wb-dial { padding: 10px 14px; overflow-y: auto; }
.wb-dialpad { gap: 6px; }
.wb-dialpad button { height: 42px; font-size: 18px; }
.wb-oncall { display: flex; flex-direction: column; align-items: center; padding: 16px; overflow-y: auto; }
.wb-oncall .cl-oncall-pulse { width: 64px; height: 64px; font-size: 24px; }
.wb-oncall textarea { width: 100%; margin-top: 10px; }
.wb-notifs { padding: 4px 8px; }
