/* ═══════════════════════════════════════════════════════════════════════
   CAMALARM CRM — Refonte Design Premium (T170 — final)
   Pages : Historique devis + Factures émises
   ═══════════════════════════════════════════════════════════════════════
   Conforme à la directive "Refonte Premium" :
   - Comfortaa (titres) / Inter (texte) / JetBrains Mono (chiffres)
   - Couleurs CAMALARM : orange #E65100 primaire
   - Tableau en cartes espacées (border-spacing 0 6px), pas de transform au hover
   - KPI cards fond foncé #1F2937
   - Loupe à droite des champs recherche
   - Largeur max 1300px centrée
   - CSS scopé #tab-hist-scope et #tab-fact-scope
   ═══════════════════════════════════════════════════════════════════════ */

/* Polices */
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── Variables locales ───────────────────────────────────────────── */
#tab-hist-scope,
#tab-fact-scope {
  --cam-bg:        #F5F7FA;
  --cam-card:      #FFFFFF;
  --cam-card-hover:#F9FAFB;

  --cam-text:      #1F2937;
  --cam-text-2:    #6B7280;
  --cam-text-3:    #9CA3AF;

  --cam-border:    #E5E7EB;
  --cam-border-l:  #F3F4F6;

  --cam-orange:    #E65100;
  --cam-orange-l:  #FFF3E0;
  --cam-orange-d:  #C44400;

  --cam-success:   #059669;
  --cam-warning:   #F59E0B;
  --cam-danger:    #DC2626;
  --cam-info:      #0284C7;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;          /* 14px */
  line-height: 1.5;
  color: var(--cam-text);
  background: var(--cam-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Largeur utile centrée — directive : max-width 1300px */
#tab-hist-scope,
#tab-fact-scope {
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
}

/* ═══════════════════ 1. HEADER PAGE ═══════════════════ */
#tab-hist-scope .wix-page-head,
#tab-fact-scope .wix-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 24px 0;
  background: transparent;
  border: 0;
  margin: 0 0 20px 0;
}

#tab-hist-scope .wix-page-head h2,
#tab-fact-scope .wix-page-head h2 {
  font-family: 'Comfortaa', 'Inter', sans-serif !important;
  font-size: 1.5rem !important;          /* ≈ 24px */
  font-weight: 600 !important;
  color: var(--cam-text) !important;
  letter-spacing: -0.3px;
  line-height: 1.25 !important;
  margin: 0 0 6px 0 !important;
}

#tab-hist-scope .wix-page-head p,
#tab-fact-scope .wix-page-head p {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.875rem !important;        /* 14px */
  font-weight: 400 !important;
  color: var(--cam-text-2) !important;
  margin: 0 !important;
  line-height: 1.55 !important;
  max-width: 600px;
}

/* Bouton primaire — orange CAMALARM */
#tab-hist-scope .wix-page-head .btn.bp,
#tab-fact-scope .wix-page-head .btn.bp {
  background: var(--cam-orange) !important;
  color: #ffffff !important;
  border: 1px solid var(--cam-orange) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  padding: 9px 18px !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
  white-space: nowrap;
  flex-shrink: 0;
  height: auto !important;
  line-height: 1.4 !important;
  box-shadow: 0 1px 2px rgba(230, 81, 0, 0.15);
}

#tab-hist-scope .wix-page-head .btn.bp:hover,
#tab-fact-scope .wix-page-head .btn.bp:hover {
  background: var(--cam-orange-d) !important;
  border-color: var(--cam-orange-d) !important;
  box-shadow: 0 2px 6px rgba(230, 81, 0, 0.25);
}

/* Cache le bouton dupliqué dans factures */
#tab-fact-scope .fact-create-duplicate {
  display: none !important;
}

/* ═══════════════════ 2. KPI ROW (Bandeau résumé fond foncé) ═══════════════════ */
/* Directive : KPI cards fond #1F2937, valeur Comfortaa 1.5rem, label gris */
#tab-hist-scope .stats-row,
#tab-fact-scope .stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
}

