:root {
  --fond: #f6f3ef;
  --carte: #ffffff;
  --encre: #1c1715;
  --doux: #6f6560;
  --trait: #e6dfd8;
  --rouge: #d62718;
  --rouge-fonce: #b51f12;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--encre); font: 15px/1.5 Inter, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }

.barre { display: flex; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--trait); background: var(--carte); }
.marque { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.marque small { font-weight: 500; color: var(--doux); }
.pastille { width: 14px; height: 14px; border-radius: 50%; background: var(--rouge); }

.app { display: grid; grid-template-columns: 340px 1fr; min-height: calc(100vh - 53px); }
.panneau { background: var(--carte); border-right: 1px solid var(--trait); padding: 22px; display: flex; flex-direction: column; gap: 28px; }
.lbl { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
.lbl i { font-weight: 400; color: var(--doux); }
.lbl:first-child { margin-top: 0; }
textarea, input, select { width: 100%; border: 1px solid var(--trait); border-radius: 10px; padding: 10px 12px; background: #fff; }
textarea { resize: vertical; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--rouge); outline-offset: -1px; border-color: transparent; }
.deux { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }

.segment { display: flex; background: var(--fond); border-radius: 10px; padding: 3px; gap: 3px; }
.segment button { flex: 1; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--doux); }
.segment button.on { background: #fff; color: var(--encre); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.segment.petit button { padding: 6px 14px; }

.btn { border: 1px solid var(--trait); background: #fff; border-radius: 10px; padding: 9px 14px; font-weight: 600; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--encre); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.principal { width: 100%; margin-top: 20px; background: var(--rouge); color: #fff; border: 0; padding: 13px; font-size: 16px; }
.btn.principal:hover:not(:disabled) { background: var(--rouge-fonce); }
.etat { min-height: 22px; margin: 10px 0 0; font-size: 13px; color: var(--doux); }
.etat.erreur { color: var(--rouge); }

.historique h2 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--doux); }
.historique ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.historique li { display: flex; align-items: center; gap: 6px; }
.historique li button.ouvrir { flex: 1; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.historique li button.ouvrir:hover, .historique li.on button.ouvrir { background: var(--fond); }
.historique li small { display: block; color: var(--doux); font-size: 12px; }
.historique li .suppr { border: 0; background: none; color: var(--doux); cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.historique li .suppr:hover { color: var(--rouge); }

.scene { padding: 22px 28px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.outils { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.piste { display: flex; gap: 16px; overflow-x: auto; padding: 4px 2px 16px; scroll-snap-type: x mandatory; min-height: 460px; }
.vide { margin: auto; max-width: 440px; text-align: center; color: var(--doux); }
.vide b { color: var(--encre); }
.discret { font-size: 13px; }

/* Aperçu : la slide garde sa vraie taille (1080×1350) et le cadre la réduit. */
.cadre { --k: .32; flex: none; width: calc(1080px * var(--k)); height: calc(1350px * var(--k)); border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.1); scroll-snap-align: start; position: relative; }
.cadre .echelle { transform: scale(var(--k)); transform-origin: 0 0; width: 1080px; height: 1350px; }
.chargement .cadre { animation: pulse 1.2s ease-in-out infinite; background: #ebe4dd; }
@keyframes pulse { 50% { opacity: .5; } }

.legendes { background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; padding: 14px; }
.onglets { display: flex; gap: 6px; margin-bottom: 10px; align-items: center; }
.onglets button:not(.btn) { border: 0; background: none; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--doux); }
.onglets button.on { background: var(--fond); color: var(--encre); }
.onglets .copier { margin-left: auto; padding: 6px 12px; }


@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .panneau { border-right: 0; border-bottom: 1px solid var(--trait); }
  .scene { padding: 16px; }
  .cadre { --k: .26; }
}

.phototheque h2, .historique h2 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--doux); }
.phototheque h2 i { text-transform: none; letter-spacing: 0; font-weight: 400; }
.grille-photos { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 10px; }
.grille-photos:empty { display: none; }
.grille-photos .ph { position: relative; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0/14px 14px; }
.grille-photos img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.grille-photos .ph button { position: absolute; top: 2px; right: 2px; border: 0; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; cursor: pointer; display: none; }
.grille-photos .ph:hover button { display: block; }
.btn.ajout { display: block; text-align: center; font-size: 14px; }
.coche { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-top: 8px; color: var(--doux); }
.coche input { width: auto; }

.vignette { flex: none; display: flex; flex-direction: column; gap: 6px; scroll-snap-align: start; }
.vignette .mini { display: flex; gap: 4px; flex-wrap: wrap; }
.vignette .mini button { border: 1px solid var(--trait); background: #fff; border-radius: 7px; padding: 3px 8px; font-size: 12px; cursor: pointer; color: var(--doux); }
.vignette .mini button:hover { color: var(--encre); border-color: var(--encre); }
.cadre.survol { outline: 3px dashed var(--rouge); outline-offset: 3px; }

.retouche { background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.retouche-ligne { display: flex; gap: 8px; align-items: flex-end; }
.retouche textarea { flex: 1; resize: vertical; min-height: 52px; }
.retouche-actions { display: flex; gap: 6px; }
.btn.joindre { padding: 9px 12px; cursor: pointer; }
.btn.principal-mini { background: var(--rouge); color: #fff; border: 0; }
.btn.principal-mini:hover:not(:disabled) { background: var(--rouge-fonce); }
.jointes { display: flex; gap: 6px; flex-wrap: wrap; }
.jointes:empty { display: none; }
.jointes .pj { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid var(--trait); }
.jointes .pj img { width: 100%; height: 100%; object-fit: cover; }
.jointes .pj button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; cursor: pointer; }
.retouche-pied { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.retouche-pied .etat { margin: 0; }
.lien { border: 0; background: none; color: var(--doux); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 0; white-space: nowrap; }
.lien:hover { color: var(--encre); }

.memoire h2 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--doux); }
.memoire h2 i { text-transform: none; letter-spacing: 0; font-weight: 400; }
.memoire ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.memoire li { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; background: var(--fond); border-radius: 8px; padding: 7px 8px 7px 10px; }
.memoire li span { flex: 1; }
.memoire li button { border: 0; background: none; color: var(--doux); cursor: pointer; padding: 0 4px; }
.memoire li button:hover { color: var(--rouge); }
.memoire li.vide { background: none; padding: 0; color: var(--doux); }
.memoire li.nouveau { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: #ffd9cf; } 100% { background: var(--fond); } }
.vignette .mini button.suppr-slide:hover { color: var(--rouge); border-color: var(--rouge); }
.retouche { position: relative; }
.retouche .depot { display: none; position: absolute; inset: 0; border: 2px dashed var(--rouge); border-radius: 14px; background: rgba(255, 245, 240, .94); color: var(--rouge); font-weight: 600; place-items: center; text-align: center; pointer-events: none; }
.retouche.survol .depot { display: grid; }

.prog { border: 0; border-radius: 16px; padding: 22px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.prog::backdrop { background: rgba(20, 10, 10, .45); }
.prog h2 { margin: 0 0 4px; font-size: 18px; }
.prog .deux-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.prog .deux-col label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.prog .cases { display: flex; flex-direction: column; gap: 2px; }
.prog .coche i { font-style: normal; color: var(--doux); }
.prog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.barre { justify-content: space-between; }
.sync { font-size: 12px; color: var(--doux); }

/* Espaces clients */
.choix-espace { width: auto; margin-left: 6px; padding: 6px 30px 6px 10px; font-weight: 600; border-radius: 9px; }
.btn.reglages { padding: 6px 10px; font-size: 13px; }
.exemples-zone h2 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--doux); }
.exemples-zone h2 i { text-transform: none; letter-spacing: 0; font-weight: 400; }
.exemples-zone textarea { margin-top: 8px; font-size: 13px; }
.exemples-zone .btn.ajout + .btn.ajout { margin-top: 8px; width: 100%; }
.grille-exemples { grid-template-columns: repeat(4, 1fr); }
.grille-exemples .ph { aspect-ratio: 4/5; background: var(--fond); }
.grille-exemples img { object-fit: cover; object-position: center; }
.reg label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; margin-top: 10px; }
.reg label i { font-weight: 400; color: var(--doux); font-style: normal; }
.reg .deux-col, .reg .trois-col { margin: 0; }
.reg .trois-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.reg input[type=color] { height: 40px; padding: 3px; }
.reg-logo { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.reg-logo label { margin: 0; cursor: pointer; }
.reg-logo-img img { height: 40px; max-width: 160px; object-fit: contain; display: block; background: var(--fond); border-radius: 6px; padding: 4px; }
.reg { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); }
.suppr-espace { margin-right: auto; }
.suppr-espace:hover { color: var(--rouge); }
@media (max-width: 860px) { .marque small { display: none; } .reg .deux-col { grid-template-columns: 1fr; } }

/* Preuves sociales */
.preuves-zone h2 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--doux); }
.preuves-zone h2 i { text-transform: none; letter-spacing: 0; font-weight: 400; }
.grille-photos .pr { cursor: pointer; }
.grille-photos .pr img { cursor: grab; }
.pr-alerte { position: absolute; left: 3px; bottom: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--rouge); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.choix-preuve { width: min(640px, calc(100vw - 32px)); }
.grille-choix { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 60vh; overflow: auto; margin-top: 12px; }
.choix-pr { border: 1px solid var(--trait); background: #fff; border-radius: 10px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.choix-pr:hover { border-color: var(--encre); }
.choix-pr img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 6px; background: var(--fond); }
.choix-pr small { font-size: 11px; color: var(--doux); line-height: 1.3; }

