/* Figtree reste la police du FILM (canevas et mp4, voir assets.js) ; l'interface
   suit le guide de style : grotesque neutre, papier chaud, un seul orange. */
@font-face { font-family: "Figtree"; src: url("/static/fonts/figtree-500.ttf"); font-weight: 500; }
@font-face { font-family: "Figtree"; src: url("/static/fonts/figtree-700.ttf"); font-weight: 700; }
@font-face { font-family: "Figtree"; src: url("/static/fonts/figtree-800.ttf"); font-weight: 800; }

/* === Jetons du guide de style, base typographique ================================================ */
:root {
  /* couleurs */
  --paper: #efede8;          /* fond d'application, papier chaud */
  --surface: #ffffff;
  --surface-2: #f7f6f3;
  --fill: #e6e3dc;           /* champ « rempli », puce par défaut, désactivé */
  --fill-2: #d9d5cc;
  --border: #d2cec4;
  --rule: #2a2925;           /* filet des titres de section */
  --text: #1e1e1c;
  --muted: #66635c;          /* 5,1:1 sur le papier, 4,7:1 sur --fill (AA) */
  --faint: #a29e95;
  --primary: #df5830;
  --primary-hover: #b8431f;
  /* l'orange de marque reste l'accent (bords, repères, icônes) ; sous du texte blanc ou EN texte,
  une nuance plus profonde tient le contraste AA (4,5:1) */
  --primary-fill: #c94a24;   /* texte blanc dessus : 4,7:1 */
  --primary-text: #b03f1c;   /* sur papier 5,0:1, sur blanc 5,9:1 */
  --primary-ink: #ffffff;
  --primary-soft: #fbe6dd;
  --focus: 0 0 0 1px var(--primary), 0 0 0 4px rgba(223, 88, 48, .18), 0 0 14px rgba(223, 88, 48, .25);
  /* familles du déroulé — désaturées pour rester dans la palette */
  --programme: #d9a82b;
  --programme-soft: #f6ecd2;
  --programme-ink: #6f5310;
  --predefini: #6aa35a;
  --predefini-soft: #e3eedc;
  --predefini-ink: #2f5a24;
  --musique: #6f86a6;
  --musique-soft: #e2e7ee;
  --musique-ink: #34475f;
  --carton: #123a44;
  --danger: #b93a25;         /* 5,1:1 sur fond d'alerte, 4,9:1 sur le papier */
  /* rayons */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-pill: 999px;
  /* élévation : ombre douce, large, chaude */
  --e1: 0 1px 2px rgba(40, 32, 20, .06), 0 2px 6px rgba(40, 32, 20, .05);
  --e2: 0 2px 4px rgba(40, 32, 20, .05), 0 10px 24px rgba(40, 32, 20, .10);
  --e3: 0 4px 8px rgba(40, 32, 20, .06), 0 24px 48px rgba(40, 32, 20, .16);
  /* espacement : 2 4 6 10 12 14 16 18 20 */
  --s1: 2px; --s2: 4px; --s3: 6px; --s4: 10px; --s5: 12px; --s6: 14px; --s7: 16px; --s8: 18px; --s9: 20px;
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-size: 14px; line-height: 1.45; overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.01em; }
b, strong { font-weight: 600; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.ico { display: inline-grid; place-items: center; line-height: 0; flex: none; }
/* repère de focus clavier, visible partout (cartes, vignettes, lignes, onglets, icônes) */
:focus-visible { outline: 2px solid var(--primary-fill); outline-offset: 2px; }
[role=button]:focus-visible { outline: 3px solid var(--primary-fill); outline-offset: 3px; border-radius: var(--r-sm); }
.eyebrow { color: var(--muted); font-size: 13px; margin-bottom: var(--s3); }
.warn-text { color: var(--danger); }
.small { font-size: 12px; }

/* === Boutons ===================================================================================== */
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 16px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  transition: background .15s, box-shadow .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--fill-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--primary-fill); border-color: var(--primary-fill); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 4px 18px rgba(201, 74, 36, .38); }
.btn.danger { color: var(--danger); }
.btn:disabled, .btn.primary:disabled { background: var(--fill); border-color: var(--fill); color: var(--faint); box-shadow: none; cursor: default; }
.ghost-btn {
  background: none;
  border: 0;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ghost-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn {
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  font-size: 14px;
}
.icon-btn:hover { color: var(--text); background: var(--fill); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
button.pill { min-height: 30px; border: 0; cursor: pointer; }
button.ico.badge-ico { border: 0; cursor: pointer; display: grid; place-items: center; flex: none; }
button.ico.badge-ico:hover { filter: brightness(.95); }
.btn-row { display: flex; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s6); }
button.link { border: 0; background: none; padding: 0; color: var(--primary-text); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }
.icon-btn.flip .ico { transform: scaleX(-1); }

/* === Champs de formulaire ======================================================================== */
input[type=text], input[type=number], input[type=search], select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  width: 100%;
  transition: box-shadow .15s, border-color .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #85827a; }
input:hover, select:hover, textarea:hover { border-color: var(--fill-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); background: var(--surface); }
textarea { resize: vertical; min-height: 40px; line-height: 1.4; }
input[type=color] {
  width: 36px;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
}
input[type=range] { width: 100%; accent-color: var(--primary); }
.check input { accent-color: var(--primary); width: 16px; height: 16px; }
/* réglages */
.row { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: var(--s4); margin: var(--s4) 0; }
.row > label { color: var(--muted); font-size: 13px; }
.row .inline { display: flex; gap: var(--s3); align-items: center; min-width: 0; }
.row .inline input[type=number] { width: 80px; }
.row .inline > .seg, .row .inline > select, .row .inline > input[type=range] { flex: 1; min-width: 0; }
.row .val { min-width: 44px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.stack { margin: var(--s4) 0; }
.stack > label { display: block; color: var(--muted); font-size: 13px; margin-bottom: var(--s3); }
.seg { display: flex; background: var(--fill); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { flex: 1; background: none; border: 0; border-radius: 6px; padding: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--e1); }
.check { display: inline-flex; align-items: center; gap: var(--s3); cursor: pointer; font-size: 13px; }
select.gen-model { width: auto; max-width: 100%; padding: 5px 8px; font-size: 12.5px; }

/* === Pastilles, étiquettes, puces ================================================================ */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.programme { background: var(--programme); }
.dot.predefini { background: var(--predefini); }
.dot.musique { background: var(--musique); }
.dot.carton { background: var(--carton); }
.dot.libre { background: var(--fill-2); }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 500;
  background: var(--fill);
  color: var(--text);
}
.tag.programme { background: var(--programme-soft); color: var(--programme-ink); }
.tag.predefini { background: var(--predefini-soft); color: var(--predefini-ink); }
.tag.musique { background: var(--musique-soft); color: var(--musique-ink); }
.tag.carton { background: #dfe7e8; color: var(--carton); }
.pill {
  border: 1px solid var(--border);
  background: var(--fill);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
/* cible de 24 px au moins (filtres Tout / Vidéos / Images) */
.pill:hover { background: var(--fill); }
.pill.on { background: var(--text); border-color: var(--primary-fill); color: #fff; }
.chip { background: rgba(255,255,255,.92); color: var(--text); padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; }
.meter { height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; margin-top: var(--s4); }
.meter div { height: 100%; background: var(--primary); }
.meter.done div { background: var(--predefini); }
.tag.ia { background: var(--primary-soft, #fbe3da); color: var(--primary-text); font-size: 11.5px; padding: 1px 8px; }
.pill.ok { background: var(--predefini-soft); color: var(--predefini-ink); }
.pill.todo { background: var(--programme-soft); color: var(--programme-ink); }
.pill.warn { background: #fdf0ea; color: var(--danger); }
.pill.busy { background: var(--primary-soft); color: var(--primary-text); }

/* === Alertes (callouts) ========================================================================== */
/* alertes : cartes élevées, icône à gauche */
.callout {
  position: relative;
  border-radius: var(--r-sm);
  padding: var(--s4) var(--s5) var(--s4) 22px;
  font-size: 13px;
  line-height: 1.5;
  margin: var(--s4) 0;
  background: var(--surface-2);
  box-shadow: var(--e1);
  border: 1px solid var(--border);
}
.callout::before { content: ""; position: absolute; left: 10px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--fill-2); }
.callout.programme::before { background: var(--programme); }
.callout.predefini::before { background: var(--predefini); }
.callout.musique::before { background: var(--musique); }
.callout.info { color: var(--muted); }
.callout.warn { background: #fdf0ea; border-color: #f2c7b6; color: #8a3418; box-shadow: 0 2px 14px rgba(223, 88, 48, .18); }
.callout.warn::before { background: var(--primary); }
.callout.small { font-size: 12.5px; margin: 0; }

/* === Barre du haut =============================================================================== */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: 0 var(--s7);
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; letter-spacing: -.01em; }
.brand b { font-weight: 600; }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
}
.name-input {
  background: none !important;
  border: 1px solid transparent !important;
  font-weight: 500;
  font-size: 16px;
  width: 300px !important;
  padding: 7px 10px !important;
  letter-spacing: -.01em;
  box-shadow: none;
}
.name-input:hover { border-color: var(--border) !important; }
.name-input:focus { background: var(--surface) !important; border-color: var(--primary) !important; box-shadow: var(--focus) !important; }
.save-state { color: var(--muted); font-size: 13px; min-width: 100px; }
.save-state.warn { color: var(--danger); }
/* onglets soulignés (Déroulé / Montage) */
.tabs { display: flex; gap: var(--s9); align-self: stretch; }
.tabs button { border: 0; background: none; padding: 0 2px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }
.ai-toggle.on { color: var(--text); background: var(--surface); box-shadow: var(--e1); }
.ai-toggle.on .ico { color: var(--primary); }
.budget-chip {
  display: grid;
  gap: 4px;
  min-width: 116px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: none;
  font-size: 12.5px;
  text-align: left;
}
.budget-chip:hover { background: var(--surface); border-color: var(--border); }
.budget-chip:focus-visible { outline: none; box-shadow: var(--focus); }
.budget-chip-top { display: flex; justify-content: space-between; gap: var(--s4); }
.budget-chip-top b { font-weight: 500; font-variant-numeric: tabular-nums; }
.budget-chip .meter { display: block; margin: 0; height: 3px; }
.budget-chip .meter span { display: block; height: 100%; background: var(--primary); }
.budget-chip.warn b { color: var(--danger); }

/* === Accueil : liste des films =================================================================== */
.view { height: 100vh; }
.home { display: flex; flex-direction: column; }
.home-main { overflow: auto; padding: 44px 56px; flex: 1; }
.home-hero {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: flex-end;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
.home-hero h1 { font-size: 56px; font-weight: 500; letter-spacing: -.035em; line-height: 1; margin-bottom: var(--s6); }
.home-hero p { max-width: 640px; line-height: 1.6; margin: 0; color: var(--muted); }
.home-actions { display: flex; gap: var(--s4); }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.card {
  background: var(--surface);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--e2);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--e3); transform: translateY(-2px); }
.card-cover { aspect-ratio: 16/9; background: var(--fill-2) center/cover no-repeat; position: relative; }
.card-cover .chip { position: absolute; right: var(--s4); bottom: var(--s4); }
.card-body { padding: var(--s6) var(--s7); display: flex; align-items: center; gap: var(--s2); }
.card-body > div { flex: 1; min-width: 0; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: 0 var(--s7) var(--s6); }
.card-title { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { color: var(--muted); font-size: 13px; margin-top: var(--s2); display: flex; gap: var(--s4); align-items: center; }
.home-empty {
  color: var(--muted);
  padding: 72px;
  text-align: center;
  border: 1px dashed var(--fill-2);
  border-radius: var(--r-lg);
  grid-column: 1/-1;
  line-height: 1.7;
  background: var(--surface-2);
}

/* === Éditeur : grille des colonnes, rail d'icônes, panneau de gauche ============================= */
.editor {
  --ai-w: 372px;              /* colonne Assistant (conversation + réglages de la sélection) */
  display: grid;
  grid-template-columns: 84px 344px minmax(0, 1fr) var(--ai-w);
  grid-template-rows: 60px minmax(0, 1fr) auto;
  grid-template-areas: "top top top top" "rail side stage ai" "rail side strip ai";
}
.editor.ai-closed { --ai-w: 0px; }
.editor.side-closed { grid-template-columns: 84px 0 minmax(0, 1fr) var(--ai-w); }
.editor > .topbar { grid-area: top; }
.rail {
  grid-area: rail;
  background: var(--paper);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s5) var(--s3);
}
.rail button {
  border: 0;
  background: none;
  border-radius: var(--r);
  padding: var(--s4) 0 var(--s3);
  display: grid;
  justify-items: center;
  gap: var(--s3);
  font-size: 12px;
  color: var(--muted);
}
.rail button:hover { color: var(--text); }
.rail .rail-ico { width: 44px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; position: relative; transition: background .15s; }
.rail .rail-ico .dot { position: absolute; right: 4px; top: 4px; width: 7px; height: 7px; }
.rail button:hover .rail-ico { background: var(--fill); }
.rail button.on { color: var(--text); }
.rail button.on .rail-ico { background: var(--surface); box-shadow: var(--e1); color: var(--primary); }
.side { grid-area: side; background: var(--surface); border-right: 1px solid var(--border); overflow: hidden; min-width: 0; position: relative; }
.side-close { display: none; position: absolute; top: var(--s5); right: var(--s5); z-index: 2; }
.side-body { height: 100%; overflow: auto; padding: var(--s9) var(--s9) 48px; }
.side h2 { font-size: 22px; font-weight: 500; letter-spacing: -.02em; }
.side h3 { border-top: 1px solid var(--rule); padding-top: var(--s5); margin: 28px 0 var(--s6); font-size: 14px; font-weight: 500; color: var(--text); }
.side .lead { color: var(--muted); font-size: 13px; line-height: 1.55; margin: var(--s3) 0 var(--s7); }
.side-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); }
.side-head h2 { flex: 1; font-size: 18px; }
.stage { grid-area: stage; min-width: 0; min-height: 0; position: relative; }
.editor.ai-closed .assistant { display: none; }
/* les réglages reprennent la typographie du panneau latéral */
.side-like h2 { font-size: 18px; font-weight: 500; letter-spacing: -.02em; }
.side-like h3 { border-top: 1px solid var(--rule); padding-top: var(--s5); margin: 22px 0 var(--s5); font-size: 14px; font-weight: 500; }
.side-like .lead { color: var(--muted); font-size: 13px; line-height: 1.55; margin: var(--s3) 0 var(--s6); }
.side-like .side-head { margin: var(--s5) 0 var(--s3); }
.side-like .row { grid-template-columns: 92px 1fr; }
.side-like .text-group:first-of-type { margin-top: 0; }
.side .side-head .muted { flex: none; }

/* === Panneaux de gauche : programme (sources), séquences, textes, musique, exports =============== */
.gen-src:focus-visible, .media:focus-visible { outline-offset: 1px; }
/* médias */
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.media {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--fill) center/cover no-repeat;
  cursor: grab;
  box-shadow: var(--e1);
  transition: box-shadow .15s, transform .15s;
}
.media:hover { box-shadow: 0 0 0 2px var(--primary), var(--e2); transform: translateY(-1px); }
.media .badge {
  position: absolute;
  left: var(--s3);
  bottom: var(--s3);
  background: rgba(30,30,28,.62);
  color: #fff;
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
}
.media .used {
  position: absolute;
  left: var(--s3);
  top: var(--s3);
  background: var(--predefini);
  color: #fff;
  font-size: 11.5px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
}
/* masqué par l'opacité (pas display:none) : il reste atteignable au clavier */
.media .del {
  position: absolute;
  right: var(--s2);
  top: var(--s2);
  display: grid;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: 0;
  background: rgba(255,255,255,.95);
  color: var(--danger);
  padding: 0;
  place-items: center;
  opacity: 0;
  transition: opacity .12s;
}
.media:hover .del, .media:focus-within .del { opacity: 1; }
.audio-list { display: grid; gap: var(--s3); grid-template-columns: minmax(0, 1fr); }
.audio-item {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  transition: box-shadow .15s;
}
.audio-item:hover { box-shadow: var(--e1); }
.audio-item.on { border-color: var(--primary); box-shadow: var(--focus); }
.audio-item .ico.badge-ico { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--musique-soft); color: var(--musique-ink); }
/* départ de la musique dans le morceau */
.music-start { display: grid; gap: var(--s3); margin-bottom: var(--s5); }
.music-start-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.music-start-head b { font-variant-numeric: tabular-nums; }
.music-wave { width: 100%; height: 64px; border-radius: var(--r-sm); background: var(--surface-2); cursor: ew-resize; touch-action: none; display: block; }
.music-start .btn-row { margin: 0; flex-wrap: wrap; }
.music-start p.small { margin: 0; line-height: 1.45; }
/* générateur de musique (panneau Musique) */
.music-gen {
  display: grid;
  gap: var(--s3);
  padding: var(--s5);
  margin: var(--s4) 0 var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 12px);
  background: var(--surface);
}
.music-gen-head { display: grid; gap: 2px; }
.side .music-gen-head h3 { margin: 0; padding: 0; border: 0; font-size: 15px; }
.audio-text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.audio-meta { display: flex; align-items: center; gap: var(--s2); font-size: 12px; color: var(--muted); }
.audio-meta .tag { font-size: 11.5px; padding: 0 8px; }
.music-gen .chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.music-gen .chip {
  position: static;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 4px 11px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
}
.music-gen .chip:hover:not(:disabled) { border-color: var(--musique-ink); }
.music-gen .chip.on { background: var(--musique-soft); border-color: var(--musique-ink); color: var(--musique-ink); }
.music-gen .chip:disabled { opacity: .5; cursor: default; }
.music-gen textarea { width: 100%; resize: vertical; font: inherit; font-size: 13px; }
.music-gen .btn .price { opacity: .75; font-size: 12px; margin-left: 4px; }
.music-gen p.small { margin: 0; line-height: 1.45; }
.audio-item .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.upload-zone {
  border: 1px dashed var(--fill-2);
  background: var(--surface-2);
  border-radius: var(--r);
  padding: var(--s8);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: var(--s2);
  margin-bottom: var(--s6);
  transition: all .15s;
}
.upload-zone:hover, .upload-zone.drop { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.upload-zone b { color: var(--text); font-size: 14px; font-weight: 500; }
.upload-progress { height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; margin: calc(-1 * var(--s3)) 0 var(--s6); }
.upload-progress div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.filters { display: flex; gap: var(--s3); margin-bottom: var(--s5); flex-wrap: wrap; }
/* textes du programme */
.text-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s5); margin-bottom: var(--s4); }
.text-group-head { display: flex; align-items: center; gap: var(--s3); font-size: 13px; color: var(--muted); margin-bottom: var(--s4); cursor: pointer; }
.text-group-head:hover { color: var(--primary-text); }
.text-group textarea, .text-group input { margin-bottom: var(--s3); font-size: 13.5px; padding: 8px 10px; background: var(--surface-2); }
.text-group textarea:last-child, .text-group input:last-child { margin-bottom: 0; }
.text-group textarea { min-height: 38px; }
.add-grid { display: grid; gap: var(--s4); }
.add-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--s5) var(--s6);
  text-align: left;
  background: var(--surface);
  display: flex;
  gap: var(--s5);
  align-items: center;
  transition: box-shadow .15s, border-color .15s;
}
.add-card:hover { border-color: var(--primary); box-shadow: var(--focus); }
.add-card .preview {
  width: 64px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--carton);
  display: grid;
  place-items: center;
  color: #fff;
  font-family: "Figtree", sans-serif;
  font-size: 12px;
  font-weight: 800;
  flex: none;
}
.add-card b { display: block; font-weight: 500; }
.add-card span { color: var(--muted); font-size: 12.5px; }
.layer-list { display: grid; gap: var(--s3); }
.layer-item {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  background: var(--surface);
}
.layer-item:hover { border-color: var(--primary); }
.layer-item > .ico, .layer-item .glyph { width: 20px; text-align: center; color: var(--muted); }
.layer-item .lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-pick { display: flex; gap: var(--s5); align-items: center; }
.bg-thumb {
  width: 112px;
  aspect-ratio: 16/9;
  border-radius: var(--r-sm);
  background: var(--fill) center/cover no-repeat;
  border: 1px dashed var(--fill-2);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: var(--s2);
  flex: none;
}
.render-list { display: grid; gap: var(--s3); }
.render-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  background: var(--surface);
}
.render-item span { flex: 1; }
.ref {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: var(--r-sm);
  border: 0;
  padding: 0;
  background: var(--fill) center/cover no-repeat;
  opacity: .55;
  filter: grayscale(.4);
  transition: all .15s;
}
.ref:hover { opacity: .9; filter: none; }
.ref.on { opacity: 1; filter: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.estimate { margin: var(--s5) 0; font-size: 13px; }
.estimate b { font-size: 16px; font-weight: 500; }
.variant {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12.5px;
}
.variant.on { border-color: var(--primary); }
.media.is-ref { box-shadow: 0 0 0 2px var(--primary), var(--e1); }
.media .ref-mark { background: var(--primary); }
.media .ia-mark { background: var(--text); left: auto; right: 30px; }
.gen-target {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--fill-2);
  border-radius: var(--r-sm);
  padding: var(--s4);
  line-height: 1.45;
}
.gen-target.on { border: 1px solid var(--primary); background: var(--primary-soft); color: var(--text); }
.gen-src {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: var(--r-sm);
  background: var(--fill) center/cover;
  cursor: grab;
  box-shadow: var(--e1);
  transition: box-shadow .15s, transform .15s;
}
.gen-src:hover { transform: translateY(-1px); box-shadow: 0 0 0 2px var(--primary), var(--e2); }
.gen-src.in-sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.gen-src-cat {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 6px 3px;
  font-size: 11.5px;
  color: #fff;
  background: linear-gradient(transparent, rgba(30,30,28,.8));
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gen-src-n {
  position: absolute;
  left: 4px;
  top: 4px;
  background: var(--primary-fill);
  color: #fff;
  font-size: 11.5px;
  border-radius: var(--r-pill);
  min-width: 18px;
  text-align: center;
  line-height: 18px;
  padding: 0 5px;
}
.gen-sources-empty {
  border: 1px dashed var(--fill-2);
  border-radius: var(--r-sm);
  padding: var(--s6);
  font-size: 13px;
  line-height: 1.5;
  background: var(--surface-2);
}
.gen-sources-empty p { margin: var(--s3) 0 0; color: var(--muted); }
.side .src-import { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-bottom: var(--s4); }
.side .src-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s4); }
.side .src-grid.drop { outline: 2px dashed var(--primary); outline-offset: 4px; border-radius: var(--r-sm); }
.side .gen-src .del {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: rgba(30,30,28,.7);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  opacity: 0;
  transition: opacity .12s;
}
.side .gen-src:hover .del, .side .gen-src:focus-within .del { opacity: 1; }

