/* CAMALARM T156 — Création facture : haut de page aligné Devis Express/Classique */
#tab-fcr-scope {
  max-width:1220px;
  margin-left:auto;
  margin-right:auto;
}

#tab-fcr-scope .dv-client-bar {
  display:grid !important;
  grid-template-columns:minmax(330px,1.1fr) minmax(280px,.9fr) auto auto !important;
  align-items:center !important;
  gap:14px !important;
  padding:16px 18px !important;
  background:#FFFFFF !important;
  border:1px solid #DDE7F2 !important;
  border-radius:18px !important;
  box-shadow:0 1px 3px rgba(15,23,42,.05),0 12px 30px rgba(15,23,42,.035) !important;
  margin-bottom:18px !important;
}

#tab-fcr-scope .dv-client-left {
  display:flex !important;
  align-items:center !important;
  gap:14px !important;
  min-width:0 !important;
}

#tab-fcr-scope .dv-client-avatar {
  width:52px !important;
  height:52px !important;
  min-width:52px !important;
  border-radius:999px !important;
  background:linear-gradient(135deg,#FF7A1A,#E65100) !important;
  color:white !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  box-shadow:0 10px 22px rgba(230,81,0,.18) !important;
}

#tab-fcr-scope .dv-client-avatar svg {
  width:20px !important;
  height:20px !important;
  stroke-width:2 !important;
}

#tab-fcr-scope .dv-client-info {
  display:flex !important;
  align-items:center !important;
  gap:12px !important;
  min-width:0 !important;
  flex:1 1 auto !important;
}

#tab-fcr-scope #fcrCI {
  display:flex !important;
  flex-direction:column !important;
  justify-content:center !important;
  min-width:0 !important;
  max-width:360px !important;
}

#tab-fcr-scope .dv-client-name {
  font-family:Comfortaa,Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif !important;
  font-size:15px !important;
  font-weight:800 !important;
  line-height:1.2 !important;
  color:#0F1729 !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

#tab-fcr-scope .dv-client-meta {
  display:flex !important;
  gap:8px !important;
  align-items:center !important;
  flex-wrap:wrap !important;
  margin-top:4px !important;
  color:#64748B !important;
  font-size:12px !important;
  line-height:1.25 !important;
}

#tab-fcr-scope .dv-client-meta span:empty {
  display:none !important;
}

#tab-fcr-scope #fcrCempty {
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:7px !important;
  height:38px !important;
  padding:0 14px !important;
  border:1px solid #CBD5E1 !important;
  border-radius:10px !important;
  background:#FFFFFF !important;
  color:#0F3D67 !important;
  font-size:12.5px !important;
  font-weight:750 !important;
  white-space:nowrap !important;
  cursor:pointer !important;
  transition:background .15s,border-color .15s,box-shadow .15s !important;
  flex:0 0 auto !important;
}

#tab-fcr-scope #fcrCempty:hover {
  background:#F8FAFC !important;
  border-color:#93B5D4 !important;
  box-shadow:0 6px 16px rgba(15,23,42,.06) !important;
}

#tab-fcr-scope #fcrCempty svg {
  width:13px !important;
  height:13px !important;
}

#tab-fcr-scope .dv-client-project {
  min-width:0 !important;
}

#tab-fcr-scope .dv-client-project #fcr_titre {
  height:42px !important;
  border:1px solid #D8E0EA !important;
  border-radius:10px !important;
  background:#FFFFFF !important;
  padding:0 14px !important;
  font-size:13px !important;
  font-weight:550 !important;
  color:#0F1729 !important;
  box-shadow:none !important;
}

#tab-fcr-scope .dv-client-project #fcr_titre:focus {
  border-color:#E65100 !important;
  box-shadow:0 0 0 3px rgba(230,81,0,.12) !important;
}

#tab-fcr-scope .dv-client-actions {
  display:flex !important;
  justify-content:flex-end !important;
  align-items:center !important;
}

#tab-fcr-scope .dv-client-ref {
  min-width:240px !important;
  display:flex !important;
  justify-content:flex-end !important;
  align-items:center !important;
  gap:10px !important;
  padding:7px 10px !important;
  border-radius:12px !important;
  background:#F8FAFC !important;
  border:1px solid #E2E8F0 !important;
}

