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

:root {
  --bleu-fb: #1877F2;
  --bleu-fb-fonce: #0e5fd8;
  --fond: #f0f2f5;
  --carte: #ffffff;
  --texte: #1c1e21;
  --texte-secondaire: #65676b;
  --bordure: #dddfe2;
  --erreur: #d93025;
  --rayon: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.5;
}

.entete {
  background: linear-gradient(135deg, var(--bleu-fb), #4a92ff);
  color: #fff;
  padding: 28px 16px 32px;
  text-align: center;
}
.entete h1 { font-size: 1.5rem; margin-bottom: 4px; }
.sous-titre { opacity: 0.9; font-size: 0.95rem; }

main {
  max-width: 780px;
  margin: -12px auto 32px;
  padding: 0 12px;
}

.carte {
  background: var(--carte);
  border-radius: var(--rayon);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  padding: 20px;
  margin-bottom: 20px;
}
.carte h2 {
  font-size: 1.05rem;
  margin-bottom: 14px;
  color: var(--texte);
}

.grille {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.pleine-largeur { grid-column: 1 / -1; }

.champ { margin-bottom: 12px; }
.champ label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--texte);
}
.obligatoire { color: var(--erreur); }

input[type="text"], input[type="url"], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--texte);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--bleu-fb);
  box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.18);
}
textarea { resize: vertical; }

.btn-principal {
  width: 100%;
  background: var(--bleu-fb);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s;
}
.btn-principal:hover { background: var(--bleu-fb-fonce); }
.btn-principal:disabled { opacity: 0.6; cursor: wait; }

.btn-secondaire {
  background: #e7f3ff;
  color: var(--bleu-fb-fonce);
  border: 1px solid #b9dcff;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondaire:hover { background: #d5e9ff; }

.boutons-action {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.spinner-cache { display: none; }
#spinner {
  margin-top: 10px;
  text-align: center;
  color: var(--texte-secondaire);
  font-size: 0.9rem;
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--bordure);
  border-top-color: var(--bleu-fb);
  border-radius: 50%;
  animation: rotation 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes rotation { to { transform: rotate(360deg); } }

.erreur-cache { display: none; }
#erreur {
  margin-top: 12px;
  background: #fdeceb;
  color: var(--erreur);
  border: 1px solid #f5c6c2;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.resultat-cache { display: none; }

/* ---- Aperçu façon post Facebook ---- */
.post-fb {
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  overflow: hidden;
  margin-bottom: 20px;
}
.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bleu-fb), #7ab3ff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.post-page { font-weight: 700; font-size: 0.95rem; }
.post-meta { font-size: 0.8rem; color: var(--texte-secondaire); }