#tab-hist-scope .stats-row .stat-card,
#tab-fact-scope .stats-row .stat-card {
  background: #1F2937 !important;
  color: #ffffff !important;
  padding: 16px 20px !important;
  border-radius: 10px !important;
  flex: 1 1 150px !important;
  border: 0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  position: static;
  overflow: visible;
  display: flex !important;
  flex-direction: column !important;
  transition: box-shadow 150ms ease;
}

#tab-hist-scope .stats-row .stat-card::before,
#tab-fact-scope .stats-row .stat-card::before {
  display: none !important;
}

#tab-hist-scope .stats-row .stat-card:hover,
#tab-fact-scope .stats-row .stat-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  /* PAS de transform — directive anti-vibration */
}

/* Label en haut, valeur en bas (ordre flex pour reverser HTML existant) */
#tab-hist-scope .stats-row .stat-l,
#tab-fact-scope .stats-row .stat-l {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.8rem !important;
  font-weight: 400 !important;
  color: #9CA3AF !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  margin: 0 0 0 0 !important;
  order: 2;
  display: block;
}

#tab-hist-scope .stats-row .stat-v,
#tab-fact-scope .stats-row .stat-v {
  font-family: 'Comfortaa', 'Inter', sans-serif !important;
  font-size: 1.5rem !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  letter-spacing: -0.3px;
  line-height: 1.15 !important;
  margin: 0 0 4px 0 !important;
  order: 1;
  display: block;
}

/* Si la valeur est un montant, on garde Comfortaa pour cohérence avec directive
   (la directive dit "Comfortaa 1.5rem 600" pour kpi-value, on suit ça).
   Les chiffres sont en tabular pour bon alignement. */
#tab-hist-scope .stats-row .stat-v,
#tab-fact-scope .stats-row .stat-v {
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}

/* ═══════════════════ 3. BARRE DE FILTRES ═══════════════════ */
#tab-hist-scope .wix-filterbar,
#tab-fact-scope .wix-filterbar {
  display: flex !important;
  gap: 12px !important;
  margin: 0 0 20px 0 !important;
  flex-wrap: wrap;
  align-items: center !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}

#tab-hist-scope .wix-filterbar > div:first-child,
#tab-fact-scope .wix-filterbar > div:first-child {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

/* Selects — hauteur 36px directive */
#tab-hist-scope .wix-filterbar select.fs,
#tab-fact-scope .wix-filterbar select.fs {
  height: 36px !important;
  padding: 8px 32px 8px 12px !important;
  border: 1px solid var(--cam-border) !important;
  border-radius: 8px !important;
  font-size: 0.875rem !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 400 !important;
  color: var(--cam-text) !important;
  background-color: var(--cam-card) !important;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 150px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  line-height: 1.4 !important;
}

#tab-hist-scope .wix-filterbar select.fs:hover,
#tab-fact-scope .wix-filterbar select.fs:hover {
  border-color: #D1D5DB !important;
}

#tab-hist-scope .wix-filterbar select.fs:focus,
#tab-fact-scope .wix-filterbar select.fs:focus {
  outline: none;
  border-color: var(--cam-orange) !important;
  box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.15);
}

/* Wrapper recherche : loupe en pseudo-élément à DROITE */
#tab-hist-scope .wix-filterbar .sb,
#tab-fact-scope .wix-filterbar .sb {
  position: relative !important;
  flex: 1 1 280px;
  min-width: 220px;
  max-width: 360px;
  margin-left: auto;
}

/* Neutralise l'emoji 🔍 parasite injecté par components.css ::before sur .sb */
#tab-hist-scope .wix-filterbar .sb::before,
#tab-fact-scope .wix-filterbar .sb::before {
  content: none !important;
  display: none !important;
}

#tab-hist-scope .wix-filterbar .sb::after,
#tab-fact-scope .wix-filterbar .sb::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='11' cy='11' r='8'%3e%3c/circle%3e%3cline x1='21' y1='21' x2='16.65' y2='16.65'%3e%3c/line%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: 16px 16px;
  pointer-events: none;
  z-index: 2;
}