/* Bloc Publication (PlugKit / Metricool) + DM sur mot-clé */
.publication { background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 16px; }
.pub-tete { display: flex; align-items: center; gap: 10px; }
.publication h2 { margin: 0; font-size: 16px; }
.publication h3 { margin: 0; font-size: 14px; }
.pastille-statut { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--fond); color: var(--doux); }
.pastille-statut:empty { display: none; }
.pastille-statut.ok { background: #e3f4e8; color: #19723b; }
.pastille-statut.attente { background: #e8efff; color: #1f4fd8; }
.pastille-statut.ko { background: #ffe3df; color: var(--rouge); }
.pub-info { margin: 0; font-size: 14px; }
.pub-info:empty { display: none; }
.pub-info a { color: inherit; font-weight: 600; }
.pub-grille { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.pub-grille.deux, .pub-dm .pub-grille { grid-template-columns: 1fr 1fr; }
.publication label:not(.coche) { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.publication label i { font-weight: 400; font-style: normal; color: var(--doux); }
.publication .cases { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.publication .coche i { font-style: normal; }
.pub-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pub-dm { border-top: 1px solid var(--trait); padding-top: 14px; margin-top: 4px; display: flex; flex-direction: column; gap: 10px; }
.publication .etat { margin: 0; }
@media (max-width: 860px) { .pub-grille, .pub-grille.deux, .pub-dm .pub-grille { grid-template-columns: 1fr; } }
[hidden] { display: none !important; }