/* === Espace de travail : barre flottante, canevas, lecture, cartes de plan ======================= */
.montage { height: 100%; display: flex; flex-direction: column; position: relative; }
.floatbar {
  align-self: center;
  margin-top: var(--s7);
  display: flex;
  align-items: center;
  gap: var(--s1);
  min-height: 48px;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--e2);
  padding: var(--s3);
  max-width: calc(100% - 32px);
  flex-wrap: nowrap;
  overflow: hidden;
  z-index: 3;
}
.floatbar > * { flex-shrink: 0; }
/* on mesure le débordement, on ne laisse rien s'écraser */
/* paliers de resserrement (floatbar.js) */
.floatbar.compact .fb-label { display: none; }
.floatbar.compact .title { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.floatbar.compact .sep { margin: var(--s2) var(--s1); }
.floatbar .fb-btn.fb-more { display: none; font-size: 18px; line-height: 1; padding: 5px 10px 9px; }
.floatbar.tight .fb-secondary { display: none; }
.floatbar.tight .fb-btn.fb-more { display: inline-flex; }
.floatbar.tight .title { max-width: 110px; }
.floatbar.compact select { max-width: 150px; text-overflow: ellipsis; }
.floatbar.tight select { max-width: 112px; }
/* dernier recours (écran très étroit) : défilement horizontal plutôt qu'un contrôle coupé */
.floatbar.tight { overflow-x: auto; scrollbar-width: none; }
.floatbar.tight::-webkit-scrollbar { display: none; }
.fb-menu {
  position: absolute;
  z-index: 40;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--e3);
  padding: var(--s3);
  display: grid;
  min-width: 200px;
}
.fb-menu button {
  border: 0;
  background: none;
  border-radius: var(--r-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: var(--s4);
  text-align: left;
  color: var(--text);
}
.fb-menu button:hover, .fb-menu button:focus-visible { background: var(--fill); outline: none; }
.fb-menu button.danger { color: var(--danger); }
.floatbar .sep { width: 1px; align-self: stretch; background: var(--border); margin: var(--s2) var(--s3); }
.floatbar .fb-btn {
  border: 0;
  background: none;
  border-radius: var(--r-sm);
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  white-space: nowrap;
  color: var(--text);
}
.floatbar .fb-btn:hover { background: var(--fill); }
.floatbar .fb-btn.on { background: var(--primary-soft); color: var(--primary-text); }
.floatbar .fb-num { display: inline-flex; align-items: center; gap: var(--s2); padding: 0 var(--s3); color: var(--muted); }
.floatbar .fb-num input { width: 60px; padding: 6px 8px; text-align: center; background: var(--fill); border-color: transparent; color: var(--text); }
.floatbar select { width: auto; padding: 7px 10px; border-color: transparent; background: transparent; }
.floatbar select:hover { background: var(--fill); }
.floatbar input[type=color] {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  padding: 0;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  overflow: hidden;
  margin: 0 var(--s2);
}
.floatbar .hint { color: var(--muted); padding: 0 var(--s4); font-size: 13px; }
.floatbar .title { padding: 0 var(--s3) 0 var(--s1); font-weight: 500; white-space: nowrap; }
.canvas-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: var(--s7) 32px; }
.canvas-box { position: relative; box-shadow: var(--e3); border-radius: 3px; }
.canvas-box canvas { display: block; width: 100%; height: 100%; background: #000; border-radius: 3px; }
.overlay { position: absolute; inset: 0; }
.canvas-box.drop-target { box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--primary), var(--e3); }
.sel-box { position: absolute; border: 2px solid var(--primary); cursor: move; box-shadow: 0 0 12px rgba(223, 88, 48, .35); }
.sel-box.hover { border: 1.5px solid rgba(223, 88, 48, .6); box-shadow: none; pointer-events: none; }
.sel-box .handle {
  position: absolute;
  width: 10px;
  height: 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--e1);
}
.sel-box .handle.e { right: -6px; top: 50%; margin-top: -12px; cursor: ew-resize; }
.sel-box .handle.w { left: -6px; top: 50%; margin-top: -12px; cursor: ew-resize; }
.guide { position: absolute; background: var(--primary); pointer-events: none; }
.guide.v { width: 1px; top: 0; bottom: 0; }
.guide.h { height: 1px; left: 0; right: 0; }
.transport { display: flex; align-items: center; gap: var(--s5); padding: var(--s2) 32px var(--s6); }
.play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: #fff;
  flex: none;
  display: grid;
  place-items: center;
  transition: background .15s, box-shadow .15s;
}
.play:hover { background: var(--primary-hover); box-shadow: 0 4px 16px rgba(242, 106, 36, .45); }
.timecode { font-variant-numeric: tabular-nums; font-size: 13px; min-width: 52px; }
.scrub { flex: 1; height: 28px; position: relative; cursor: pointer; display: flex; align-items: center; }
.scrub-segs { position: absolute; left: 0; right: 0; height: 6px; display: flex; gap: 2px; }
.scrub-segs div { height: 100%; border-radius: 2px; opacity: .75; }
.scrub-segs .programme { background: var(--programme); }
.scrub-segs .predefini { background: var(--predefini); }
.scrub-segs .carton { background: var(--carton); }
.scrub-segs .libre { background: var(--fill-2); }
.scrub-segs .on { opacity: 1; height: 10px; margin-top: -2px; }
.scrub-head { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; pointer-events: none; }
.scrub-head::after {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--text);
  box-sizing: border-box;
}
/* bande de plans */
.strip { grid-area: strip; background: var(--paper); border-top: 1px solid var(--border); min-width: 0; }
.pages { display: flex; gap: var(--s5); overflow-x: auto; padding: var(--s6) var(--s9) var(--s7); align-items: flex-start; position: relative; }
.page { flex: none; width: 132px; cursor: pointer; position: relative; }
.page-frame {
  aspect-ratio: 16/9;
  border-radius: var(--r-sm);
  background: var(--fill-2) center/cover no-repeat;
  border: 2.5px solid var(--border);
  position: relative;
  box-shadow: var(--e1);
  transition: box-shadow .15s;
}
.page.programme .page-frame { border-color: var(--programme); }
.page.predefini .page-frame { border-color: var(--predefini); }
.page.carton .page-frame { border-color: var(--carton); }
.page.variante .page-frame { border-style: dashed; }
.page.empty .page-frame { background-color: var(--surface-2); background-image: none; box-shadow: none; }
.page.empty.programme .page-frame { background-color: var(--programme-soft); }
.page.empty.predefini .page-frame { background-color: var(--predefini-soft); }
.page.on .page-frame { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--primary), 0 0 16px rgba(223, 88, 48, .3); }
.page.drop .page-frame { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--primary); }
.page.dragging { opacity: .35; }
.page .num {
  position: absolute;
  left: var(--s2);
  bottom: var(--s2);
  background: rgba(255,255,255,.95);
  border-radius: var(--r-pill);
  font-size: 11.5px;
  padding: 0 6px;
}
.page .dur {
  position: absolute;
  right: var(--s2);
  bottom: var(--s2);
  background: rgba(30,30,28,.72);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  padding: 0 6px;
}
.page-name { font-size: 12px; color: var(--muted); margin-top: var(--s3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page.on .page-name { color: var(--text); }
.page-add {
  flex: none;
  width: 74px;
  aspect-ratio: 74/74;
  border-radius: var(--r-sm);
  border: 1px dashed var(--fill-2);
  background: var(--surface-2);
  color: var(--muted);
  display: grid;
  place-items: center;
}
.page-add:hover { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.insert-mark {
  position: absolute;
  top: 0;
  width: 3px;
  height: 74px;
  background: var(--primary);
  border-radius: 2px;
  pointer-events: none;
  margin-left: -8px;
  box-shadow: 0 0 8px rgba(223, 88, 48, .6);
}
.page.has-ref .page-frame { background-size: cover; position: relative; }
.page.has-ref .page-frame::before { content: ""; position: absolute; inset: 0; background: rgba(246, 236, 210, .72); border-radius: inherit; }
/* image clé déjà générée : voile plus léger qu'une simple référence */
.page.has-key .page-frame::before { background: rgba(246, 236, 210, .38); }
.page-gen { position: absolute; left: 6px; right: 6px; top: 50%; transform: translateY(-50%); }
.page-gen .gen-progress.compact { width: 100%; margin: 0; }

/* === Génération : progression, filtre, références, contrôle ===================================== */
/* barre de progression des générations */
.gen-progress { margin: var(--s4) 0 var(--s2); }
.gen-bar { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.gen-bar div {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 1.4s linear;
  background-image: linear-gradient(90deg, rgba(255,255,255,0) 0, rgba(255,255,255,.35) 50%, rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  animation: gen-shine 1.6s linear infinite;
  box-shadow: 0 0 10px rgba(223, 88, 48, .45);
}
.gen-meta { display: flex; justify-content: space-between; font-size: 12px; margin-top: var(--s2); font-variant-numeric: tabular-nums; }
.gen-progress.compact { margin: var(--s3) 0; width: 80%; }
.gen-progress.compact .gen-bar { height: 5px; }
.gen-filter {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-pill);
  padding: 4px 5px 4px 10px;
  font-size: 12.5px;
  color: var(--text);
}
.gen-filter .n {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--fill);
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.gen-filter:hover { border-color: var(--fill-2); background: var(--surface-2); }
.gen-filter.on { background: var(--text); border-color: var(--text); color: #fff; }
.gen-filter.on .n { background: rgba(255, 255, 255, .2); }
.gen-ref { position: relative; width: 56px; height: 38px; border-radius: 6px; background: var(--fill) center/cover; }
.gen-ref .gen-src-n { left: 2px; top: 2px; min-width: 16px; line-height: 16px; font-size: 11px; padding: 0 4px; }
.gen-ref.add { border: 1px dashed var(--fill-2); display: grid; place-items: center; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.gen-ref.add:hover { border-color: var(--primary); color: var(--primary); }
.gen-x {
  position: absolute;
  right: -6px;
  top: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: var(--text);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  opacity: 0;
  transition: opacity .12s;
}
.gen-ref:hover .gen-x, .gen-ref:focus-within .gen-x { opacity: 1; }
.gen-check {
  position: absolute;
  right: 3px;
  bottom: 3px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--r-pill);
  font-size: 11px;
  padding: 1px 6px;
  background: rgba(255,255,255,.95);
  z-index: 1;
}
.gen-check.ok { color: var(--predefini-ink); }
.gen-check.warn { color: var(--danger); }
.gen-big { width: 100%; border-radius: var(--r-sm); aspect-ratio: 16/9; object-fit: cover; background: #000; box-shadow: var(--e1); }
.gen-problems { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.gen-ref.big { width: 96px; height: 60px; border-radius: var(--r-sm); }

/* === Panneau du plan (colonne de droite, 5 étapes) =============================================== */
/* « Description de l'image » (écrite d'après les références) : titre, état, bouton à droite */
.gen-desc-head { display: flex; align-items: center; gap: var(--s3); }
.gen-desc-head .pill { text-transform: none; letter-spacing: 0; }
.gen-desc-btn { margin-left: auto; text-transform: none; letter-spacing: 0; gap: var(--s2); }
/* panneau du plan */
.plan-panel { display: grid; gap: var(--s2); }
.plan-step { border-top: 1px solid var(--border); padding: var(--s6) 0 var(--s5); display: grid; gap: var(--s4); }
.plan-step:first-of-type { border-top: 0; }
.plan-step-head { display: flex; align-items: center; gap: var(--s4); min-width: 0; }
.plan-step-head h3 { margin: 0 !important; padding: 0 !important; border: 0 !important; font-size: 14px; font-weight: 500; flex: 1; }
.plan-step-n {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: var(--fill);
  color: var(--muted);
  flex: none;
}
.plan-step-n.done { background: var(--predefini-soft); color: var(--predefini-ink); }
.plan-step.current .plan-step-n { background: var(--primary-fill); color: #fff; }
.plan-step.current .plan-step-head h3 { color: var(--primary-text); }
.plan-step.locked .plan-step-head h3 { color: var(--faint); }
.plan-locked { margin: 0; padding-left: 32px; }
.plan-refs { display: flex; gap: var(--s3); flex-wrap: wrap; border-radius: var(--r-sm); padding: 2px; }
.plan-refs.drop { outline: 2px dashed var(--primary); outline-offset: 2px; }
.plan-media { position: relative; }
.plan-media .gen-big, .plan-media video {
  width: 100%;
  display: block;
  border-radius: var(--r-sm);
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #000;
  box-shadow: var(--e1);
}
.plan-media .gen-check { right: 6px; bottom: auto; top: 6px; }
.plan-versions { display: flex; align-items: center; justify-content: center; gap: var(--s3); margin-top: var(--s2); color: var(--muted); }
.plan-run { display: grid; gap: var(--s2); color: var(--primary-text); }
.plan-animate { display: flex; gap: var(--s3); align-items: center; }
.plan-animate select { flex: 1; min-width: 0; }
.plan-step .btn .price { opacity: .8; font-size: 11.5px; margin-left: 4px; }
.plan-step .gen-problems { margin: 0; }
.plan-step .btn-row { margin-top: 0; }
.plan-step .gen-desc-head { display: flex; align-items: center; gap: var(--s3); }
.plan-step .gen-desc-btn { margin-left: 0; }
.plan-settings { border-top: 1px solid var(--rule); margin-top: var(--s4); padding-top: var(--s5); }
.plan-settings > summary { cursor: pointer; font-size: 14px; font-weight: 500; list-style: none; display: flex; align-items: center; gap: var(--s3); }
.plan-settings > summary::before { content: "▸"; color: var(--muted); }
.plan-settings[open] > summary::before { content: "▾"; }
.plan-settings[open] > summary { margin-bottom: var(--s4); }
.plan-step.folded { padding: var(--s4) 0; }
.plan-step-sum { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-step.folded .plan-step-head h3 { flex: none; }
.plan-step-head button.link { flex: none; }
.plan-panel, .plan-step { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.plan-step select, .plan-animate select { width: 100%; min-width: 0; max-width: 100%; }
.plan-animate .btn { flex: none; }
/* mouvement de caméra de l'animation (étape Vidéo, versions des plans verts) */
.plan-camera { display: grid; gap: var(--s3); }
.plan-camera-row { display: grid; gap: 4px; }
.plan-camera-row > .small { color: var(--muted); }
.plan-timelapse { display: flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.plan-timelapse > .small { color: var(--text); }
.plan-camera-speed { max-width: 200px; }
.plan-camera-speed button { padding: 4px 6px; font-size: 12.5px; }
.plan-camera .muted.small { margin: 0; }
.plan-camera-note { width: 100%; font-size: 13px; }
/* textes du programme : aperçu avant d'appliquer */
.texts-preview { display: grid; gap: var(--s3); max-height: 52vh; overflow: auto; margin: var(--s4) 0; }
.texts-row { display: grid; grid-template-columns: auto 1fr; gap: var(--s4); align-items: start; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; }
.texts-row input { margin-top: 3px; }
.texts-old { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.texts-new { font-weight: 500; font-size: 13.5px; }
.text-group-head .pill { margin-left: auto; font-size: 11px; padding: 0 7px; }
/* direction artistique : rendu d'une image clé, import manuel, harmonisation, réglages du film */
.plan-look { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); font-size: 12.5px; }
.plan-look .plan-look-score { position: static; }
.plan-look .pill { font-size: 11.5px; padding: 1px 8px; }
.plan-import { justify-self: start; display: inline-flex; align-items: center; gap: 6px; }
.harmonize-list { list-style: none; margin: var(--s4) 0; padding: 0; display: grid; gap: 2px; max-height: 280px; overflow: auto; }
.harmonize-list li { display: flex; justify-content: space-between; gap: var(--s5); padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 13px; }
.harmonize-list .price { color: var(--muted); font-variant-numeric: tabular-nums; }
.check-row { display: flex; gap: var(--s4); align-items: flex-start; font-size: 13px; line-height: 1.45; margin: var(--s3) 0; }
.check-row input { margin-top: 3px; flex: none; }
.look-set { border: 1px solid var(--border); border-radius: var(--r); padding: var(--s5) var(--s6) var(--s4); display: grid; gap: var(--s4); margin: 0; }
.look-set legend { font-weight: 500; font-size: 13.5px; padding: 0 6px; }
.look-set p { margin: 0; }
.look-refs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.look-ref { display: grid; gap: 4px; align-content: start; justify-items: start; }
.look-ref img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--r-sm); box-shadow: var(--e1); }
/* plan vert : nouvelle version IA (deux choix, prix à droite) */
.plan-version-btn { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); text-align: left; padding: 8px 12px; white-space: normal; }
.plan-version-label { display: grid; gap: 1px; min-width: 0; }
.plan-version-label b { font-weight: 500; }
.plan-version-btn .price { flex: none; }
.plan-step > p.muted.small { margin: 0; }

/* === Colonne de droite : onglets Détails / Assistant, conversation =============================== */
.assistant {
  grid-area: ai;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
/* le panneau d'un plan prend la hauteur qu'il lui faut ; la conversation garde au moins 220 px */
/* --- phase 2 : colonne de droite à onglets, sources à gauche, budget en haut ------ */
.ai-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5) var(--s4) var(--s6);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.ai-head h2 { display: flex; align-items: center; gap: var(--s3); font-size: 16px; }
.ai-head h2 .ico { color: var(--primary); }
.ai-usd { font-size: 12px; font-variant-numeric: tabular-nums; }
/* détail de la sélection */
.ai-ctx { flex: 1; border-bottom: 0; background: var(--surface); display: flex; flex-direction: column; max-height: none; min-height: 0; }
.ai-ctx-body {
  overflow: auto;
  padding: var(--s2) var(--s7) var(--s9);
  background: var(--surface);
  border-top: 0;
  min-height: 0;
  flex: 1;
  padding-top: var(--s5);
  overflow-x: hidden;
}
/* conversation */
.ai-list { flex: 1; overflow: auto; padding: var(--s7) var(--s7) var(--s4); display: flex; flex-direction: column; gap: var(--s6); min-height: 0; }
.ai-empty p { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 0 0 var(--s6); }
.ai-suggest { display: grid; gap: var(--s3); }
.ai-suggest .chip {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}
.ai-suggest .chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.ai-msg.user { display: flex; justify-content: flex-end; }
.ai-bubble {
  background: var(--text);
  color: #fff;
  border-radius: var(--r) var(--r) 4px var(--r);
  padding: 8px 12px;
  max-width: 88%;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-msg.bot { display: grid; gap: var(--s4); font-size: 13.5px; line-height: 1.55; }
.ai-text p { margin: 0 0 var(--s3); }
.ai-text p:last-child { margin-bottom: 0; }
.ai-text ul { margin: var(--s2) 0; padding-left: 18px; }
.ai-text code { background: var(--fill); border-radius: 4px; padding: 0 4px; font-size: 12.5px; }
.ai-actions { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.ai-actions li {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  font-size: 12.5px;
  color: var(--predefini-ink);
  background: var(--predefini-soft);
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 1.4;
}
.ai-actions li .ico { margin-top: 2px; }
.ai-actions li.err { color: var(--danger); background: #fdf0ea; }
.ai-actions li.past { color: var(--muted); background: var(--fill); }
.ai-undo .btn { gap: var(--s3); }
.ai-typing { display: flex; gap: 4px; padding: 6px 0; }
.ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: ai-dot 1s infinite ease-in-out; }
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
.ai-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-sm);
  padding: var(--s5);
  display: grid;
  gap: var(--s3);
}
.ai-card-head { display: flex; align-items: center; gap: var(--s3); }
.ai-card-head .ico { color: var(--primary); }
.ai-card p { margin: 0; }
.ai-card .btn-row { margin-top: var(--s3); align-items: center; }
.ai-card .btn .price { opacity: .8; font-size: 11.5px; margin-left: 4px; }
.ai-gen-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(64px, auto); gap: var(--s4); align-items: center; font-size: 13px; }
.ai-gen-row button.link { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-gen-row .gen-progress.compact { width: 72px; margin: 0; }
.ai-gen-row .price { font-variant-numeric: tabular-nums; }
.ai-composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: var(--s3);
  margin: var(--s4) var(--s5) var(--s5);
  padding: var(--s3) var(--s3) var(--s3) var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--e1);
}
.ai-composer:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.ai-composer textarea {
  flex: 1;
  border: 0 !important;
  box-shadow: none !important;
  background: none !important;
  resize: none;
  padding: 7px 0 !important;
  min-height: 22px;
  max-height: 160px;
  line-height: 1.45;
  outline: none;
}
.ai-send {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 0;
  background: var(--primary-fill);
  color: #fff;
  display: grid;
  place-items: center;
}
.ai-send:hover { background: var(--primary-hover); }
.ai-send:focus-visible { outline: none; box-shadow: var(--focus); }
/* ce que l'assistant vient de changer : bref surlignage dans la vue ouverte */
.ai-flash { animation: ai-flash 1.4s ease-out; }
.ai-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; position: relative; }
.ai-unread { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); display: inline-block; }
.ai-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ai-chat[hidden], .ai-ctx[hidden] { display: none !important; }
/* le panneau du plan ne déborde jamais de la colonne (une liste déroulante longue l'élargissait) */
.ai-ctx, .ai-ctx-body { min-width: 0; }

/* === Modale, toasts, tâches, voile de dépôt, budget ============================================== */
.modal { position: fixed; inset: 0; background: rgba(30, 28, 24, .38); display: grid; place-items: center; z-index: 50; backdrop-filter: blur(2px); }
.modal-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: min(820px, 92vw);
  max-height: 88vh;
  overflow: auto;
  padding: 28px 32px;
  position: relative;
  box-shadow: var(--e3);
}
.modal-close { position: absolute; right: var(--s6); top: var(--s6); }
.modal-card h2 { font-size: 24px; margin-bottom: var(--s4); letter-spacing: -.02em; }
.modal-card p { line-height: 1.55; }
.modal-card video { width: 100%; border-radius: var(--r); background: #000; margin: var(--s4) 0 var(--s5); }
.modal-card ul { padding-left: 0; list-style: none; display: grid; gap: var(--s3); }
.modal-card li {
  display: flex;
  gap: var(--s4);
  align-items: center;
  padding: var(--s4) var(--s5);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.progress { height: 6px; background: var(--fill); border-radius: 3px; overflow: hidden; margin: var(--s7) 0 var(--s4); }
.progress div { height: 100%; background: var(--primary); width: 0; transition: width .3s; box-shadow: 0 0 10px rgba(223, 88, 48, .5); }
/* en bas à droite : ne couvre plus le budget, la barre d'outils ni les réglages du haut */
#editor.mode-montage:not([hidden]) ~ .toasts { bottom: 210px; }
/* au-dessus de la bande de plans */
.toasts { position: fixed; right: var(--s9); bottom: var(--s9); display: grid; gap: var(--s4); z-index: 60; justify-items: end; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: var(--s4);
  background: var(--surface);
  color: var(--text);
  padding: var(--s4) var(--s7);
  border-radius: var(--r-sm);
  max-width: 440px;
  box-shadow: var(--e2);
  border: 1px solid var(--border);
  font-size: 13.5px;
}
.toast .ico { color: var(--muted); }
.toast.error { background: #fdf0ea; border-color: #f2c7b6; color: #8a3418; box-shadow: 0 4px 18px rgba(223, 88, 48, .25); }
.toast.error .ico { color: var(--primary); }
.drop-veil {
  position: fixed;
  inset: 0;
  background: rgba(239, 237, 232, .72);
  border: 2px dashed var(--primary);
  display: grid;
  place-items: center;
  z-index: 40;
  pointer-events: none;
  backdrop-filter: blur(2px);
}
.drop-veil > div {
  background: var(--surface);
  padding: var(--s8) 28px;
  border-radius: var(--r);
  font-size: 18px;
  font-weight: 500;
  box-shadow: var(--e3);
  text-align: center;
}
.drop-veil span { display: block; font-size: 13.5px; color: var(--muted); font-weight: 400; margin-top: var(--s2); }
.job-card {
  margin-top: var(--s5);
  border-radius: var(--r-sm);
  padding: var(--s4) var(--s5);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
}
.job-card.running, .job-card.queued { border-color: var(--primary); box-shadow: var(--focus); }
.job-card.done { border-color: #bcd8b2; background: var(--predefini-soft); }
.job-card.review, .job-card.error { border-color: #f2c7b6; background: #fdf0ea; color: #8a3418; }
.job-head { display: flex; align-items: center; gap: var(--s3); }
.job-head b { font-weight: 500; }
.job-steps { margin-top: var(--s3); color: var(--muted); display: grid; gap: 2px; font-size: 12.5px; }
.job-err { margin-top: var(--s3); font-size: 12.5px; }
.job-card .progress { margin: var(--s4) 0 var(--s2); }
.modal-card .eyebrow { margin-bottom: 4px; }
.job-steps .now { color: var(--text); }
/* toasts : à gauche de la colonne Assistant quand elle est ouverte (sinon ils couvrent la saisie) */
#editor:not([hidden]):not(.ai-closed) ~ .toasts { right: calc(372px + var(--s9)); }
.budget-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: var(--s5); }
.budget-table th { text-align: left; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--border); padding: 6px 8px; }
.budget-table td { padding: 6px 8px; border-bottom: 1px solid var(--fill); }
.budget-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* === Animations et tailles d'écran ================================================================ */
/* Figtree reste la police du FILM (canevas et mp4, voir assets.js) ; l'interface
   suit le guide de style : grotesque neutre, papier chaud, un seul orange. */
@font-face { font-family: "Figtree"; src: url("/static/fonts/figtree-500.ttf"); font-weight: 500; }
@font-face { font-family: "Figtree"; src: url("/static/fonts/figtree-700.ttf"); font-weight: 700; }
@font-face { font-family: "Figtree"; src: url("/static/fonts/figtree-800.ttf"); font-weight: 800; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes gen-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes ai-flash { 0% { box-shadow: 0 0 0 3px var(--primary), 0 0 22px rgba(223, 88, 48, .45); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 1360px) {
  .editor { --ai-w: 340px; }
  #editor:not([hidden]):not(.ai-closed) ~ .toasts { right: calc(340px + var(--s9)); }
}

/* === Accessibilité : correctifs de l'audit (contraste, taille des cibles, mouvement réduit) ======= */
/* étape verrouillée : lisible (AA), le grisé du numéro suffit à dire « pas encore » */
.plan-step.locked .plan-step-head h3 { color: var(--muted); }
/* cibles d'au moins 24 × 24 px */
.side .gen-src .del { width: 24px; height: 24px; }
.plan-step-head button.link { padding: 4px 2px; min-height: 24px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* === Bande des plans (déroulé du film) et planche ================================================= */
.strip { display: flex; flex-direction: column; min-height: 0; }
.strip-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s4) var(--s9) 0; font-size: 13px; flex-wrap: nowrap; }
.strip-status { display: flex; align-items: center; gap: var(--s3); min-width: 0; overflow: hidden; white-space: nowrap; }
.strip-status b { font-weight: 600; font-variant-numeric: tabular-nums; }
.strip-meter { display: inline-flex; width: 84px; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; margin: 0 var(--s3); }
.strip-meter i { display: block; height: 100%; }
.strip-meter .programme { background: var(--programme); }
.strip-meter .predefini { background: var(--predefini); }
.strip-actions { display: flex; align-items: center; gap: var(--s3); flex: none; }
.strip-actions .btn.small { padding: 5px 10px; }
.strip-actions .btn .price { opacity: .75; font-size: 12px; margin-left: 4px; }
.strip-actions .btn .ico { margin-left: 2px; }
.strip-actions .btn:has(> .ico:last-child) .ico { transform: scaleX(-1); }
.btn.on { background: var(--text); border-color: var(--text); color: #fff; }
.pages { gap: 0; padding: var(--s4) var(--s9) var(--s4); }
.page-insert { flex: none; width: 14px; height: 74px; border: 0; background: none; color: transparent; border-radius: 6px; display: grid; place-items: center; padding: 0; transition: background .12s, color .12s; }
.page-insert:hover, .page-insert:focus-visible { background: var(--primary-soft); color: var(--primary-text); }
.page-state { position: absolute; left: 4px; bottom: 4px; max-width: calc(100% - 52px); padding: 1px 7px; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.page.dim { opacity: .35; }
.page.dim:hover { opacity: .8; }
.page-more { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border-radius: 6px; border: 0; background: rgba(30, 30, 28, .72); color: #fff; font-size: 14px; line-height: 1; display: grid; place-items: center; padding: 0; opacity: 0; transition: opacity .12s; z-index: 2; }
.page:hover .page-more, .page.on .page-more, .page-more:focus-visible { opacity: 1; }
.page-add { height: 74px; width: 74px; margin-left: var(--s3); }
.music-lane { padding: 0 var(--s9) var(--s5); }
.music-lane-btn { width: 100%; display: flex; align-items: center; gap: var(--s4); min-height: 32px; padding: 4px 12px; border-radius: var(--r-sm); border: 1px solid var(--musique-soft); background: var(--musique-soft); color: var(--musique-ink); font-size: 12.5px; text-align: left; }
.music-lane-btn b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-lane-btn .muted { white-space: nowrap; }
.music-lane.empty .music-lane-btn { background: none; border-style: dashed; border-color: var(--musique); }
.music-lane.drop .music-lane-btn { box-shadow: var(--focus); }
.music-lane-btn:hover { border-color: var(--musique); }
/* planche : la bande dépliée sur le canevas, en grandes vignettes */
.editor.planche { grid-template-areas: "top top top top" "rail side strip ai" "rail side strip ai"; grid-template-rows: 60px minmax(0, 1fr) 0; }
.editor.planche .stage { display: none; }
.editor.planche .strip { border-top: 0; }
.editor.planche .strip-head { padding-top: var(--s8); }
.editor.planche .strip { height: 100%; }
.editor.planche .pages { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); align-content: start; align-items: start; overflow-x: hidden; overflow-y: auto; row-gap: var(--s8); padding-top: var(--s8); }
.editor.planche .page { width: auto; min-width: 0; }
/* (planche en grille : l'insertion passe par le menu ⋯ de chaque carte et le + final) */
.editor.planche .page-insert { display: none; }
.editor.planche .page-add { width: 100%; height: auto; aspect-ratio: 16/9; margin: 0; }
.editor.planche .pages { column-gap: var(--s8); }
.editor.planche .page-name { font-size: 13px; }
/* menus de la bande : ajouter un plan, actions d'un plan */
.strip-pop { position: fixed; z-index: 70; width: 380px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--e3); padding: var(--s4); display: grid; gap: var(--s3); font-size: 13px; }
.pop-title { font-weight: 500; padding: 2px 4px 4px; }
.pop-section { display: grid; gap: var(--s3); border-top: 1px solid var(--border); padding-top: var(--s4); }
.pop-label { display: flex; align-items: center; gap: var(--s3); font-weight: 500; padding: 0 4px; }
.pop-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 4px; }
.pop-group > .muted { width: 100%; }
.pop-chip { border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--r-pill); padding: 5px 11px; font-size: 12.5px; }
.pop-chip:hover, .pop-chip:focus-visible { border-color: var(--programme); background: var(--programme-soft); color: var(--programme-ink); outline: none; }
.pop-item { display: grid; gap: 1px; text-align: left; border: 0; background: none; border-radius: var(--r-sm); padding: 7px 8px; }
.pop-item b { font-weight: 500; }
.pop-item:hover, .pop-item:focus-visible, .pop-row:hover, .pop-row:focus-visible { background: var(--fill); outline: none; }
.strip-pop:has(.pop-row) { width: 230px; gap: 2px; padding: var(--s3); }
.pop-row { display: flex; align-items: center; gap: var(--s4); border: 0; background: none; border-radius: var(--r-sm); padding: 7px 8px; text-align: left; }
.pop-row.danger { color: var(--danger); }
/* plan vide sélectionné : son état et son action, posés sur le canevas */
.canvas-box { position: relative; }
.slot-cta { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: var(--s4); max-width: calc(100% - 32px); padding: 8px 10px 8px 12px; border-radius: var(--r); background: rgba(255, 255, 255, .95); box-shadow: var(--e2); z-index: 3; font-size: 13px; white-space: nowrap; }
.slot-cta > span.small { white-space: normal; color: var(--muted); max-width: 300px; min-width: 210px; line-height: 1.35; }
.slot-cta .btn { flex: none; white-space: nowrap; }
.slot-cta .btn .price { opacity: .8; font-size: 11.5px; margin-left: 4px; }
.slot-cta-run { width: 160px; }
.slot-cta-run .gen-progress.compact { margin: 0; }
/* réglages du film */
.film-settings { display: grid; gap: var(--s5); margin: var(--s5) 0; min-width: 440px; }
.film-settings .stack { display: grid; gap: 4px; }
/* toast avec action (« Annuler » après une suppression) */
.toast.has-action { pointer-events: auto; }
.toast-action { margin-left: var(--s4); border: 0; background: none; color: var(--primary-text); font-weight: 600; padding: 2px 4px; }
.toast-action:hover { text-decoration: underline; }
/* variante sans source : retirée du film (0 s) */
.page.skipped .page-frame {
  background-color: var(--surface-2) !important;
  opacity: .6;
  background-image: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(0,0,0,.035) 10px 20px) !important;
}
/* image ou vidéo générée par l'IA */
.page .ia { position: absolute; left: 4px; top: 4px; background: var(--text); color: #fff; font-size: 11px; border-radius: var(--r-pill); padding: 0 6px; z-index: 1; }

/* === Connexion ================================================================================ */
.login-body { display: grid; place-items: center; min-height: 100%; overflow: auto; padding: var(--s9); }
.login-card {
  width: min(420px, 100%); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--e2);
  padding: 32px 32px 28px;
}
.login-card .brand { margin-bottom: 28px; }
.login-card h1 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 var(--s3); }
.login-card p { margin: 0 0 var(--s5); line-height: 1.55; }
.login-card input { width: 100%; font-size: 16px; }
.login-card .btn.block { margin-top: var(--s5); justify-content: center; }
.login-card .login-back { margin-top: var(--s4); }
.login-error { color: var(--danger); font-size: 13px; margin: var(--s3) 0 0 !important; }
input[type=email] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 12px;
}
input[type=email]:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }

/* === Compte connecté, page Comptes ============================================================ */
.account { margin-left: auto; display: flex; align-items: center; gap: var(--s3); }
.account-who { color: var(--muted); font-size: 13px; margin-right: var(--s3); }
.accounts { min-width: min(640px, 80vw); }
.accounts-table { width: 100%; border-collapse: collapse; margin: var(--s4) 0 var(--s7); font-size: 13.5px; }
.accounts-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.accounts-table td { padding: 8px; border-bottom: 1px solid var(--fill); vertical-align: middle; }
.accounts-table td select { width: auto; padding: 5px 8px; }
.accounts-table tr.revoked td:first-child { color: var(--faint); text-decoration: line-through; }
.accounts-add .btn-row { margin-top: var(--s3); flex-wrap: nowrap; }
.accounts-add input[type=email] { flex: 1; min-width: 0; }
.accounts-add select { width: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.plan-validate { display: grid; gap: var(--s3); padding: var(--s4); border-radius: var(--r-sm); background: var(--programme-soft); }
.plan-validate p { margin: 0; color: var(--programme-ink); }

/* === Couverture des sources, situation ========================================================= */
.cov { border-top: 1px solid var(--border); margin-top: var(--s7); padding-top: var(--s6); display: grid; gap: var(--s4); }
.side .cov h3, .cov h3 { margin: 0; padding: 0; border: 0; font-size: 15px; font-weight: 500; }
.cov .side-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin: 0; }
.cov-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); font-size: 13px; }
.cov-list li { display: grid; grid-template-columns: auto 1fr; gap: var(--s4); align-items: start; }
.cov-list .pill { font-size: 11.5px; padding: 2px 8px; }
.near { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s5); margin: 0; font-size: 13px; }
.near dt { color: var(--muted); }
.near dd { margin: 0; }
.gen-src.free { outline: 1px dashed var(--fill-2); outline-offset: -1px; }
.credits { margin: 0; font-size: 11.5px; }