/* Input recherche — hauteur 36px, padding 8px 36px 8px 12px */
#tab-hist-scope .wix-filterbar .sb input,
#tab-fact-scope .wix-filterbar .sb input {
  width: 100% !important;
  height: 36px !important;
  padding: 8px 36px 8px 12px !important;
  border: 1px solid var(--cam-border) !important;
  border-radius: 8px !important;
  font-size: 0.875rem !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 400 !important;
  background-color: var(--cam-card) !important;
  background-image: none !important;
  color: var(--cam-text) !important;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  line-height: 1.4 !important;
}

#tab-hist-scope .wix-filterbar .sb input::placeholder,
#tab-fact-scope .wix-filterbar .sb input::placeholder {
  color: var(--cam-text-3) !important;
  font-weight: 400 !important;
}

#tab-hist-scope .wix-filterbar .sb input:focus,
#tab-fact-scope .wix-filterbar .sb input:focus {
  outline: none;
  border-color: var(--cam-orange) !important;
  box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.15);
}

/* Checkbox tout sélectionner */
#tab-hist-scope .wix-filterbar input[type="checkbox"],
#tab-fact-scope .wix-filterbar input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--cam-orange);
  margin: 0;
}

/* Bouton "Actions groupées" */
#tab-hist-scope #histBulkBtn,
#tab-fact-scope #factBulkBtn {
  height: 36px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  padding: 0 14px !important;
  background: var(--cam-card) !important;
  color: var(--cam-orange) !important;
  border: 1px solid var(--cam-border) !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease !important;
}

#tab-hist-scope #histBulkBtn:hover,
#tab-fact-scope #factBulkBtn:hover {
  background: var(--cam-orange-l) !important;
  color: var(--cam-orange) !important;
  border-color: var(--cam-orange) !important;
}

#tab-hist-scope #histSelCount,
#tab-fact-scope #factSelCount {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.8125rem !important;
  color: var(--cam-text-2) !important;
  font-weight: 400 !important;
}

/* ═══════════════════ 4. TABLEAU EN CARTES ═══════════════════ */
/* Directive :
   - border-collapse: separate; border-spacing: 0 6px
   - Chaque ligne = carte blanche avec radius 8px et ombre légère
   - Pas de transform au hover */

#tab-hist-scope .crd.wix-table-card,
#tab-fact-scope .crd.wix-table-card {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  overflow: visible;
}

#tab-hist-scope .crd .crh,
#tab-fact-scope .crd .crh {
  display: none !important;
}

#tab-hist-scope .crd .crb,
#tab-fact-scope .crd .crb {
  padding: 0 !important;
  overflow-x: auto !important;
  background: transparent !important;
  min-height: 200px !important;        /* T170h : évite le collapse vertical pendant le filtrage */
}

#tab-hist-scope .data-table,
#tab-fact-scope .data-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 6px !important;
  font-family: 'Inter', sans-serif;
  background: transparent;
}

/* Entêtes — pas de fond, juste texte */
#tab-hist-scope .data-table thead th,
#tab-fact-scope .data-table thead th {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  color: var(--cam-text-2) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 8px 12px !important;
  text-align: left !important;
  border-bottom: 0 !important;
  background: transparent !important;
  white-space: nowrap;
}

#tab-hist-scope .data-table thead th:first-child,
#tab-fact-scope .data-table thead th:first-child {
  padding-left: 16px !important;
  width: 32px;
}

/* TTC à droite — Historique col 6 (Réf en col 5), Factures col 7 (Réf en col 6) */
#tab-hist-scope .data-table thead th:nth-child(6),
#tab-fact-scope .data-table thead th:nth-child(7) {
  text-align: right !important;
  width: 140px;
}

/* Statut — Historique col 7, Factures col 8 */
#tab-hist-scope .data-table thead th:nth-child(7),
#tab-fact-scope .data-table thead th:nth-child(8) {
  text-align: left !important;
  width: 130px;
}