#tab-fcr-scope #fcrDt {
  width:124px !important;
  height:34px !important;
  border:1px solid #D8E0EA !important;
  border-radius:9px !important;
  background:#FFFFFF !important;
  padding:0 8px !important;
  color:#0F1729 !important;
  font-size:12.5px !important;
  font-weight:700 !important;
}

#tab-fcr-scope #fcrNm {
  margin-left:0 !important;
  min-width:88px !important;
  color:#0F3D67 !important;
  font-family:JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,monospace !important;
  font-size:13px !important;
  font-weight:800 !important;
  white-space:nowrap !important;
}

/* Projet facture : même densité et respiration que les pages Devis */
#tab-fcr-scope .dv-card {
  border:1px solid #DDE7F2 !important;
  border-radius:16px !important;
  box-shadow:0 1px 3px rgba(15,23,42,.05) !important;
  overflow:hidden !important;
}

#tab-fcr-scope .dv-card-header {
  min-height:56px !important;
  padding:15px 18px !important;
  border-bottom:1px solid #E5EAF1 !important;
  background:#FFFFFF !important;
}

#tab-fcr-scope .dv-card-title {
  color:#0F3D67 !important;
  font-size:16px !important;
  font-weight:800 !important;
  letter-spacing:-.02em !important;
}

#tab-fcr-scope .dv-field-label {
  color:#64748B !important;
  font-size:11px !important;
  font-weight:850 !important;
  letter-spacing:.08em !important;
  text-transform:uppercase !important;
}

/* Tableau facture : alignement et largeur cohérents avec Devis Classique */
#tab-fcr-scope .dv-extras {
  display:block !important;
  width:100% !important;
  border-collapse:separate !important;
  border-spacing:0 !important;
}

#tab-fcr-scope .dv-extras thead {
  display:block !important;
  margin:0 0 6px !important;
}

#tab-fcr-scope .dv-extras thead tr {
  display:grid !important;
  /* T209C : grid-template-columns retirée — laisser --fcr-grid (invoice-lines-final.css) prendre la main */
  gap:10px !important;
  align-items:center !important;
  padding:0 12px !important;
}

#tab-fcr-scope .dv-extras thead th {
  display:block !important;
  width:auto !important;
  padding:0 !important;
  border:0 !important;
  text-align:left !important;
  font-size:11px !important;
  font-weight:850 !important;
  letter-spacing:.06em !important;
  text-transform:uppercase !important;
  color:#64748B !important;
}

/* T209C : nth-child shifté +1 — Total = col 7 (avec grip en col 1) */
#tab-fcr-scope .dv-extras thead th:nth-child(7) {
  text-align:right !important;
}

#tab-fcr-scope #fcrTB {
  display:block !important;
}

#tab-fcr-scope #fcrTB tr {
  display:grid !important;
  /* T209C : grid-template-columns retirée — laisser --fcr-grid (invoice-lines-final.css) prendre la main */
  gap:10px !important;
  align-items:center !important;
  padding:8px 12px !important;
  margin:0 0 8px !important;
  background:#F8FAFC !important;
  border:1px solid #EDF2F7 !important;
  border-left:4px solid #E65100 !important;
  border-radius:10px !important;
}

#tab-fcr-scope #fcrTB td {
  display:block !important;
  padding:0 !important;
  border:0 !important;
  min-width:0 !important;
  width:auto !important;
}

#tab-fcr-scope #fcrTB input,
#tab-fcr-scope #fcrTB select {
  width:100% !important;
  min-width:0 !important;
  height:38px !important;
  min-height:38px !important;
  box-sizing:border-box !important;
  border:1px solid #D8E0EA !important;
  border-radius:9px !important;
  background:#FFFFFF !important;
  color:#0F1729 !important;
  font-size:13px !important;
  font-weight:650 !important;
  box-shadow:none !important;
}

/* T209C : grille a 8 colonnes (grip + 7). nth-child shifté de +1.
   col 1=grip, 2=Réf, 3=Désignation, 4=Qté, 5=Prix unit., 6=TVA, 7=Total, 8=Action */
