/* Outil d'agence : barre de vues en haut ; vue agence = clients à gauche, mois au centre, fiche à droite ; vue client = file « à valider » puis calendrier ; vue RenovTout = écran Terrain dans un cadre de téléphone. */
:root {
  --fond: #eef1f4; --surface: #ffffff; --surface2: #f6f8fa; --ligne: #d9dee5; --encre: #141a22; --doux: #5b6573; --accent: #2747d8; --accent-texte: #ffffff;
  --st-brouillon: #8a94a3; --st-avalider: #c98a00; --st-modif: #d4462f; --st-valide: #1d9a5b; --st-programme: #2f6fe0; --st-publie: #4b5563;
  --fond-ombre: rgba(20,26,34,.45);
  --titre: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif; --corps: "Instrument Sans", "Segoe UI", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --fond: #0f1318; --surface: #171c23; --surface2: #1d232c; --ligne: #2b333e; --encre: #e8ecf2; --doux: #9aa5b4; --accent: #6f8bff; --accent-texte: #0f1318;
  --st-brouillon: #7d8796; --st-avalider: #e3a923; --st-modif: #f06a52; --st-valide: #3fc282; --st-programme: #5b93ff; --st-publie: #8b95a3; --fond-ombre: rgba(0,0,0,.6); color-scheme: dark; } }
:root[data-theme="dark"] {
  --fond: #0f1318; --surface: #171c23; --surface2: #1d232c; --ligne: #2b333e; --encre: #e8ecf2; --doux: #9aa5b4; --accent: #6f8bff; --accent-texte: #0f1318;
  --st-brouillon: #7d8796; --st-avalider: #e3a923; --st-modif: #f06a52; --st-valide: #3fc282; --st-programme: #5b93ff; --st-publie: #8b95a3; --fond-ombre: rgba(0,0,0,.6); color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 15px/1.5 var(--corps);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 16px 48px; }
h1, h2, h3 { font-family: var(--titre); margin: 0; text-wrap: balance; letter-spacing: -.01em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1400px; margin: 0 auto; display: grid; gap: 16px; }
.barre { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.marque { display: flex; align-items: baseline; gap: 10px; }
.marque b { font-family: var(--titre); font-size: 22px; }
.marque span { font-family: var(--mono); font-size: 12px; color: var(--doux); }
.vues { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface); border: 1px solid var(--ligne); border-radius: 12px; padding: 4px; }
.vues a { text-decoration: none; color: var(--doux); font-weight: 600; font-size: 14px; padding: 7px 12px; border-radius: 9px; }
.vues a[aria-current="page"] { background: var(--encre); color: var(--fond); }
.bandeau { font-size: 13px; color: var(--doux); border: 1px dashed var(--ligne); border-radius: 10px; padding: 8px 12px; }
.btn { border: 1px solid var(--ligne); background: var(--surface); border-radius: 10px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.btn.prim { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.btn.ok { background: var(--st-valide); border-color: var(--st-valide); color: #fff; }
.btn.ko { border-color: var(--st-modif); color: var(--st-modif); background: transparent; }
.btn:hover { filter: brightness(1.05); }
.pil { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; border: 1.5px solid currentColor; white-space: nowrap; }
.pil::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.res { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 4px; border-radius: 5px; font: 700 10px var(--mono); color: #fff; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --- Vue agence --- */
.agence { display: grid; grid-template-columns: 230px minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.clients { background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; padding: 10px; display: grid; gap: 4px; }
.clients h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--doux); padding: 4px 8px; font-family: var(--corps); }
.cli { all: unset; cursor: pointer; display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; }
.cli:hover { background: var(--surface2); }
.cli[aria-pressed="true"] { background: var(--surface2); box-shadow: inset 0 0 0 1px var(--ligne); }
.cli i { width: 10px; height: 10px; border-radius: 3px; }
.cli b { font-weight: 600; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.cli small { font-size: 11.5px; color: var(--doux); display: block; font-weight: 500; }
.compteurs { display: flex; gap: 4px; }
.compteurs span { font: 700 11px var(--mono); padding: 1px 6px; border-radius: 6px; color: #fff; }
.centre { display: grid; gap: 12px; min-width: 0; }
.tete-cli { background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; padding: 14px 16px; display: grid; gap: 10px; }
.tete-cli .l1 { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.tete-cli h2 { font-size: 26px; }
.lien { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--doux); }
.lien code { font-family: var(--mono); background: var(--surface2); border: 1px solid var(--ligne); padding: 3px 8px; border-radius: 7px; color: var(--encre); overflow-wrap: anywhere; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filtres { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { all: unset; cursor: pointer; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--ligne); background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--encre); color: var(--fond); border-color: var(--encre); }
.mois { background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; padding: 10px; display: grid; gap: 6px; min-width: 0; }
.mois .nav { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; }
.mois .nav h3 { font-size: 18px; text-transform: capitalize; }
.grille { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.grille .jn { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--doux); padding: 0 4px; }
.jour { min-height: 104px; border-radius: 9px; background: var(--surface2); padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.jour.autre { opacity: .35; }
.jour.auj { box-shadow: inset 0 0 0 2px var(--accent); }
.jour .num { font: 600 12px var(--mono); color: var(--doux); }
.post { all: unset; cursor: pointer; display: grid; gap: 1px; padding: 4px 5px 4px 7px; border-radius: 6px; background: var(--surface); border-left: 3px solid; font-size: 11.5px; line-height: 1.25; min-width: 0; }
.post:hover { box-shadow: 0 0 0 1px var(--ligne); }
.post.sel { box-shadow: 0 0 0 2px var(--accent); }
.post .h { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; font: 500 10.5px var(--mono); color: var(--doux); }
.post .h .res { min-width: 16px; height: 13px; font-size: 8.5px; padding: 0 2px; }
.post b { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fiche { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; padding: 14px; display: grid; gap: 12px; min-width: 0; }
.visu { border-radius: 10px; overflow: hidden; background: var(--surface2); display: grid; place-items: center; }
.visu video { display: block; width: 100%; max-width: 230px; aspect-ratio: 9 / 16; object-fit: cover; background: #000; }
.carte .visu video { max-width: 100%; }
.visu img { display: block; width: 100%; max-width: 230px; aspect-ratio: 9 / 16; object-fit: cover; }
.visu.carre img { aspect-ratio: 4 / 5; max-width: 260px; }
.faux { width: 100%; max-width: 230px; aspect-ratio: 9 / 16; display: grid; align-content: end; padding: 16px; color: #fff; font: 700 20px/1.15 var(--titre); }
.faux small { font: 600 11px var(--mono); opacity: .8; margin-bottom: 6px; display: block; }
.etapes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.etapes div { height: 5px; border-radius: 3px; background: var(--ligne); }
.etapes-l { display: grid; grid-template-columns: repeat(5, 1fr); font-size: 10.5px; color: var(--doux); }
.leg { white-space: pre-wrap; background: var(--surface2); border-radius: 9px; padding: 9px 11px; font-size: 13.5px; }
.fil { display: grid; gap: 8px; }
.msg { font-size: 13.5px; padding: 8px 10px; border-radius: 9px; background: var(--surface2); }
.msg.cli-m { border-left: 3px solid var(--st-modif); }
.msg b { font-size: 12px; }
.msg time { font: 500 11px var(--mono); color: var(--doux); margin-left: 6px; }
.boost { display: grid; gap: 8px; padding: 10px; border-radius: 10px; border: 1px solid var(--ligne); background: var(--surface2); }
.boost .trois { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.boost .trois label { display: grid; gap: 3px; font-size: 12px; color: var(--doux); font-weight: 600; min-width: 0; }
.boost .tot { font-weight: 700; font-variant-numeric: tabular-nums; }
.eur { display: inline-grid; place-items: center; min-width: 16px; height: 13px; padding: 0 3px; border-radius: 4px; font: 700 9px var(--mono); background: var(--st-avalider); color: #fff; }
.ligne-boost { font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 8px; border: 1px dashed var(--st-avalider); }
select, input[type=number] { width: 100%; font: inherit; color: var(--encre); background: var(--surface); border: 1px solid var(--ligne); border-radius: 9px; padding: 7px 8px; }
textarea, input[type=text], input[type=date], input[type=time] { width: 100%; font: inherit; color: var(--encre); background: var(--surface2); border: 1px solid var(--ligne); border-radius: 9px; padding: 8px 10px; }
textarea { min-height: 70px; resize: vertical; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--doux); }

/* --- Vue client --- */
.client { max-width: 980px; margin: 0 auto; width: 100%; display: grid; gap: 18px; }
.client .hero { background: var(--surface); border: 1px solid var(--ligne); border-radius: 16px; padding: 18px 20px; display: grid; gap: 6px; border-top: 5px solid var(--cc); }
.client .hero h2 { font-size: clamp(24px, 3.4vw, 34px); }
.client .hero p { margin: 0; color: var(--doux); }
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.carte { background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; padding: 12px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.carte .visu img, .carte .faux { max-width: 100%; aspect-ratio: 4 / 5; }
.carte .quand { font-family: var(--titre); font-weight: 700; font-size: 17px; }
.liste { background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; overflow: hidden; }
.ligne { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--ligne); }
.ligne:first-child { border-top: 0; }
.ligne .t { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.vide { padding: 22px; text-align: center; color: var(--doux); background: var(--surface); border: 1px dashed var(--ligne); border-radius: 14px; }

/* --- Fenêtre et toast --- */
.voile { position: fixed; inset: 0; background: var(--fond-ombre); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); z-index: 20; }
.boite { background: var(--surface); border-radius: 16px; padding: 18px; width: min(520px, 100%); display: grid; gap: 10px; max-height: 100%; overflow-y: auto; }
.boite .deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.boite .chip input { margin: 0 4px 0 0; vertical-align: -1px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--encre); color: var(--fond); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); }

@media (max-width: 1180px) { .agence { grid-template-columns: 210px minmax(0, 1fr); } .fiche { grid-column: 1 / -1; position: static; } }
@media (max-width: 760px) {
  .agence { grid-template-columns: 1fr; }
  .clients { grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); overflow-x: auto; } .clients h3, #nvcli { display: none; }
  .grille .jn { display: none; } .grille { grid-template-columns: 1fr; } .jour { min-height: 0; } .jour.vide-j, .jour.autre { display: none; }
  .ligne { grid-template-columns: 1fr; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* --- Ajouts de l'outil réel --- */
[hidden] { display: none !important; }
a { color: var(--accent); }
.btn[disabled] { opacity: .5; cursor: default; filter: none; }
.btn.petit { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--st-modif); border-color: var(--st-modif); background: transparent; }
.connexion { max-width: 380px; margin: 12vh auto 0; background: var(--surface); border: 1px solid var(--ligne); border-radius: 16px; padding: 22px; display: grid; gap: 12px; }
.connexion h1 { font-size: 26px; }
input[type=email], input[type=password], input[type=color] { width: 100%; font: inherit; color: var(--encre); background: var(--surface2); border: 1px solid var(--ligne); border-radius: 9px; padding: 8px 10px; }
input[type=color] { padding: 2px; height: 38px; }
.err { color: var(--st-modif); font-weight: 600; font-size: 14px; }
.champ { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--doux); min-width: 0; }
.champ > input, .champ > textarea, .champ > select { color: var(--encre); font-weight: 400; font-size: 15px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reseaux { display: flex; flex-wrap: wrap; gap: 6px; }
.reseaux label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border: 1px solid var(--ligne); border-radius: 99px; cursor: pointer; color: var(--encre); }
.reseaux input { margin: 0; }
.medias { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.media { position: relative; border-radius: 9px; overflow: hidden; background: var(--surface2); border: 1px solid var(--ligne); }
.media img, .media .vid { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #000; }
.media .vid { display: grid; place-items: center; color: #fff; font-weight: 700; }
.media .outils { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; gap: 2px; padding: 3px; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.media .outils button { all: unset; cursor: pointer; color: #fff; font: 700 12px var(--mono); padding: 3px 6px; border-radius: 5px; background: rgba(0,0,0,.45); }
.media .duree { position: absolute; top: 4px; right: 4px; font: 700 10px var(--mono); background: rgba(0,0,0,.6); color: #fff; padding: 1px 5px; border-radius: 4px; }
.depot { border: 1.5px dashed var(--ligne); border-radius: 10px; padding: 12px; text-align: center; font-size: 13.5px; color: var(--doux); cursor: pointer; }
.depot.survol { border-color: var(--accent); color: var(--accent); }
.barre-prog { height: 6px; border-radius: 3px; background: var(--ligne); overflow: hidden; }
.barre-prog div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.lecteur { display: grid; gap: 8px; }
.lecteur .principal video, .lecteur .principal img { display: block; width: 100%; max-height: 560px; object-fit: contain; background: #000; border-radius: 10px; }
.lecteur .vignettes { display: flex; gap: 6px; overflow-x: auto; }
.lecteur .vignettes button { all: unset; cursor: pointer; flex: 0 0 52px; height: 72px; border-radius: 6px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px var(--ligne); }
.lecteur .vignettes button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.lecteur .vignettes img { width: 100%; height: 100%; object-fit: cover; display: block; }
.notes { font-size: 13px; padding: 8px 10px; border-radius: 9px; border: 1px dashed var(--ligne); white-space: pre-wrap; }
.sep { border: 0; border-top: 1px solid var(--ligne); margin: 2px 0; }
.cle { font-family: var(--mono); font-size: 13px; background: var(--surface2); border: 1px solid var(--ligne); border-radius: 8px; padding: 8px; overflow-wrap: anywhere; user-select: all; }
.msg.sys { border-left: 3px solid var(--st-avalider); }
.msg.ok-m { border-left: 3px solid var(--st-valide); }
.nonlu { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--st-modif); color: #fff; font: 700 11px var(--mono); }
.client-ligne { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--ligne); }
.client-ligne:first-child { border-top: 0; }
.client-ligne:hover { background: var(--surface2); }
.client-ligne .t { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) { .client-ligne { grid-template-columns: 1fr; gap: 4px; } .deux { grid-template-columns: 1fr; } .boost .trois { grid-template-columns: 1fr; } }