/* En-tête colonne Réf (très compacte, juste après Client - 2-3 mots max) */
#tab-hist-scope .data-table thead th.th-ref {
  width: 110px;
  max-width: 130px;
  padding-left: 0 !important;            /* T170k : collée à Client */
  padding-right: 8px !important;
}

/* T170m — Réduire le padding-right de la cellule Client (4e colonne)
   pour vraiment coller la Réf au texte Client. Spécificité maximale pour
   battre la règle générale "tbody td { padding: 14px 12px !important }". */
#tab-hist-scope .data-table thead th:nth-child(4),
#tab-hist-scope .data-table tbody td:nth-child(4) {
  padding-right: 4px !important;
}

/* Cellule Réf : padding gauche minimal, spécificité élevée */
#tab-hist-scope .data-table tbody td.cam-cell-ref-chantier {
  padding-left: 4px !important;
  padding-right: 8px !important;
}

/* Actions */
#tab-hist-scope .data-table thead th:last-child,
#tab-fact-scope .data-table thead th:last-child {
  text-align: center !important;
  width: 130px !important;
  padding-right: 16px !important;
}

/* Lignes = cartes blanches */
#tab-hist-scope .data-table tbody tr,
#tab-fact-scope .data-table tbody tr {
  background: var(--cam-card) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  transition: background 150ms ease, box-shadow 150ms ease !important;
  border: 0 !important;
}

#tab-hist-scope .data-table tbody tr:hover,
#tab-fact-scope .data-table tbody tr:hover {
  background: var(--cam-card-hover) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important;
  /* PAS de transform — anti-vibration directive */
}

#tab-hist-scope .data-table tbody td,
#tab-fact-scope .data-table tbody td {
  padding: 14px 12px !important;
  font-size: 0.875rem !important;
  font-weight: 400 !important;
  color: var(--cam-text) !important;
  vertical-align: middle !important;
  background: transparent !important;
  border: 0 !important;
}

/* Première et dernière cellule arrondies (effet carte) */
#tab-hist-scope .data-table tbody td:first-child,
#tab-fact-scope .data-table tbody td:first-child {
  border-radius: 8px 0 0 8px !important;
  padding-left: 16px !important;
  width: 32px;
}

#tab-hist-scope .data-table tbody td:last-child,
#tab-fact-scope .data-table tbody td:last-child {
  border-radius: 0 8px 8px 0 !important;
  padding-right: 16px !important;
}

#tab-hist-scope .data-table input[type="checkbox"],
#tab-fact-scope .data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--cam-orange);
  margin: 0;
}

/* ═══════════════════ 5. CELLULES SÉMANTIQUES ═══════════════════ */
/* Référence devis/facture : JetBrains Mono weight 500 (directive) */
.cam-cell-ref {
  font-family: 'JetBrains Mono', 'Menlo', monospace !important;
  font-size: 0.8125rem !important;        /* 13px */
  font-weight: 500 !important;
  color: var(--cam-orange) !important;
  cursor: pointer;
  letter-spacing: -0.2px;
}