#tab-fcr-scope #fcrTB td:nth-child(4) input {
  text-align:center !important;
  font-variant-numeric:tabular-nums !important;
}

#tab-fcr-scope #fcrTB td:nth-child(5) input {
  background:#F9FAFB !important;
  border-left:3px solid #E65100 !important;
  text-align:right !important;
  font-variant-numeric:tabular-nums !important;
}

#tab-fcr-scope #fcrTB select {
  padding:0 20px 0 8px !important;
  text-align-last:center !important;
}

#tab-fcr-scope #fcrTB [data-tot] {
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  height:38px !important;
  font-family:JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,monospace !important;
  font-size:13px !important;
  font-weight:800 !important;
  color:#0F1729 !important;
}

@media(max-width:1100px){
  #tab-fcr-scope .dv-client-bar {
    grid-template-columns:1fr !important;
  }
  #tab-fcr-scope .dv-client-ref {
    min-width:0 !important;
    justify-content:space-between !important;
  }
  #tab-fcr-scope .dv-extras thead {
    display:none !important;
  }
  #tab-fcr-scope #fcrTB tr {
    grid-template-columns:1fr 1fr !important;
  }
  /* T209C : shift +1 (grip en col 1) */
  #tab-fcr-scope #fcrTB td:nth-child(3),
  #tab-fcr-scope #fcrTB td:nth-child(7),
  #tab-fcr-scope #fcrTB td:nth-child(8) {
    grid-column:1/-1 !important;
  }
}


/* CAMALARM T158 — Facture fidèle au modèle Devis Classique */

/* Bandeau client : même logique que Devis Classique */
#tab-fcr-scope .dv-client-bar {
  display:grid !important;
  grid-template-columns:minmax(440px,1.2fr) minmax(320px,.95fr) auto !important;
  gap:16px !important;
  align-items:center !important;
  padding:14px 18px !important;
  background:#fff !important;
  border:0 !important;
  border-radius:12px !important;
  box-shadow:0 1px 3px rgba(0,0,0,.06) !important;
}

#tab-fcr-scope .dv-client-left {
  display:flex !important;
  align-items:center !important;
  gap:14px !important;
  min-width:0 !important;
}

#tab-fcr-scope .dv-client-avatar {
  width:46px !important;
  height:46px !important;
  min-width:46px !important;
  border-radius:50% !important;
  background:linear-gradient(180deg,#ff7a1a 0%,#ff6a00 100%) !important;
  color:#fff !important;
  border:0 !important;
  box-shadow:none !important;
}

#tab-fcr-scope .dv-client-avatar svg {
  display:none !important;
}

#tab-fcr-scope .dv-client-avatar::before {
  content:attr(data-initials) !important;
  font-family:Comfortaa,Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif !important;
  font-size:14px !important;
  font-weight:700 !important;
  color:#fff !important;
}

#tab-fcr-scope .dv-client-info {
  min-width:0 !important;
  flex:1 1 auto !important;
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:14px !important;
}

#tab-fcr-scope #fcrCI {
  flex:1 1 auto !important;
  min-width:0 !important;
  max-width:none !important;
  background:transparent !important;
  border:0 !important;
  padding:0 !important;
  display:grid !important;
  gap:2px !important;
}

#tab-fcr-scope .dv-client-name,
#tab-fcr-scope #fcrCN {
  font-family:Comfortaa,Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif !important;
  font-size:17px !important;
  font-weight:700 !important;
  color:#0F1729 !important;
  line-height:1.22 !important;
  letter-spacing:-.02em !important;
  white-space:normal !important;
  overflow:visible !important;
  text-overflow:unset !important;
}

#tab-fcr-scope .dv-client-meta {
  display:grid !important;
  gap:1px !important;
  margin:0 !important;
}

#tab-fcr-scope .dv-client-meta span,
#tab-fcr-scope #fcrCE,
#tab-fcr-scope #fcrCT {
  display:block !important;
  min-height:auto !important;
  padding:0 !important;
  border:0 !important;
  background:transparent !important;
  border-radius:0 !important;
  font-size:11.75px !important;
  font-weight:500 !important;
  color:#7B8794 !important;
  line-height:1.4 !important;
}

