/* Interface d'administration — une seule feuille de style, sans dépendance externe. */
:root {
  --encre: #16212b; --encre-2: #4b5a68; --encre-3: #7b8894;
  --fond: #f3f5f7; --surface: #ffffff; --trait: #dfe4e9; --trait-fort: #c5cdd5;
  --accent: #0d6470; --accent-fonce: #094b55; --accent-pale: #e3f1f3;
  --ok: #1f7a46; --ok-pale: #e4f4ea; --alerte: #9a5b00; --alerte-pale: #fdf1dc;
  --danger: #b3261e; --danger-pale: #fbe9e7; --info-pale: #e8eef7; --info: #2b4f86;
  --rayon: 10px; --ombre: 0 1px 2px rgba(22, 33, 43, .06), 0 2px 8px rgba(22, 33, 43, .04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .4rem; }
p { margin: 0 0 .7rem; }
small, .petit { font-size: .84rem; color: var(--encre-2); }
code { background: var(--fond); border: 1px solid var(--trait); border-radius: 4px; padding: 0 .3em; font-size: .88em; overflow-wrap: anywhere; }
.muet { color: var(--encre-3); }
.chiffre { font-variant-numeric: tabular-nums; }

/* --- Structure : menu latéral (ordinateur) / tiroir (mobile) --------------------- */
.barre { display: none; }
.menu { position: fixed; inset: 0 auto 0 0; width: 232px; background: #10202b; color: #c9d5de; padding: 18px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.menu .marque { color: #fff; font-weight: 700; font-size: 1.02rem; padding: 2px 10px 14px; letter-spacing: -.01em; }
.menu a { color: inherit; text-decoration: none; padding: 8px 10px; border-radius: 7px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.menu a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu a.actif { background: var(--accent); color: #fff; }
.menu .titre-groupe { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7f93a1; padding: 14px 10px 4px; }
.menu .pied { margin-top: auto; padding: 14px 10px 0; font-size: .82rem; border-top: 1px solid rgba(255, 255, 255, .1); }
.menu .pied button { background: none; border: 0; color: #9fb2bf; padding: 0; cursor: pointer; text-decoration: underline; font: inherit; }
.pastille { background: #fff; color: #10202b; border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center; }
.pastille.rouge { background: #ffb4a9; color: #5c0f0a; }
main { margin-left: 232px; padding: 26px 30px 60px; max-width: 1280px; }
.entete { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.entete p { margin: 0; color: var(--encre-2); }
.centre { margin: 0 auto; max-width: 420px; padding: 9vh 16px; }

/* --- Composants --------------------------------------------------------------------- */
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 18px; box-shadow: var(--ombre); margin-bottom: 16px; }
.carte.serree { padding: 12px 14px; }
.grille { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.grille.etroite { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grille > .carte { margin-bottom: 0; }
.grille { margin-bottom: 16px; }
.stat { display: block; font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat + span { color: var(--encre-2); font-size: .86rem; }
a.carte { text-decoration: none; color: inherit; display: block; }
a.carte:hover { border-color: var(--trait-fort); }
.ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ligne.entre { justify-content: space-between; }
.pile > * + * { margin-top: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .9rem; padding: 8px 14px; min-height: 38px; border-radius: 8px; border: 1px solid var(--trait-fort); background: var(--surface); color: var(--encre); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--fond); }
.btn.primaire { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primaire:hover { background: var(--accent-fonce); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-doux { color: var(--danger); border-color: #e3b4b0; }
.btn.petit { min-height: 30px; padding: 4px 10px; font-size: .82rem; color: var(--encre); }
.btn.petit.primaire { color: #fff; }
.champs.compacts { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #7fc3cc; outline-offset: 1px; }

label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 4px; }
label.case { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: .92rem; margin: 0; }
label.case input { margin-top: 4px; flex: none; width: 16px; height: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=time], input[type=datetime-local], input[type=file], select, textarea { width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid var(--trait-fort); border-radius: 8px; padding: 8px 10px; min-height: 38px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; min-height: 220px; }
.champs { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 14px; }
.champs .large { grid-column: 1 / -1; }
.aide { font-size: .82rem; color: var(--encre-2); margin-top: 4px; font-weight: 400; }
form.enligne { display: inline; }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details[open] > summary { margin-bottom: 12px; }

.badge { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--fond); color: var(--encre-2); border: 1px solid var(--trait); white-space: nowrap; }
.badge.en_attente { background: var(--alerte-pale); color: var(--alerte); border-color: #f1d9a8; }
.badge.valide, .badge.programme { background: var(--info-pale); color: var(--info); border-color: #c9d7ec; }
.badge.publie, .badge.ok, .badge.actif, .badge.envoye { background: var(--ok-pale); color: var(--ok); border-color: #bfe3cc; }
.badge.echec, .badge.erreur, .badge.a_verifier, .badge.invalide, .badge.opposition { background: var(--danger-pale); color: var(--danger); border-color: #f1c6c2; }
.badge.preparation, .badge.alerte, .badge.desabonne, .badge.en_cours { background: var(--alerte-pale); color: var(--alerte); border-color: #f1d9a8; }
.badge.simulation { background: #efe9fb; color: #55389a; border-color: #dccff5; }

.note { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid; font-size: .93rem; }
.note.ok { background: var(--ok-pale); border-color: #bfe3cc; color: #14532d; }
.note.alerte { background: var(--alerte-pale); border-color: #f1d9a8; color: #6b3f00; }
.note.erreur { background: var(--danger-pale); border-color: #f1c6c2; color: #7c1a14; }
.note.info { background: var(--info-pale); border-color: #c9d7ec; color: #1d3a66; }
.note ul { margin: 4px 0 0; padding-left: 18px; }
.bandeau-arret { background: var(--danger); color: #fff; border-radius: var(--rayon); padding: 14px 18px; margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.bandeau-arret .btn { border-color: #fff; }

.defile { overflow-x: auto; margin: 0 -18px -18px; }
.carte > .defile:first-child { margin-top: -18px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--encre-2); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--trait); white-space: nowrap; background: #fafbfc; }
td { padding: 10px 14px; border-bottom: 1px solid var(--trait); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.vide { text-align: center; color: var(--encre-3); padding: 26px 12px; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 14px; font-size: .86rem; color: var(--encre-2); }

/* --- Validation et bibliothèque ------------------------------------------------------ */
.element { display: grid; grid-template-columns: 168px 1fr; gap: 16px; }
.element .apercu { width: 168px; height: 168px; object-fit: cover; border-radius: 8px; background: var(--fond); border: 1px solid var(--trait); display: block; }
.texte-pub { white-space: pre-wrap; overflow-wrap: anywhere; background: #fafbfc; border: 1px solid var(--trait); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86rem; color: var(--encre-2); margin: 4px 0 8px; }
.meta b { color: var(--encre); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--trait); }
.actions input[type=datetime-local], .actions input[type=text] { width: auto; max-width: 210px; }
.mosaique { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tuile { background: var(--surface); border: 1px solid var(--trait); border-radius: 9px; overflow: hidden; position: relative; font-size: .82rem; }
.tuile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--fond); }
.tuile .corps { padding: 7px 9px 9px; }
.tuile .corps a { font-weight: 600; text-decoration: none; color: var(--encre); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuile input[type=checkbox] { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; }
.tuile .coin { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
iframe.apercu-email { width: 100%; height: 620px; border: 1px solid var(--trait); border-radius: 8px; background: #fff; }

/* --- Calendrier ----------------------------------------------------------------------- */
.semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.jour { background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; min-height: 96px; padding: 6px; font-size: .78rem; }
.jour .date { font-weight: 700; color: var(--encre-2); display: block; margin-bottom: 4px; }
.jour.aujourd_hui { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.jour.exclu { background: repeating-linear-gradient(135deg, #f3f5f7, #f3f5f7 6px, #e9edf0 6px, #e9edf0 12px); }
.evenement { display: block; text-decoration: none; color: var(--encre); border-left: 3px solid var(--encre-3); background: var(--fond); border-radius: 4px; padding: 2px 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evenement.en_attente, .evenement.preparation { border-color: #d98a00; background: var(--alerte-pale); }
.evenement.valide, .evenement.programme { border-color: var(--info); background: var(--info-pale); }
.evenement.publie { border-color: var(--ok); background: var(--ok-pale); }
.evenement.echec, .evenement.a_verifier { border-color: var(--danger); background: var(--danger-pale); }
.legende { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: .8rem; margin-bottom: 12px; }

/* --- Connexions, assistants et démarrage ------------------------------------------- */
.section-titre { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--encre-2); margin: 26px 0 10px; }
.section-titre:first-of-type { margin-top: 4px; }
.cartes-connexion { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); align-items: stretch; margin-bottom: 16px; }
.cartes-connexion > .carte { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.connexion-tete { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.connexion-tete h3 { margin: 0; font-size: 1.02rem; }
.connexion-texte { color: var(--encre-2); font-size: .9rem; margin: 0; }
.etat { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--fond); color: var(--encre-2); white-space: nowrap; }
.etat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.etat.test { background: #efe9fb; color: #55389a; }
.etat.reel { background: var(--ok-pale); color: var(--ok); }
.etat.probleme { background: var(--danger-pale); color: var(--danger); }
.compte-relie { border: 1px solid var(--trait); border-radius: 9px; padding: 10px 12px; }
.compte-relie .nom { font-weight: 600; overflow-wrap: anywhere; }
.compte-relie .ligne { margin-top: 6px; }
.compte-relie details { margin-top: 6px; font-size: .9rem; }
.btn.large { width: 100%; }
.cartes-connexion .btn.large { margin-top: auto; }
.copie { display: block; background: var(--fond); border: 1px solid var(--trait); border-radius: 8px; padding: 8px 10px; font: .82rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }

.assistant { max-width: 820px; }
.fil { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 0 0 18px; counter-reset: f; font-size: .88rem; color: var(--encre-3); }
.fil li { counter-increment: f; display: flex; align-items: center; gap: 8px; }
.fil li::before { content: counter(f); width: 24px; height: 24px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.fil li.fait { color: var(--ok); }
.fil li.fait::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
.fil li.ici { color: var(--accent); font-weight: 700; }
.fil li.ici::before { background: var(--accent); border-color: var(--accent); color: #fff; }
.guide { counter-reset: g; list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 10px; }
.guide > li { counter-increment: g; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.guide > li::before { content: counter(g); width: 30px; height: 30px; border-radius: 50%; background: var(--accent-pale); color: var(--accent-fonce); font-weight: 700; display: grid; place-items: center; }
.guide b { display: block; }
.guide p { margin: 2px 0 0; color: var(--encre-2); font-size: .9rem; }
.options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 14px; }
.options.liste { grid-template-columns: 1fr; }
.option { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: .93rem; border: 1.5px solid var(--trait-fort); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: #fff; margin: 0; }
.option:hover { border-color: var(--accent); }
.option:has(input:checked), .option[aria-current] { border-color: var(--accent); background: var(--accent-pale); box-shadow: inset 0 0 0 1px var(--accent); }
.option > input { margin-top: 3px; flex: none; width: 17px; height: 17px; accent-color: var(--accent); }
.option b { display: block; font-weight: 700; }
.option .petit { display: block; }
.option.desactive { opacity: .55; cursor: not-allowed; }
.etape { border-top: 1px solid var(--trait); padding-top: 18px; margin-top: 18px; }
.etape:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.etape > h2 { display: flex; align-items: center; gap: 10px; }
.etape > h2 span { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .9rem; flex: none; }
.vignettes { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); max-height: 330px; overflow-y: auto; padding: 2px; }
.vignettes .option { padding: 0; flex-direction: column; gap: 0; overflow: hidden; position: relative; }
.vignettes .option input { position: absolute; top: 6px; left: 6px; margin: 0; }
.vignettes img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.vignettes .sans { aspect-ratio: 1; display: grid; place-items: center; color: var(--encre-2); font-size: .82rem; text-align: center; padding: 6px; }
.insertions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: .84rem; color: var(--encre-2); }
.resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 16px; margin: 0 0 14px; }
.resume div { background: var(--fond); border-radius: 8px; padding: 10px 12px; }
.resume dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--encre-2); }
.resume dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
/* Canal choisi dans l'assistant de campagne : n'afficher que le bloc correspondant (sans script). */
form.assistant-campagne:has(#canal-email:checked) .si-whatsapp,
form.assistant-campagne:has(#canal-whatsapp:checked) .si-email { display: none; }
.modele-wa:not(:has(> .option input:checked)) .variables { display: none; }

.demarrage { border-color: var(--accent); }
.demarrage-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.progression { height: 8px; border-radius: 99px; background: var(--fond); overflow: hidden; margin: 10px 0 14px; }
.progression span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.taches { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.taches li a, .taches li > span { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--trait); border-radius: 9px; text-decoration: none; color: var(--encre); }
.taches li a:hover { border-color: var(--accent); }
.taches li i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--trait-fort); flex: none; display: grid; place-items: center; font-size: .75rem; }
.taches li.fait > span { color: var(--encre-2); text-decoration: line-through; text-decoration-color: var(--trait-fort); }
.taches li.fait i { background: var(--ok); border-color: var(--ok); color: #fff; }
.onglets-page { display: flex; gap: 4px; border-bottom: 1px solid var(--trait); margin: -4px 0 18px; overflow-x: auto; }
.onglets-page a { padding: 9px 14px; text-decoration: none; color: var(--encre-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.onglets-page a.actif { color: var(--accent); border-color: var(--accent); }
@media (max-width: 900px) { .options { grid-template-columns: 1fr; } }

/* --- Mobile --------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .barre { display: flex; position: sticky; top: 0; z-index: 20; background: #10202b; color: #fff; padding: 10px 14px; align-items: center; gap: 12px; font-weight: 700; }
  .barre label { margin: 0; font-size: 1.3rem; cursor: pointer; padding: 2px 8px; border-radius: 6px; line-height: 1; }
  .barre .droite { margin-left: auto; display: flex; gap: 6px; }
  .menu { transform: translateX(-100%); transition: transform .18s ease; z-index: 30; width: 260px; top: 46px; }
  #bascule-menu:checked ~ .menu { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  main { margin-left: 0; padding: 18px 14px 60px; overflow-x: hidden; }
  .carte, .champs > * { min-width: 0; }
  .ligne > input[type=text] { flex: 1 1 140px; width: auto !important; }
  .element { grid-template-columns: 96px 1fr; gap: 12px; }
  .element .apercu { width: 96px; height: 96px; }
  .semaine { grid-template-columns: 1fr; }
  .jour { min-height: 0; }
  .jour.vide-mobile { display: none; }
  iframe.apercu-email { height: 480px; }
  .actions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { .menu { transition: none; } }