.post-visuel {
  background: #e4e6eb;
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.post-visuel-icone { font-size: 2.4rem; }
.post-visuel-label {
  font-size: 0.85rem;
  color: var(--texte-secondaire);
  font-weight: 600;
}

.post-corps { padding: 14px; }
.post-titre { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.post-description {
  font-size: 0.95rem;
  white-space: pre-line;
}
.post-separateur {
  border: none;
  border-top: 1px solid var(--bordure);
  margin: 12px 0;
}
.post-about {
  font-style: italic;
  color: var(--texte-secondaire);
  font-size: 0.9rem;
  white-space: pre-line;
}

.copie-ok-cache { display: none; }
#copie-ok {
  margin-top: 10px;
  color: #188038;
  font-size: 0.9rem;
  font-weight: 600;
}

.pied {
  text-align: center;
  color: var(--texte-secondaire);
  font-size: 0.8rem;
  padding: 0 12px 24px;
}

/* ---- Mobile-first : 1 colonne ---- */
@media (max-width: 640px) {
  .grille { grid-template-columns: 1fr; }
  .entete h1 { font-size: 1.25rem; }
  .carte { padding: 16px; }
  .tableau { font-size: 0.82rem; }
  .tableau th, .tableau td { padding: 7px 8px; }
  /* Mobile : lignes sur une seule ligne — le scroll local de l'enveloppe
     gère la largeur (évite les mots coupés en syllabes) */
  .tableau th, .tableau td { white-space: nowrap; }
  /* Colonne Description (la plus longue) masquée dans les 2 tableaux */
  #projets-liste-carte thead th:nth-child(2),
  #projets-tbody td:nth-child(2),
  #projet-detail-carte thead th:nth-child(4),
  #produits-tbody td:nth-child(4) { display: none; }
  /* Dates : ne jamais couper en plein mot */
  #projets-tbody td:nth-child(4),
  #produits-tbody td:nth-child(6) { white-space: nowrap; }
  /* Barre de session : pilule lisible par-dessus le chevauchement du header */
  .barre-session {
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  }
  .bouton-petit { padding: 3px 7px; font-size: 0.78rem; margin-left: 2px; }
  .nouveau-projet { grid-template-columns: 1fr; }
  .nouveau-projet button { width: 100%; }
  .modale-contenu { padding: 18px 16px; }
  .post-visuel { height: 140px; }
}

/* ---- Icônes SVG inline (sprite <use>) ---- */
.icone-svg {
  display: inline-block;
  vertical-align: -3px;
  margin-right: 6px;
  flex-shrink: 0;
}
/* Sur certaines lignes flex, l'icône ne doit pas pousser la ligne vers le bas */
.barre-onglets button .icone-svg,
.bouton-petit .icone-svg,
.btn-secondaire .icone-svg,
.btn-principal .icone-svg {
  vertical-align: -2px;
}

/* ---- Login / session ---- */
.ecran-cache { display: none !important; }

#ecran-login {
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

#erreur-login {
  margin-top: 12px;
  background: #fdeceb;
  color: var(--erreur);
  border: 1px solid #f5c6c2;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.barre-session {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--texte-secondaire);
  margin-bottom: 12px;
}
.btn-lien {
  background: none;
  border: none;
  color: var(--bleu-fb);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}
.btn-lien:hover { text-decoration: underline; }