#tab-fcr-scope #fcrCempty {
  height:38px !important;
  min-width:auto !important;
  max-width:none !important;
  padding:0 16px !important;
  margin-left:auto !important;
  border-radius:10px !important;
  border:1px solid #D1D5DB !important;
  background:#fff !important;
  color:#374151 !important;
  font-size:12.75px !important;
  font-weight:600 !important;
  justify-content:center !important;
  white-space:nowrap !important;
  box-shadow:none !important;
}

#tab-fcr-scope #fcrCempty:hover {
  background:#F3F4F6 !important;
  border-color:#C1C9D2 !important;
}

#tab-fcr-scope #fcrCempty svg {
  display:none !important;
}

/* Supprime le doublon bouton Ajouter client / Nouveau dans le header facture */
#tab-fcr-scope .dv-client-actions {
  display:none !important;
}

/* Facture : bloc date + numéro comme Devis Classique */
#tab-fcr-scope .dv-client-ref {
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  gap:10px !important;
  min-width:238px !important;
  min-height:50px !important;
  padding:0 12px !important;
  background:#F8FAFC !important;
  border:1px solid #EEF2F6 !important;
  border-radius:10px !important;
}

#tab-fcr-scope #fcrDt {
  width:128px !important;
  height:38px !important;
  border-radius:9px !important;
  border:1px solid #D8E0EA !important;
  background:#fff !important;
  font-size:12.75px !important;
  font-weight:600 !important;
  padding:0 9px !important;
}

#tab-fcr-scope #fcrNm {
  font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif !important;
  font-size:12.75px !important;
  font-weight:700 !important;
  color:#1D4ED8 !important;
  min-width:auto !important;
}

/* T209C : Bloc retiré.
   L'ancienne règle imposait grid-template-columns:120px minmax(440px,1fr) 74px 112px 84px 118px 34px !important
   ce qui est une grille 7 colonnes SANS grip, alors qu'invoice-lines-final.css (--fcr-grid)
   utilise 8 colonnes AVEC grip cell. Conflit éliminé en supprimant la règle. */

#tab-fcr-scope #fcrTB tr {
  align-items:flex-start !important;
  min-height:92px !important;
  padding:10px 12px !important;
}

#tab-fcr-scope #fcrTB td {
  align-self:stretch !important;
}

/* T209C : nth-child shifté +1 (col 1=grip) */
#tab-fcr-scope #fcrTB td:nth-child(4),
#tab-fcr-scope #fcrTB td:nth-child(5),
#tab-fcr-scope #fcrTB td:nth-child(6),
#tab-fcr-scope #fcrTB td:nth-child(7),
#tab-fcr-scope #fcrTB td:nth-child(8) {
  display:flex !important;
  align-items:center !important;
}

#tab-fcr-scope #fcrTB textarea[data-fcr-desc] {
  min-height:72px !important;
  height:72px !important;
  line-height:1.35 !important;
  padding:12px 14px !important;
  resize:vertical !important;
  overflow:auto !important;
  white-space:pre-wrap !important;
  font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif !important;
  font-size:13px !important;
  font-weight:500 !important;
  color:#0F1729 !important;
}

#tab-fcr-scope #fcrTB input[data-fcr-ref] {
  min-height:38px !important;
}

#tab-fcr-scope #fcrTB input[data-fcr-qty],
#tab-fcr-scope #fcrTB input[data-fcr-price],
#tab-fcr-scope #fcrTB select[data-fcr-tva] {
  height:44px !important;
  min-height:44px !important;
}

#tab-fcr-scope #fcrTB [data-tot] {
  height:44px !important;
  min-height:44px !important;
}

/* En mobile, la description garde la priorité */
@media(max-width:1100px){
  #tab-fcr-scope .dv-extras thead tr,
  #tab-fcr-scope #fcrTB tr {
    grid-template-columns:1fr 1fr !important;
  }
  /* T209C : shift +1 (grip en col 1) */
  #tab-fcr-scope #fcrTB td:nth-child(3),
  #tab-fcr-scope #fcrTB td:nth-child(7),
  #tab-fcr-scope #fcrTB td:nth-child(8) {
    grid-column:1/-1 !important;
  }
}