/* === Validation depuis l'assistant : versions cliquables sur leur aperçu ============================ */
.ai-val { display: grid; gap: var(--s3); padding: var(--s4) 0; border-top: 1px solid var(--border); }
.ai-val.off .ai-val-strip, .ai-val.off .ai-val-preview { opacity: .45; }
.ai-val-head { display: flex; align-items: center; gap: var(--s3); font-size: 13px; }
.ai-val-head input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.ai-val-head button.link { font-weight: 500; text-align: left; }
.ai-val-head .pill { margin-left: auto; font-size: 11px; padding: 1px 7px; }
.ai-val-comment { margin: 0; color: var(--text); }
.ai-val-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.ai-val-v {
  position: relative; flex: none; width: 94px; aspect-ratio: 16 / 9; border-radius: 6px; border: 2px solid transparent;
  background: var(--fill) center / cover no-repeat; padding: 0; cursor: pointer; box-shadow: var(--e1);
}
.ai-val-v:hover { border-color: var(--fill-2); }
.ai-val-v:focus-visible { outline: none; box-shadow: var(--focus); }
.ai-val-v.on { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(223, 88, 48, .25); }
.ai-val-v:disabled { cursor: default; }
.ai-val-tag { position: absolute; left: 3px; bottom: 3px; background: rgba(20, 20, 18, .72); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; max-width: calc(100% - 6px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-val-check { position: absolute; right: 3px; top: 3px; font-size: 10px; padding: 0 5px; border-radius: 4px; color: #fff; background: rgba(47, 90, 36, .85); }
.ai-val-check.warn { background: rgba(185, 58, 37, .9); }
.ai-val-film { position: absolute; left: 3px; top: 3px; font-size: 10px; padding: 0 5px; border-radius: 4px; background: var(--primary-fill); color: #fff; }
.ai-val-preview { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-sm); background: #000; display: block; }

/* === Alignement du texte : trois boutons groupés (barre flottante, réglages) ===================== */
.floatbar .fb-seg { display: inline-flex; gap: 1px; }
.floatbar .fb-seg .fb-btn { padding-left: 7px; padding-right: 7px; }
.seg button .ico { vertical-align: -3px; margin-right: 4px; }

/* === Bandeau « nouvelle version » (bleu : une information, pas une action du studio) ================== */
:root { --info: #1f5fd1; --info-hover: #174ba8; }   /* texte blanc : 5,9:1 */
.update-bar {
  height: 40px; display: flex; align-items: center; justify-content: center; gap: var(--s4);
  background: var(--info); color: #fff; font-size: 13.5px; padding: 0 var(--s7); position: relative; z-index: 60;
}
.update-bar[hidden] { display: none; }
.update-bar b { font-weight: 600; }
.update-reload {
  background: #fff; color: var(--info); border: 0; border-radius: var(--r-pill); padding: 5px 14px; font-weight: 600;
  font-size: 13px; cursor: pointer;
}
.update-reload:hover { background: #e8efff; }
.update-reload:focus-visible, .update-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.update-close { position: absolute; right: var(--s5); background: none; border: 0; color: #fff; opacity: .85; cursor: pointer; padding: 4px; display: grid; }
.update-close:hover { opacity: 1; }
body.has-update .view { height: calc(100vh - 40px); }
@media (prefers-reduced-motion: no-preference) { .update-bar:not([hidden]) { animation: update-in .25s ease-out; } }
@keyframes update-in { from { transform: translateY(-100%); } to { transform: none; } }

/* === Administration : plafonds de génération ================================================== */
.modal-card h3.admin-h { margin: var(--s7) 0 var(--s3); font-size: 15px; font-weight: 600; }
.caps-grid { display: grid; grid-template-columns: 1fr auto; gap: var(--s4) var(--s7); align-items: center; margin-top: var(--s3); }
.caps-grid label { display: grid; gap: 2px; font-size: 14px; }
.caps-input { display: flex; align-items: center; gap: var(--s3); }
.caps-input input { width: 96px; text-align: right; }
.caps-films { margin-top: var(--s5); font-size: 13px; }
.caps-films summary { cursor: pointer; color: var(--muted); }
.modal-card .caps-films ul { list-style: none; padding: 0; margin: var(--s3) 0 0; display: grid; gap: 0; max-height: 200px; overflow: auto; }
.modal-card .caps-films li { display: flex; justify-content: space-between; gap: var(--s5); padding: 4px 0; background: none; border: 0; border-radius: 0; border-bottom: 1px solid var(--fill); }
.modal-card .caps-films li.over { color: var(--danger); }

/* === Réglages du film : onglets, lumière (arc du soleil, saison) ================================ */
.modal-card.fs-card { width: min(860px, 94vw); }
.fs-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: var(--s3) 0 var(--s5); }
.fs-tabs button { background: none; border: 0; padding: 8px 14px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.fs-tabs button:hover { color: var(--text); }
.fs-tabs button.on { color: var(--text); border-bottom-color: var(--primary); font-weight: 500; }
.fs-tabs button:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.film-settings[hidden] { display: none; }
.lt { display: grid; gap: var(--s5); }
.lt-grid { display: grid; grid-template-columns: 1fr 280px; gap: 22px; align-items: start; }
.lt-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: var(--s4); }
.lt-head b { font-size: 15px; font-weight: 600; }
.lt-dial { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 6px 10px 2px; }
.lt-arc { display: block; cursor: grab; touch-action: none; }
.lt-arc:active { cursor: grabbing; }
.lt-arc { user-select: none; -webkit-user-select: none; }
.lt-arc text { pointer-events: none; }
.lt-arc:focus, .lt-arc:focus-visible { outline: none; }
.lt.compact .lt-dial .lt-arc { max-width: 520px; margin: 0 auto; }
.lt-arc:focus-visible .lt-sun { stroke: var(--primary); }
.lt-prev { border-radius: var(--r); overflow: hidden; box-shadow: var(--e1); border: 1px solid var(--border); }
.lt-prev-svg { display: block; }
.lt-info { margin: 6px 2px 0 !important; }
.lt-season { display: grid; gap: 6px; }
.lt-seg button .ico { vertical-align: -3px; margin-right: 5px; }
.lt-impact { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: #fdf3e8; border: 1px solid #e9c9a8; border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.lt-impact b { font-weight: 600; }
.lt-test { display: flex; gap: 8px; align-items: center; flex: none; }
.lt-test select { width: auto; max-width: 200px; padding: 6px 8px; font-size: 13px; }
.lt.compact .lt-dial { padding: 4px 8px 0; }
@media (max-width: 760px) { .lt-grid { grid-template-columns: 1fr; } }
.new-light { border-top: 1px solid var(--border); margin-top: var(--s5); padding-top: var(--s5); display: grid; gap: var(--s3); }
.new-light h3 { margin: 0; font-size: 15px; font-weight: 600; }
.new-light p { margin: 0; }