.cam-cell-ref:hover {
  color: var(--cam-orange-d) !important;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cam-cell-ref-primary {
  font-family: 'JetBrains Mono', 'Menlo', monospace !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  color: var(--cam-orange) !important;
  letter-spacing: -0.2px;
}

.cam-cell-ref-secondary {
  font-family: 'JetBrains Mono', 'Menlo', monospace !important;
  font-size: 0.75rem !important;
  font-weight: 400 !important;
  color: var(--cam-text-3) !important;
  letter-spacing: -0.1px;
}

/* Date */
.cam-cell-date {
  color: var(--cam-text-2) !important;
  font-size: 0.8125rem !important;
  white-space: nowrap;
  font-weight: 400 !important;
}

/* Client : Inter weight 500 (directive : pas de bold excessif) */
.cam-cell-client {
  font-weight: 500 !important;
  color: var(--cam-text) !important;
  font-size: 0.875rem !important;
}

/* Montant : JetBrains Mono weight 500 */
.cam-cell-amount {
  font-family: 'JetBrains Mono', 'Menlo', monospace !important;
  font-weight: 500 !important;
  text-align: right !important;
  color: var(--cam-text) !important;
  font-size: 0.875rem !important;
  letter-spacing: -0.2px !important;
  white-space: nowrap;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}

/* Cellule Référence devis (champ d.reference uniquement, 2-3 mots max) */
.cam-cell-ref-chantier {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  color: var(--cam-text) !important;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 0 !important;            /* T170k : collée à Client */
  padding-right: 8px !important;
}

.cam-cell-ref-chantier.is-empty {
  color: var(--cam-text-3) !important;
  font-style: italic;
  font-weight: 400 !important;
}

.cam-cell-actions {
  text-align: center !important;
  padding: 10px 12px !important;
  width: 130px;
}

/* ═══════════════════ 6. PILLS STATUT (badges) ═══════════════════ */
/* Directive .badge-status : padding 2px 10px, radius 12px, 0.75rem, weight 500 */
.cam-status-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  padding: 3px 10px !important;
  border-radius: 12px !important;
  letter-spacing: 0 !important;
  line-height: 1.5 !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.cam-status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Couleurs pills selon directive */
.cam-status-pill.s-brouillon {
  background: #F3F4F6 !important;
  color: #6B7280 !important;
}
.cam-status-pill.s-brouillon::before { background: #9CA3AF; }

.cam-status-pill.s-envoye {
  background: #E0F2FE !important;
  color: #0284C7 !important;
}
.cam-status-pill.s-envoye::before { background: #0284C7; }

.cam-status-pill.s-accepte {
  background: #D1FAE5 !important;
  color: #059669 !important;
}
.cam-status-pill.s-accepte::before { background: #059669; }

.cam-status-pill.s-facture {
  background: #FFF3E0 !important;
  color: #E65100 !important;
}
.cam-status-pill.s-facture::before { background: #E65100; }

.cam-status-pill.s-refuse {
  background: #FEE2E2 !important;
  color: #DC2626 !important;
}
.cam-status-pill.s-refuse::before { background: #DC2626; }

.cam-status-pill.s-paid,
.cam-status-pill.s-paye {
  background: #D1FAE5 !important;
  color: #059669 !important;
}
.cam-status-pill.s-paid::before,
.cam-status-pill.s-paye::before { background: #059669; }

.cam-status-pill.s-impaye {
  background: #FEE2E2 !important;
  color: #DC2626 !important;
}
.cam-status-pill.s-impaye::before { background: #DC2626; }

/* ═══════════════════ 7. BOUTONS ACTIONS ═══════════════════ */
/* Groupe d'icônes d'action côte à côte */
.cam-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

/* Icônes SVG d'action — œil et menu */
.cam-action-btn {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 6px !important;
  color: var(--cam-text-2) !important;
  cursor: pointer !important;
  transition: background 150ms ease, color 150ms ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

.cam-action-btn svg {
  display: block;
  width: 16px;
  height: 16px;
}

.cam-action-btn:hover {
  background: var(--cam-orange-l) !important;
  color: var(--cam-orange) !important;
}

.cam-action-btn:focus-visible {
  outline: 2px solid var(--cam-orange);
  outline-offset: 2px;
}

/* Ancien bouton ⋯ encore présent → on garde le style mais on l'utilise plus */
.cam-actions-btn,
#tab-hist-scope .data-table tbody .btn.bg,
#tab-fact-scope .data-table tbody .btn.bg {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 6px !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  color: var(--cam-text-2) !important;
  cursor: pointer !important;
  transition: background 150ms ease, color 150ms ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

.cam-actions-btn:hover,
#tab-hist-scope .data-table tbody .btn.bg:hover,
#tab-fact-scope .data-table tbody .btn.bg:hover {
  background: var(--cam-orange-l) !important;
  color: var(--cam-orange) !important;
}

/* ═══════════════════ 8. ÉTAT VIDE ═══════════════════ */
#tab-hist-scope .empty,
#tab-fact-scope .empty {
  padding: 64px 20px;
  text-align: center;
  font-family: 'Inter', sans-serif;
  background: var(--cam-card);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

#tab-hist-scope .empty-t,
#tab-fact-scope .empty-t {
  font-family: 'Comfortaa', 'Inter', sans-serif !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: var(--cam-text) !important;
  margin-bottom: 6px !important;
  letter-spacing: -0.2px;
}

#tab-hist-scope .empty-s,
#tab-fact-scope .empty-s {
  font-size: 0.875rem !important;
  color: var(--cam-text-2) !important;
  font-weight: 400 !important;
}

/* ═══════════════════ 9. RESPONSIVE ═══════════════════ */
@media (max-width: 768px) {
  /* Masque la colonne Réf chantier sur mobile (manque de place) */
  #tab-hist-scope .data-table thead th.th-ref,
  #tab-fact-scope .data-table thead th.th-ref,
  #tab-hist-scope .data-table tbody td.cam-cell-ref-chantier,
  #tab-fact-scope .data-table tbody td.cam-cell-ref-chantier {
    display: none !important;
  }

  #tab-hist-scope,
  #tab-fact-scope {
    padding: 16px 12px;
  }

  #tab-hist-scope .wix-page-head,
  #tab-fact-scope .wix-page-head {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  #tab-hist-scope .wix-page-head h2,
  #tab-fact-scope .wix-page-head h2 {
    font-size: 1.25rem !important;
  }

  #tab-hist-scope .wix-page-head .btn.bp,
  #tab-fact-scope .wix-page-head .btn.bp {
    width: 100% !important;
  }

  #tab-hist-scope .stats-row,
  #tab-fact-scope .stats-row {
    flex-direction: column;
    gap: 8px;
  }

  #tab-hist-scope .wix-filterbar,
  #tab-fact-scope .wix-filterbar {
    flex-direction: column;
    align-items: stretch !important;
  }

  #tab-hist-scope .wix-filterbar > div:first-child,
  #tab-fact-scope .wix-filterbar > div:first-child {
    flex-direction: column;
    align-items: stretch !important;
  }

  #tab-hist-scope .wix-filterbar select.fs,
  #tab-fact-scope .wix-filterbar select.fs {
    width: 100%;
    min-width: 0;
  }

  #tab-hist-scope .wix-filterbar .sb,
  #tab-fact-scope .wix-filterbar .sb {
    margin-left: 0;
    max-width: none;
    flex-basis: auto;
  }

  #tab-hist-scope .data-table thead th,
  #tab-fact-scope .data-table thead th {
    padding: 8px !important;
    font-size: 0.6875rem !important;
  }

  #tab-hist-scope .data-table tbody td,
  #tab-fact-scope .data-table tbody td {
    padding: 12px 10px !important;
    font-size: 0.8125rem !important;
  }
}

/* ═══════════════════ 10. MENU CONTEXTUEL — open-up (T170i) ═══════════════════ */
/* Le patch JS détecte si l'espace en bas est insuffisant et ajoute la classe
   .open-up sur le menu .act-pop. La classe ne change que la position (gérée
   par le JS) et permet d'ajouter une légère animation directionnelle. */
.act-pop {
  animation: cam-pop-down 120ms ease-out;
}
.act-pop.open-up {
  animation: cam-pop-up 120ms ease-out;
  transform-origin: bottom center;
}

@keyframes cam-pop-down {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cam-pop-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════ T170p — Numéro éditable au clic ═══════════════════ */
[data-editable="true"]:hover {
  background: #FFF3E0 !important;
  outline: 1px dashed #E65100;
  outline-offset: 1px;
  position: relative;
}

[data-editable="true"]:hover::after {
  content: '✏️';
  font-size: 11px;
  margin-left: 4px;
  opacity: 0.6;
}