/* ---- Navigation par onglets (Générateur / Produits & Projets) ---- */
.barre-onglets {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--carte);
  border-radius: var(--rayon);
  padding: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.barre-onglets button {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--texte-secondaire);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.barre-onglets button:hover { background: #f4f6f8; }
.barre-onglets button.onglet-actif {
  background: var(--bleu-fb);
  color: #fff;
}

.onglet-cache { display: none !important; }

/* ---- Tableau projets / produits ---- */
/* Enveloppe scrollable : sur mobile, le tableau déborde DANS sa carte
   (scroll horizontal local) au lieu de pousser toute la page. */
.tableau-enveloppe {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
  border-radius: 6px;
}
.tableau-enveloppe::-webkit-scrollbar { height: 6px; }
.tableau-enveloppe::-webkit-scrollbar-thumb { background: var(--bordure); border-radius: 3px; }

.tableau {
  width: 100%;
  min-width: 520px; /* force le tableau à conserver sa mise en page ;
                       l'enveloppe gère le scroll horizontal */
  border-collapse: collapse;
  font-size: 0.9rem;
}
.tableau th, .tableau td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--bordure);
  vertical-align: top;
}
.tableau th {
  background: #f4f6f8;
  font-weight: 600;
  color: var(--texte-secondaire);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tableau tr:hover { background: #fafbfc; }
.tableau .col-actions { text-align: right; white-space: nowrap; }

.bouton-petit {
  background: none;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85rem;
  color: var(--texte-secondaire);
  cursor: pointer;
  margin-left: 4px;
}
.param-projet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--texte-secondaire);
  cursor: pointer;
  white-space: nowrap;
}
.param-projet input { accent-color: var(--accent); cursor: pointer; }
.bouton-petit:hover { background: #f0f2f5; }
.bouton-petit.danger { color: var(--erreur); border-color: #f5c6c2; }
.bouton-petit.danger:hover { background: #fdeceb; }

.nouveau-projet {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
  padding: 12px;
  background: #f4f6f8;
  border-radius: 8px;
}
.nouveau-projet .champ { margin-bottom: 0; }

/* ---- Vue détail produit ---- */
.retour-liste {
  background: none;
  border: none;
  color: var(--bleu-fb);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 8px 0;
}
.retour-liste:hover { text-decoration: underline; }

/* ---- Drop zone photos ---- */
.zone-depot {
  border: 2px dashed var(--bordure);
  border-radius: 10px;
  padding: 22px 14px;
  text-align: center;
  color: var(--texte-secondaire);
  cursor: pointer;
  background: #fafbfc;
  transition: border-color 0.15s, background 0.15s;
}
.zone-depot:hover, .zone-depot.drag-over {
  border-color: var(--bleu-fb);
  background: #e7f3ff;
  color: var(--bleu-fb);
}
.zone-depot input[type="file"] { display: none; }
.zone-depot .icone { font-size: 1.8rem; display: block; margin-bottom: 4px; }

.grille-miniatures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.miniature {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f2f5;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--bordure);
}
.miniature img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.miniature .suppr {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px; height: 24px;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.miniature .suppr:hover { background: var(--erreur); }

.message-ok, .message-info {
  background: #e6f4ea;
  color: #188038;
  border: 1px solid #b7e1c5;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  margin-top: 8px;
  white-space: pre-wrap;
}
.message-info {
  background: #e7f3ff;
  color: var(--bleu-fb-fonce);
  border-color: #b9dcff;
}
@media (max-width: 640px) {
  .nouveau-projet { grid-template-columns: 1fr; }
}

/* ---- Drop target sur les lignes du tableau produits ---- */
.tableau tr.drop-target {
  outline: 2px dashed var(--bleu-fb);
  outline-offset: -2px;
  background: #e7f3ff !important;
}
.tableau tr.drop-target td {
  background: #e7f3ff;
}

/* ---- Vignette + compteur photos dans la liste produits ---- */
.col-photos {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vignette-liste {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--bordure);
  background: #f0f2f5;
  flex-shrink: 0;
}
.compteur-photos {
  font-size: 0.85rem;
  color: var(--texte-secondaire);
  font-weight: 600;
}

/* ---- Modales (Détails / Formulaire produit) ---- */
.modale-cache { display: none !important; }
.modale-cache[aria-modal="true"] { display: none !important; }
#modale-details, #modale-formulaire, #modale-page-edit {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modale-contenu {
  background: var(--carte);
  border-radius: var(--rayon);
  padding: 24px;
  max-width: 640px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  position: relative;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}
.modale-contenu.modale-large { max-width: 880px; }
.modale-contenu hr {
  border: none;
  border-top: 1px solid var(--bordure);
  margin: 18px 0;
}
.modale-contenu h2 {
  margin-bottom: 16px;
  padding-right: 30px;
}
.modale-fermer {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--texte-secondaire);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}
.modale-fermer:hover { background: #f0f2f5; color: var(--erreur); }

/* ---- Détails produit (dans la modale) ---- */
.detail-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bordure);
  font-size: 0.92rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  color: var(--texte-secondaire);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-value {
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-value a { color: var(--bleu-fb); }
.detail-photos-section {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--bordure);
}
.detail-photos-section h3 {
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: var(--texte-secondaire);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-grille-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.detail-grille-photos a {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--bordure);
  background: #f0f2f5;
  aspect-ratio: 4 / 3;
  transition: transform 0.15s;
}
.detail-grille-photos a:hover { transform: scale(1.03); border-color: var(--bleu-fb); }
.detail-grille-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.detail-prix-barre {
  text-decoration: line-through;
  color: var(--texte-secondaire);
  margin-left: 8px;
  font-size: 0.85rem;
}
.formulaire-modale .grille { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) {
  .detail-row { grid-template-columns: 1fr; gap: 2px; }
  .formulaire-modale .grille { grid-template-columns: 1fr; }
}

/* ============ Onglet Automatisation ============ */
.grille-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grille-2col { grid-template-columns: 1fr; } }
.bouton-vert { background: #22a06b; }
.bouton-vert:hover { background: #1e8f60; }
.case-coche { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.aide-texte { font-size: 0.85rem; color: var(--texte-secondaire); margin: 4px 0 12px; }
.aide-texte code { background: rgba(127,127,127,.12); padding: 1px 5px; border-radius: 4px; }
.tpl-carte { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--bordure); border-radius: 10px; margin-bottom: 8px; background: var(--carte-alt, transparent); }
.tpl-carte .tpl-infos { flex: 1; min-width: 0; }
.tpl-carte .tpl-nom { font-weight: 600; font-size: 0.9rem; }
.tpl-carte .tpl-contenu { font-size: 0.85rem; color: var(--texte-secondaire); white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.tpl-carte .tpl-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-petit { padding: 4px 10px; font-size: 0.78rem; border-radius: 8px; border: 1px solid var(--bordure); background: transparent; cursor: pointer; color: var(--texte-principal); }
.btn-petit:hover { background: rgba(127,127,127,.12); }
.btn-petit.danger { color: #e5534b; }
.btn-petit.danger:hover { background: rgba(229,83,75,.12); }
.badge { display: inline-block; font-size: 0.72rem; padding: 1px 8px; border-radius: 99px; background: rgba(127,127,127,.15); margin-left: 6px; }
.badge.inactif { background: rgba(229,83,75,.15); color: #e5534b; }
.ligne-journal { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--bordure); font-size: 0.85rem; align-items: baseline; }
.ligne-journal .j-date { color: var(--texte-secondaire); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ligne-journal .j-produit { font-weight: 600; white-space: nowrap; }
.ligne-journal .j-msg { color: var(--texte-secondaire); }
.ligne-journal .j-statut { font-weight: 600; }
.j-statut.genere { color: #22a06b; }
.j-statut.erreur { color: #e5534b; }
.j-statut.ignore { color: var(--texte-secondaire); }

/* ---- Sous-onglets (à l'intérieur de l'onglet Automatisation) ---- */
.sous-onglets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  background: var(--carte);
  border-radius: var(--rayon);
  padding: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.sous-onglet {
  flex: 1 1 auto;
  background: none;
  border: 1px solid var(--bordure);
  padding: 7px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texte-secondaire);
  cursor: pointer;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.sous-onglet:hover {
  background: #f4f6f8;
  color: var(--texte);
}
.sous-onglet.sous-onglet-actif {
  background: var(--bleu-fb);
  color: #fff;
  border-color: var(--bleu-fb);
}
.sous-onglet-panneau {
  /* Visible par défaut sauf si .onglet-cache ajouté par JS */
}
/* Variant plus compact pour les drop zones de l'onglet auto */
.zone-depot-compacte {
  padding: 14px 10px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.zone-depot-compacte .icone {
  font-size: 1.4rem;
  margin-bottom: 2px;
}

/* Feedback (utilisé par l'onglet auto via feedback(...)) */
.feedback {
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  margin-top: 8px;
  white-space: pre-wrap;
}
.feedback-ok {
  background: #e6f4ea;
  color: #188038;
  border: 1px solid #b7e1c5;
}
.feedback-info {
  background: #e7f3ff;
  color: var(--bleu-fb-fonce);
  border: 1px solid #b9dcff;
}
.feedback-erreur {
  background: #fdeceb;
  color: var(--erreur);
  border: 1px solid #f5c6c2;
}

@media (max-width: 640px) {
  .sous-onglets-bar { padding: 5px; gap: 5px; }
  .sous-onglet { font-size: 0.78rem; padding: 6px 9px; flex: 1 1 calc(50% - 5px); }
}

/* ============ Éditeur de templates vidéo (canvas N8N) ============ */
.canvas-n8n {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 12px;
  background: #f7f9fb;
  border: 1px dashed var(--bordure);
  border-radius: 10px;
  min-height: 80px;
  margin-top: 6px;
}
.noeud-n8n {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--bordure);
  border-left: 4px solid var(--bleu-fb);
  border-radius: 10px;
  padding: 12px 12px 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  margin: 0;
}
.noeud-n8n.type-intro, .noeud-n8n.type-outro { border-left-color: #1877F2; }
.noeud-n8n.type-hook { border-left-color: #f59e0b; }
.noeud-n8n.type-photos { border-left-color: #22a06b; }
.noeud-n8n.type-audio { border-left-color: #8b5cf6; background: #faf8ff; }
.noeud-n8n .noeud-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.noeud-n8n .noeud-titre {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--texte);
  text-transform: capitalize;
}
.noeud-n8n .noeud-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.noeud-n8n .noeud-actions button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--texte-secondaire);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.noeud-n8n .noeud-actions button:hover { background: rgba(127,127,127,0.12); color: var(--texte); }
.noeud-n8n .noeud-actions button.actif:disabled { opacity: 0.35; cursor: not-allowed; }
.noeud-n8n .noeud-actions button.danger:hover { background: rgba(229,83,75,0.15); color: #e5534b; }
.noeud-n8n .noeud-params {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.noeud-n8n .noeud-params .champ { margin-bottom: 0; }
.noeud-n8n .noeud-params .champ label { font-size: 0.75rem; font-weight: 600; color: var(--texte-secondaire); margin-bottom: 2px; }
.noeud-n8n .noeud-params input,
.noeud-n8n .noeud-params select {
  padding: 6px 8px;
  font-size: 0.85rem;
}
.noeud-n8n .noeud-params .pleine-largeur { grid-column: 1 / -1; }
.noeud-n8n .noeud-index {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bleu-fb);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.noeud-n8n.type-audio .noeud-index { background: #8b5cf6; }
.noeud-n8n.type-hook .noeud-index { background: #f59e0b; }
.noeud-n8n.type-photos .noeud-index { background: #22a06b; }
.connecteur-n8n {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 22px;
  color: var(--bordure);
  margin: 0;
}
.connecteur-n8n svg { display: block; }
@media (max-width: 520px) {
  .noeud-n8n .noeud-params { grid-template-columns: 1fr; }
  .noeud-n8n .noeud-params .pleine-largeur { grid-column: 1; }
}
.video-apercu {
  width: 100%;
  max-width: 360px;
  border-radius: 10px;
  border: 1px solid var(--bordure);
  background: #000;
  display: block;
  margin-top: 6px;
}
.tableau td .btn-petit { margin-right: 2px; }
.badge-actif { background: rgba(34,160,107,0.18); color: #1e8f60; }

/* ==============================================================
   Partie A — Carte « Liaison projets → comptes »
   Tableau 2 colonnes minimaliste (réutilise .case-coche).
   ============================================================== */
.tableau-2col {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  background: var(--carte, #fff);
}
.tableau-2col th,
.tableau-2col td {
  padding: 8px 10px;
  border: 1px solid var(--bordure, #d0d7de);
  vertical-align: middle;
  font-size: 0.85rem;
}
.tableau-2col th {
  background: #1f2937;
  color: #f5f5f5;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
.tableau-2col td.colonne-projet {
  font-weight: 600;
  background: rgba(127,127,127,0.06);
}
.tableau-2col td.colonne-compte {
  text-align: center;
  width: 110px;
}
.tableau-2col tbody tr:hover td {
  background: rgba(127,127,127,0.04);
}
.tableau-2col .case-coche {
  justify-content: center;
  font-weight: 400;
}
.tableau-2col .case-coche input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ==============================================================
   Partie B — Éditeur vidéo : transitions + groupes parallèles
   ============================================================== */
.connecteur-n8n {
  position: relative;
}
.transition-badge {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1f2937;
  color: #f9fafb;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.noeud-n8n.type-parallele {
  border: 1.5px dashed #7c5cff;
  background: #faf8ff;
  border-left: 4px solid #7c5cff;
}
.noeud-n8n.type-parallele .noeud-index {
  background: #7c5cff;
}
.noeud-parallele-interne {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 8px 4px 4px;
}
.sous-noeud-n8n {
  background: #ffffff;
  border: 1px solid var(--bordure, #d0d7de);
  border-left: 3px solid #7c5cff;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sous-noeud-n8n.type-intro,
.sous-noeud-n8n.type-outro { border-left-color: #1877F2; }
.sous-noeud-n8n.type-hook  { border-left-color: #f59e0b; }
.sous-noeud-n8n.type-photos{ border-left-color: #22a06b; }
.sous-noeud-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--texte-secondaire);
  gap: 4px;
}
.sous-noeud-entete .sous-noeud-titre {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sous-noeud-entete .sous-noeud-retirer {
  background: transparent;
  border: none;
  color: #e5534b;
  cursor: pointer;
  padding: 0 4px;
  font-size: 0.9rem;
  line-height: 1;
}
.sous-noeud-entete .sous-noeud-retirer:hover { color: #b7322b; }
.sous-noeud-n8n .champ { margin-bottom: 0; }
.sous-noeud-n8n .champ label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--texte-secondaire);
  margin-bottom: 1px;
}
.sous-noeud-n8n input,
.sous-noeud-n8n select {
  font-size: 0.85rem;
  padding: 4px 6px;
  width: 100%;
  box-sizing: border-box;
}
.badge-inactif { background: rgba(127,127,127,0.18); color: var(--texte-secondaire); }

/* ---- Films : pages de vente + projets de liens ---- */
.case-vente { background: rgba(255, 193, 7, 0.10); border-radius: 6px; padding: 2px 6px; }
.badge-vente { background: #ffc107; color: #1a1a1a; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.pjf-cache { display: none; }
.pjf-projet.ouvert { border-color: #4caf50 !important; }

/* ---- Vue d'ensemble : milestones / barres de progression ---- */
.milestone-bloc {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.milestone-titre {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.milestone-titre .statut-puce {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
}
.puce-ok { background: #4caf50; }
.puce-partiel { background: #ffc107; }
.puce-erreur { background: #ef5350; }
.puce-inactif { background: #b0bec5; }
.milestone-jalons {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 10px 0 6px;
}
.milestone-point {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 1; text-align: center; min-width: 0;
}
.milestone-rond {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #cbd5e1; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #94a3b8; flex-shrink: 0;
}
.milestone-rond.fait { background: #4caf50; border-color: #4caf50; color: #fff; }
.milestone-rond.actif { background: #ffc107; border-color: #ffc107; color: #1a1a1a; }
.milestone-rond.erreur { background: #ef5350; border-color: #ef5350; color: #fff; }
.milestone-lien {
  height: 3px; flex: 1; background: #e2e8f0; border-radius: 2px; margin: 0 -2px 18px;
}
.milestone-lien.fait { background: #4caf50; }
.milestone-lien.actif { background: #ffc107; }
.milestone-lien.erreur { background: #ef5350; }
.milestone-label { font-size: 0.72rem; color: var(--texte-secondaire); line-height: 1.15; }
.milestone-label.fait { color: #2e7d32; font-weight: 600; }
.milestone-label.actif { color: #b26a00; font-weight: 600; }
.milestone-detail { font-size: 0.8rem; color: var(--texte-secondaire); margin-top: 4px; }
.barre-progression {
  height: 8px; background: #e2e8f0; border-radius: 6px; overflow: hidden; margin-top: 6px;
}
.barre-remplissage {
  height: 100%; background: linear-gradient(90deg, #4caf50, #66bb6a);
  border-radius: 6px; transition: width 0.4s ease;
}
.barre-remplissage.partiel { background: linear-gradient(90deg, #ffc107, #ffd54f); }
.barre-remplissage.erreur { background: linear-gradient(90deg, #ef5350, #ff8a80); }
.grille-cases { display: flex; flex-wrap: wrap; gap: 6px; }
.grille-cases label {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid #d7dee7; border-radius: 8px; padding: 5px 9px;
  background: #fff; font-size: 0.82rem; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.grille-cases label:hover { border-color: #90a4ae; }
.grille-cases label:has(input:checked) {
  border-color: #4caf50; background: rgba(76, 175, 80, 0.08);
  font-weight: 600;
}
.campagne-ligne {
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
  background: #fff;
}
.campagne-entete { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.campagne-nom { font-weight: 700; font-size: 0.95rem; }
.campagne-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-statut {
  font-size: 11px; font-weight: 700; border-radius: 10px; padding: 2px 9px;
}
.badge-brouillon { background: #eceff1; color: #546e7a; }
.badge-active { background: #ffc107; color: #1a1a1a; }
.badge-terminee { background: #c8e6c9; color: #1b5e20; }
.badge-erreur { background: #ffcdd2; color: #b71c1c; }
.campagne-meta { font-size: 0.8rem; color: var(--texte-secondaire); margin-top: 6px; }
.campagne-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-mini {
  font-size: 0.78rem; padding: 4px 10px; border-radius: 7px; border: 1px solid #cbd5e1;
  background: #fff; cursor: pointer; color: #37474f;
}
.btn-mini:hover { background: #f1f5f9; }
.btn-mini.principal { background: #4caf50; border-color: #4caf50; color: #fff; }
.btn-mini.principal:hover { background: #43a047; }
.btn-mini.danger { color: #c62828; border-color: #ef9a9a; }
.btn-mini.danger:hover { background: #ffebee; }

/* ==================== Campagnes : formulaire enrichi ==================== */
.sous-section-campagne {
  background: #f7f9fc;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 14px 16px;
  margin: 14px 0;
}
.titre-section-campagne {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--texte);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ligne-champs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.ligne-champs .champ { flex: 1; min-width: 150px; }
.ligne-champs .champ:first-child { flex: 1.2; }
.texte-aide {
  font-size: 12px;
  color: var(--texte-secondaire);
  line-height: 1.45;
  display: block;
  padding-top: 4px;
}
.badge-total {
  display: inline-flex;
  align-items: center;
  background: #e7f0fe;
  color: var(--bleu-fb-fonce);
  font-weight: 700;
  font-size: 13px;
  border: 1px solid #c6dafc;
  border-radius: 999px;
  padding: 6px 14px;
  margin-top: 2px;
  min-height: 36px;
}
.radio-cartes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.carte-radio {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--carte);
  border: 2px solid var(--bordure);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.carte-radio:hover { border-color: #b7cdf5; }
.carte-radio input { display: none; }
.carte-radio:has(input:checked) {
  border-color: var(--bleu-fb);
  background: #eef5ff;
  box-shadow: 0 0 0 1px var(--bleu-fb) inset;
}
.carte-radio-titre { font-weight: 700; font-size: 13.5px; color: var(--texte); }
.carte-radio-sous { font-size: 12px; color: var(--texte-secondaire); }
@media (hover: none) { .carte-radio:has(input:checked) { border-color: var(--bleu-fb); } }

/* Badges de la liste des campagnes */
.badge-camp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0f2f5;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--texte);
  white-space: nowrap;
}
.badge-camp.badge-camp-vert { background: #e7f6ec; color: #1a7f37; }
.badge-camp.badge-camp-bleu { background: #e7f0fe; color: var(--bleu-fb-fonce); }
