/* ===========================================================================
   Keyframe — interface de révision vidéo.

   Parti pris : gris NEUTRE et sombre. Une interface teintée fausse la
   perception des couleurs de la vidéo qu'on est en train de juger — c'est la
   raison pour laquelle tous les outils de montage sont gris. L'accent orange
   est réservé aux commandes et aux repères, jamais aux grandes surfaces.
   =========================================================================== */

:root {
  --fond: #17181a;
  --fond-2: #1e2023;
  --panneau: #232629;
  --panneau-2: #2b2f33;
  --bord: #33383d;
  --bord-fort: #454b52;
  --texte: #e8eaed;
  --texte-doux: #9aa0a6;
  --accent: #ff8a5c;
  --accent-clair: #ffc079;
  --accent-degrade: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
  --ok: #48c9a0;
  --alerte: #ffbb4d;
  --danger: #ff6b81;
  --rayon: 12px;
  --ombre: 0 14px 40px rgba(0, 0, 0, .45);
  --police: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-clair); }
.cache { display: none !important; }
/* L'attribut hidden vient de la feuille du navigateur : n'importe quelle règle
   d'auteur qui pose un display le bat, quelle que soit sa spécificité. Sans
   cette ligne, le voile du menu — qui est un flex — s'affichait ouvert au
   chargement de chaque page. */
[hidden] { display: none !important; }
.doux { color: var(--texte-doux); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Barre supérieure ---------- */
.barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: var(--fond-2);
  border-bottom: 1px solid var(--bord);
  position: sticky;
  top: 0;
  z-index: 30;
}
.logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--texte);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.logo-marque {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--accent-degrade);
  display: inline-block;
  position: relative;
}
.logo-marque::after {
  content: '';
  position: absolute; inset: 7px 7px auto auto;
  width: 8px; height: 8px;
  background: var(--fond-2);
  transform: rotate(45deg);
  top: 7px; left: 7px;
}
.barre-droite { display: flex; align-items: center; gap: 12px; }
.barre nav a { color: var(--texte-doux); text-decoration: none; font-size: .9rem; margin-left: 16px; }
.barre nav a:hover { color: var(--texte); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 16px;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s, background .15s, border-color .15s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-primaire { background: var(--accent-degrade); color: #26130a; }
.btn-primaire:hover:not(:disabled) { filter: brightness(1.08); }
.btn-neutre { background: var(--panneau-2); color: var(--texte); border-color: var(--bord); }
.btn-neutre:hover:not(:disabled) { border-color: var(--bord-fort); background: var(--panneau); }
.btn-discret { background: transparent; color: var(--texte-doux); }
.btn-discret:hover:not(:disabled) { color: var(--texte); background: var(--panneau-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255,107,129,.4); }
.btn-danger:hover:not(:disabled) { background: rgba(255,107,129,.12); }
.btn-petit { padding: 5px 10px; font-size: .8rem; }

/* ---------- Champs ---------- */
label.champ { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; color: var(--texte-doux); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], textarea, select {
  background: var(--fond);
  border: 1px solid var(--bord);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--texte);
  font: inherit;
  font-size: .95rem;
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 76px; }

/* ---------- Blocs ---------- */
.contenu { max-width: 1080px; margin: 0 auto; padding: 28px 22px 60px; }
.carte {
  background: var(--panneau);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 20px 22px;
}
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

h1 { font-size: 1.7rem; margin: 0 0 10px; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0 0 8px; }

.etiquette {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-radius: 999px;
  padding: 3px 9px;
}
.et-pret { background: rgba(72,201,160,.16); color: var(--ok); }
.et-traitement { background: rgba(255,187,77,.16); color: var(--alerte); }
.et-froid { background: rgba(107,176,224,.16); color: #6bb0e0; }
.et-echec, .et-supprime { background: rgba(255,107,129,.16); color: var(--danger); }

.message { font-size: .88rem; min-height: 20px; margin: 8px 0 0; }
.message.ok { color: var(--ok); }
.message.err { color: var(--danger); }

/* ---------- Accueil / connexion ---------- */
.accueil { max-width: 940px; margin: 0 auto; padding: 60px 22px; }
.accroche { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 16px; }
.accroche em { font-style: normal; background: var(--accent-degrade); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sous-accroche { color: var(--texte-doux); font-size: 1.05rem; max-width: 60ch; margin: 0 0 26px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .duo { grid-template-columns: 1fr; } }
.onglets { display: flex; gap: 6px; margin-bottom: 16px; }
.onglet {
  flex: 1; text-align: center; padding: 9px; border-radius: 9px;
  background: var(--panneau-2); border: 1px solid var(--bord);
  color: var(--texte-doux); cursor: pointer; font-weight: 600; font-size: .9rem;
}
.onglet.actif { background: var(--panneau); color: var(--texte); border-color: var(--accent); }
.formulaire { display: flex; flex-direction: column; gap: 13px; }

/* ---------- Liste des vidéos ---------- */
.media-carte {
  background: var(--panneau);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color .15s, transform .15s;
}
.media-carte:hover { border-color: var(--bord-fort); transform: translateY(-2px); }
.media-vignette {
  aspect-ratio: 16/9;
  background: #0e0f10 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: var(--texte-doux); font-size: .8rem;
}
.media-infos { padding: 12px 14px; }
.media-titre { font-weight: 600; font-size: .95rem; margin-bottom: 5px; word-break: break-word; }
.media-meta { font-size: .78rem; color: var(--texte-doux); display: flex; gap: 10px; flex-wrap: wrap; }

.jauge { height: 6px; background: var(--fond); border-radius: 99px; overflow: hidden; border: 1px solid var(--bord); }
.jauge i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.jauge i.plein { background: var(--danger); }

/* ---------- Zone de dépôt ---------- */
.depot {
  border: 2px dashed var(--bord-fort);
  border-radius: var(--rayon);
  padding: 34px 20px;
  text-align: center;
  color: var(--texte-doux);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.depot:hover, .depot.survol { border-color: var(--accent); background: rgba(255,138,92,.06); color: var(--texte); }

/* ---------- Page de révision ---------- */
.revision {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  height: calc(100vh - 57px);
}
@media (max-width: 980px) { .revision { grid-template-columns: 1fr; height: auto; } }

.zone-lecteur { display: flex; flex-direction: column; min-width: 0; background: #0e0f10; }
.scene { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.scene-inner { position: relative; max-width: 100%; max-height: 100%; }
.scene video { display: block; max-width: 100%; max-height: 100%; background: #000; }
/* Le canvas se superpose EXACTEMENT à l'image : le dessin doit correspondre au
   pixel près à ce que le client voit, sinon la annotation perd son sens. */
#toile { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
#toile.inactif { pointer-events: none; }

.commandes { background: var(--fond-2); border-top: 1px solid var(--bord); padding: 10px 14px; }
.ligne-temps { position: relative; height: 34px; cursor: pointer; }
.piste {
  position: absolute; top: 14px; left: 0; right: 0; height: 6px;
  background: var(--panneau-2); border-radius: 99px; overflow: hidden;
}
.piste-lue { height: 100%; background: var(--accent); width: 0; }
/* Les repères de commentaires : c'est le cœur de l'outil, ils doivent rester
   lisibles même quand il y en a beaucoup. */
.repere {
  position: absolute; top: 6px; width: 3px; height: 22px;
  background: var(--accent-clair); border-radius: 2px; transform: translateX(-1px);
  cursor: pointer;
}
.repere.resolu { background: var(--ok); opacity: .6; }
.repere:hover { box-shadow: 0 0 0 3px rgba(255,192,121,.25); }

.boutons-lecture { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.temps { font-family: var(--mono); font-size: .82rem; color: var(--texte-doux); }
.bouton-icone {
  background: var(--panneau-2); border: 1px solid var(--bord); color: var(--texte);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: .95rem;
}
.bouton-icone:hover { border-color: var(--bord-fort); }
.bouton-icone.actif { border-color: var(--accent); color: var(--accent-clair); }

/* Outils de dessin */
/* Les outils de dessin, au milieu de la barre de lecture. Sur un écran étroit,
   la barre passe à la ligne plutôt que de déborder. */
.boutons-lecture { flex-wrap: wrap; }
.espace-lecture { flex: 1; }
.outils { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.outils #b-effacer { margin-left: 8px; }
.couleur { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.couleur.actif { border-color: #fff; }

/* Panneau des commentaires */
.panneau-comm { background: var(--panneau); border-left: 1px solid var(--bord); display: flex; flex-direction: column; min-height: 0; }
@media (max-width: 980px) { .panneau-comm { border-left: none; border-top: 1px solid var(--bord); } }
.comm-entete { padding: 13px 16px; border-bottom: 1px solid var(--bord); display: flex; align-items: center; justify-content: space-between; }
.comm-liste { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.comm {
  background: var(--panneau-2); border: 1px solid var(--bord);
  border-radius: 10px; padding: 10px 12px; cursor: pointer;
}
.comm:hover { border-color: var(--bord-fort); }
.comm.resolu { opacity: .55; }
.comm-haut { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.comm-tc { font-family: var(--mono); font-size: .8rem; color: var(--accent-clair); font-weight: 700; }
.comm-auteur { font-size: .8rem; font-weight: 600; }
.comm-invite { font-size: .68rem; color: var(--texte-doux); border: 1px solid var(--bord); border-radius: 4px; padding: 0 4px; }
.comm-texte { font-size: .88rem; white-space: pre-wrap; word-break: break-word; }
.comm-actions { display: flex; gap: 6px; margin-top: 7px; }
.comm-apercu { margin-top: 7px; border-radius: 6px; border: 1px solid var(--bord); max-width: 100%; display: block; }
.comm-averif { font-size: .72rem; color: var(--alerte); margin-top: 5px; }
/* La réponse du monteur, sous le retour qu'elle traite. */
.comm-reponse {
  font-size: .82rem; color: var(--texte-doux); margin-top: 6px;
  border-left: 2px solid var(--ok); padding-left: 8px; white-space: pre-wrap; word-break: break-word;
}
.comm-revue {
  border-top: 1px solid var(--bord); padding: 9px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem;
}
.comm-revue.finie #etat-revue { color: var(--ok); }
/* Clips : la note du pipeline, et les décisions d'Oka */
.note-api {
  padding: 10px 14px; border-bottom: 1px solid var(--bord); background: var(--panneau-2);
  font-size: .84rem; white-space: pre-wrap; word-break: break-word; max-height: 30vh; overflow-y: auto;
}
.comm-decision { border-top: 1px solid var(--bord); padding: 9px 12px; display: flex; flex-direction: column; gap: 6px; font-size: .8rem; }
.decision-boutons, .carte-tri { display: flex; gap: 6px; flex-wrap: wrap; }
.carte-tri { margin-top: 8px; }
.decision-boutons .btn.actif, .carte-tri .btn.actif { border-color: var(--accent); color: var(--accent); }
#etat-publication a { color: var(--accent-clair); }
.media-carte.jetee { opacity: .5; }
.carte-atelier { margin-top: 8px; }
.barre-tri { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; font-size: .86rem; }
.choix-version {
  width: auto; padding: 4px 8px; font-size: .8rem;
  background: var(--panneau-2); color: var(--texte); border: 1px solid var(--bord-fort); border-radius: 8px;
}

.comm-saisie { border-top: 1px solid var(--bord); padding: 11px 12px; display: flex; flex-direction: column; gap: 8px; }
.comm-saisie-haut { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--texte-doux); }

/* ---------- Fenêtres ---------- */
.voile {
  position: fixed; inset: 0; background: rgba(0,0,0,.62);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.fenetre {
  background: var(--panneau); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 22px; width: min(520px, 100%); box-shadow: var(--ombre);
  max-height: 86vh; overflow-y: auto;
}
.fenetre-titre { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

.lien-invit {
  display: flex; gap: 8px; align-items: center; margin-top: 10px;
  background: var(--fond); border: 1px solid var(--bord); border-radius: 8px; padding: 8px 10px;
}
.lien-invit input { border: none; background: transparent; padding: 0; font-family: var(--mono); font-size: .78rem; }

.liste-simple { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.liste-simple li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--fond); border: 1px solid var(--bord); border-radius: 8px; padding: 8px 11px; font-size: .84rem;
}

.pied { border-top: 1px solid var(--bord); padding: 22px; text-align: center; color: var(--texte-doux); font-size: .84rem; }
.pied a { color: var(--texte-doux); margin: 0 8px; }

/* Annotations superposees a la video pendant la lecture.
   pointer-events:none — la couche ne doit jamais intercepter un clic destine
   au lecteur ou a la toile de dessin. */
#couche-annotation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease;
}
#couche-annotation.visible { opacity: 1; }

/* Repere du commentaire actuellement affiche */
.repere.actif { background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.3); }
.comm.actif { border-color: var(--accent); background: rgba(255,138,92,.08); }

/* Les blocs de la fenêtre de paramètres : séparés par un trait, pour qu'on voie
   d'un coup d'œil que changer son nom et changer son mot de passe sont deux
   gestes distincts, avec deux boutons distincts. */
.bloc-param { padding: 16px 0; border-bottom: 1px solid var(--bord); }
.bloc-param:last-child { border-bottom: none; padding-bottom: 0; }
.bloc-param h3 { margin: 0 0 10px; font-size: .95rem; }
.bloc-param .message { margin: 8px 0 0; }

/* Les deux entrées du parcours collaborateur : créer un compte, ou se
   connecter. Deux boutons plutôt qu'un lien discret — c'est un choix, pas une
   option secondaire. */
.onglets-invit { display: flex; gap: 6px; margin-bottom: 12px; }
.onglets-invit .btn.actif { border-color: var(--accent); color: var(--accent); }

/* ---------- Panneau de téléchargement ----------
   En bas à droite, au-dessus du reste. Il faut pouvoir lancer un rush de
   140 Go et continuer à travailler dans la page sans le perdre de vue. */
.tele-panneau {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  width: min(340px, calc(100vw - 36px));
  background: var(--panneau); border: 1px solid var(--bord-fort);
  border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: 12px 14px 14px;
}
.tele-entete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: .88rem; }
.tele-ligne { padding: 8px 0; border-top: 1px solid var(--bord); }
.tele-ligne:first-child { border-top: none; }
.tele-nom {
  font-size: .84rem; margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tele-jauge { height: 6px; }
.tele-bas { font-size: .74rem; color: var(--texte-doux); margin-top: 6px; }

/* ---------- Console d'administration ----------
   Un tableau, et pas des cartes : on vient y comparer des chiffres entre
   comptes, ce que des cartes empilées rendent justement impossible. */
.tableau { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tableau th {
  text-align: left; font-weight: 600; color: var(--texte-doux);
  font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 10px; border-bottom: 1px solid var(--bord);
}
.tableau td { padding: 10px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.tableau tr:hover td { background: var(--fond-2); }
.tableau .num { text-align: right; font-variant-numeric: tabular-nums; }
.enveloppe-tableau { overflow-x: auto; border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--panneau); }

.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin: 16px 0 26px; }
.chiffre { background: var(--panneau); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 13px 15px; }
.chiffre b { display: block; font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
.chiffre span { color: var(--texte-doux); font-size: .78rem; }
.chiffre .jauge { margin-top: 8px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; border: 1px solid var(--bord-fort); color: var(--texte-doux);
}
.badge.admin { border-color: var(--accent); color: var(--accent); }
.badge.perso { border-color: var(--alerte); color: var(--alerte); }
.badge.fini { border-color: var(--ok); color: var(--ok); }

/* Console, onglet API */
.form-jeton { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.form-jeton input, .form-jeton select { width: auto; flex: 1 1 180px; }
.jeton-neuf {
  background: var(--panneau-2); border: 1px solid var(--ok); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 12px;
}
.jeton-ligne { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.jeton-ligne code { word-break: break-all; font-size: .82rem; }

.onglets-admin { display: flex; gap: 6px; margin: 18px 0 8px; flex-wrap: wrap; }
.onglets-admin .btn.actif { border-color: var(--accent); color: var(--accent); }

/* La vidéothèque : une ligne par rush, cases à cocher à gauche pour en
   attribuer plusieurs d'un coup — c'est le geste normal, une émission
   représente rarement un seul fichier. */
.vod-ligne { display: flex; align-items: center; gap: 12px; }
.vod-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vod-dossier { color: var(--texte-doux); font-size: .76rem; }
.vod-qui { display: flex; flex-wrap: wrap; gap: 5px; }
.vod-qui button {
  background: var(--fond-2); border: 1px solid var(--bord-fort); color: var(--texte-doux);
  border-radius: 999px; padding: 1px 8px; font-size: .72rem; cursor: pointer; font-family: inherit;
}
.vod-qui button:hover { border-color: var(--danger); color: var(--danger); }
.barre-action {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panneau-2); border: 1px solid var(--bord-fort); border-radius: var(--rayon);
  padding: 10px 14px; margin-top: 14px;
}
.barre-action select {
  /* Sans cette bride, le menu prend toute la largeur de la barre et rejette le
     bouton sur la ligne suivante : la barre d'action perd sa lisibilité. */
  flex: 0 1 300px; min-width: 160px; max-width: 300px;
  background: var(--fond); color: var(--texte); border: 1px solid var(--bord-fort);
  border-radius: 8px; padding: 7px 10px; font-family: inherit; font-size: .86rem;
}
.barre-action > span:first-child { flex: 1 1 auto; font-size: .86rem; }

/* ---------- Vidéothèque : l'avancement d'un rush ----------
   Le menu et la note vivent dans une ligne de tableau : sans hauteur contenue,
   chaque ligne prenait le double de place et la liste ne tenait plus à l'écran. */
.select-etat, .champ-note {
  width: 100%;
  padding: 5px 8px;
  font-size: .82rem;
  background: var(--fond);
  color: var(--texte);
  border: 1px solid var(--bord-fort);
  border-radius: 7px;
  font-family: inherit;
}
.champ-note::placeholder { color: var(--texte-doux); opacity: .7; }
/* Un rush fini reste visible mais recule : il n'attend plus rien de personne
   tant qu'on ne l'a pas rendu. */
.rush-fini .vod-dossier, .rush-fini td:first-child { opacity: .6; }
.badge.equipe { border-color: var(--ok); color: var(--ok); }
/* Une attribution marquée finie : le travail est fait, il attend juste d'être
   rendu. Assez visible pour se repérer, pas assez pour crier. */
.vod-qui button.fini { border-color: var(--ok); color: var(--ok); }

/* ---------- Fiche d'un collaborateur, dans les réglages de l'espace ----------
   Une carte par personne : sa part de place et ses quatre droits. Un tableau
   aurait tassé quatre cases à cocher dans une cellule illisible. */
.fiche-membre {
  background: var(--fond); border: 1px solid var(--bord); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
}
.fiche-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fiche-reglages { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.fiche-cases { display: flex; flex-wrap: wrap; gap: 4px 14px; flex: 1; min-width: 220px; font-size: .82rem; }
.fiche-cases label { display: flex; align-items: center; gap: 5px; color: var(--texte-doux); }
.fiche-cases input { width: auto; margin: 0; }

/* Une émission multipistes rangée dans un dossier : la ligne d'en-tête la
   distingue de ses pistes, pour qu'on voie ce qui s'attribue d'un bloc. */
.ligne-dossier td { background: var(--fond-2); }
.dossier-tete { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ===========================================================================
   Le téléphone.

   La barre du haut porte jusqu'à cinq boutons selon la page et les droits :
   sur un écran étroit, ça déborde sur deux lignes et plus rien ne se lit. On
   les range derrière un bouton flottant, en bas à droite, là où le pouce
   arrive sans changer de main.

   Le seuil est à 860 px et pas 600 : entre les deux, la barre tient encore
   mais les tableaux, eux, sont déjà à l'étroit.
   =========================================================================== */

.menu-bouton { display: none; }

@media (max-width: 860px) {
  .barre .barre-droite { display: none; }
  .barre { padding: 10px 16px; }
  .contenu { padding: 20px 14px 90px; }

  /* Les tableaux ne se compriment pas : ils défilent. Un tableau écrasé sur
     320 px met un mot par ligne, ce qui est pire qu'un défilement latéral. */
  .enveloppe-tableau { -webkit-overflow-scrolling: touch; }
  .enveloppe-tableau .tableau { min-width: 640px; }

  /* Le panneau de téléchargement remonte : sinon il s'assoit sur le bouton. */
  .tele-panneau { bottom: 88px; right: 14px; }

  /* Les fenêtres prennent l'écran : une fenêtre centrée avec des marges sur un
     téléphone, c'est de la place perdue là où il n'y en a pas. */
  .voile { padding: 0; align-items: flex-end; }
  .fenetre {
    width: 100%; max-width: none; max-height: 92vh;
    border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .menu-bouton {
    display: flex; align-items: center; justify-content: center;
    position: fixed; z-index: 60;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%;
    border: none; cursor: pointer;
    background: var(--accent-degrade);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .3);
    -webkit-tap-highlight-color: transparent;
  }
  .menu-bouton:active { transform: scale(.94); }

  .menu-barres { display: flex; flex-direction: column; gap: 5px; }
  .menu-barres i {
    display: block; width: 22px; height: 3px; border-radius: 2px;
    background: #17181a; transition: transform .18s ease, opacity .18s ease;
  }
  /* Les trois barres deviennent une croix : on sait qu'on peut refermer. */
  .menu-bouton.ouvert .menu-barres i:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .menu-bouton.ouvert .menu-barres i:nth-child(2) { opacity: 0; }
  .menu-bouton.ouvert .menu-barres i:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  .menu-voile {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(0, 0, 0, .66);
    display: flex; align-items: flex-end; justify-content: flex-end;
    padding: 0 max(14px, env(safe-area-inset-right)) 84px max(14px, env(safe-area-inset-left));
  }
  .menu-panneau {
    display: flex; flex-direction: column; gap: 2px;
    background: var(--panneau); border: 1px solid var(--bord-fort);
    border-radius: 16px; padding: 8px; min-width: 210px; max-width: 88vw;
    box-shadow: var(--ombre);
  }
  .menu-panneau a, .menu-panneau button {
    display: block; text-align: left; width: 100%;
    color: var(--texte); text-decoration: none;
    font: inherit; font-size: 1rem; font-weight: 600;
    padding: 13px 16px; border-radius: 11px;
    background: none; border: none; cursor: pointer;
  }
  .menu-panneau a:active, .menu-panneau button:active { background: var(--panneau-2); }
  .menu-panneau a.actif { background: rgba(255, 138, 92, .14); color: var(--accent); }
  .menu-qui {
    padding: 8px 16px 10px; margin-bottom: 4px;
    border-bottom: 1px solid var(--bord);
    color: var(--texte-doux); font-size: .84rem;
  }

  /* Les entêtes de page : titre et boutons empilés plutôt que serrés. */
  .grille { grid-template-columns: 1fr; }
  .duo { grid-template-columns: 1fr; }
  .barre-action { flex-direction: column; align-items: stretch; }
  .barre-action select { max-width: none; flex: none; }
  .fiche-reglages { flex-direction: column; align-items: stretch; }
  .fiche-reglages .champ { max-width: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .menu-barres i { transition: none; }
  .menu-bouton:active { transform: none; }
}

@media (max-width: 860px) {
  /* La page de révision n'a pas de .contenu : c'est le panneau de commentaires
     qui doit laisser passer le bouton flottant. */
  .panneau-comm { padding-bottom: 84px; }
}

/* ---------- Un tableau qui devient des cartes sur téléphone ----------
   Le tableau de la vidéothèque porte cinq colonnes : sur un écran étroit, le
   faire défiler latéralement cache justement le bouton « Télécharger », qui
   est la seule chose qu'un monteur vient y chercher. On l'empile donc.

   Réservé à cette table : la console, elle, se consulte sur un ordinateur, et
   un défilement latéral y est acceptable. */
@media (max-width: 620px) {
  .enveloppe-tableau .cartes-tel { min-width: 0; }
  .cartes-tel thead { display: none; }
  .cartes-tel, .cartes-tel tbody, .cartes-tel tr, .cartes-tel td { display: block; width: 100%; }
  .cartes-tel tr { padding: 12px 14px; border-bottom: 1px solid var(--bord); }
  .cartes-tel tr:last-child { border-bottom: none; }
  .cartes-tel td, .cartes-tel td.num { border: none; padding: 4px 0; text-align: left; }
  /* Le libellé de colonne revient devant la valeur : sans l'entête, « 2.9 Mo »
     tout seul ne dit pas de quoi il parle. */
  .cartes-tel td[data-libelle]::before {
    content: attr(data-libelle);
    display: block; margin-bottom: 3px;
    font-size: .68rem; letter-spacing: .05em; text-transform: uppercase;
    color: var(--texte-doux);
  }
  .cartes-tel td:first-child { font-weight: 600; padding-bottom: 8px; }
  .cartes-tel td:last-child { padding-top: 10px; display: flex; gap: 8px; }
  .cartes-tel td:last-child .btn { flex: 1; }
  .cartes-tel .select-etat, .cartes-tel .champ-note { max-width: none; }
}
/* Les boutons d'une ligne : un écart tenu par la mise en page, pas par une
   marge posée sur le second bouton — sur téléphone la cellule devient une
   pile, et la marge latérale n'y voulait plus rien dire. */
.cellule-actions { display: flex; gap: 6px; align-items: center; }

/* L'aperçu de la couverture choisie, avant envoi. */
.apercu-couverture {
  display: block; width: 100%; max-height: 180px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--bord); margin-top: 4px;
}
input[type=file] {
  width: 100%; padding: 8px 10px; font-size: .84rem;
  background: var(--fond); color: var(--texte-doux);
  border: 1px dashed var(--bord-fort); border-radius: 9px;
}

/* ===========================================================================
   Les vignettes proposées au client.

   Une grille d'images, et une fenêtre où l'on dessine dessus. C'est le même
   aller-retour que sur une vidéo, en plus court : pas de ligne de temps, une
   image fixe n'en a pas.
   =========================================================================== */

.grille-vignettes {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px;
}
.vignette-carte {
  position: relative; padding: 0; overflow: hidden; text-align: left; cursor: pointer;
  background: var(--panneau); border: 1px solid var(--bord); border-radius: var(--rayon);
  font: inherit; color: var(--texte);
  transition: border-color .15s, transform .15s;
}
.vignette-carte:hover { border-color: var(--bord-fort); transform: translateY(-2px); }
.vignette-carte.preferee { border-color: var(--accent); }
.vignette-carte img {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  background: var(--fond);
}
.vignette-bas {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; font-size: .84rem;
}
.vignette-bas span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vignette-etoile {
  position: absolute; top: 8px; left: 10px; z-index: 2;
  color: var(--accent); font-size: 1.1rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}
/* Le nombre de retours en attente : c'est ce qu'on cherche des yeux dans une
   grille de six propositions. */
.pastille {
  flex: 0 0 auto; min-width: 20px; text-align: center;
  background: var(--accent); color: #17181a;
  border-radius: 999px; padding: 1px 7px; font-size: .74rem; font-weight: 700;
}
.pastille.faite { background: none; color: var(--ok); font-size: .9rem; padding: 0; }

/* ---------- La fenêtre d'une vignette ---------- */
.fenetre-large { width: min(980px, 100%); }
.vg-corps { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
@media (max-width: 820px) { .vg-corps { grid-template-columns: 1fr; } }

.vg-scene {
  position: relative; background: var(--fond);
  border: 1px solid var(--bord); border-radius: 10px; overflow: hidden;
  line-height: 0;
}
.vg-scene img#vg-img { display: block; width: 100%; height: auto; }
/* La toile et le calque se superposent exactement à l'image affichée. Le
   calque ne prend aucun clic : il montre le dessin de quelqu'un d'autre, on ne
   dessine pas dessus. */
.vg-scene canvas, .vg-scene #vg-calque {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.vg-scene canvas { cursor: crosshair; touch-action: none; }
.vg-scene #vg-calque { pointer-events: none; object-fit: fill; }

.vg-outils { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.vg-cote { display: flex; flex-direction: column; gap: 10px; min-height: 260px; }
.vg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vg-avis { flex: 1; overflow-y: auto; max-height: 340px; display: flex; flex-direction: column; gap: 8px; }
.vg-avis-un {
  background: var(--fond); border: 1px solid var(--bord);
  border-radius: 9px; padding: 9px 11px;
}
.vg-avis-un.resolu { opacity: .55; }
.vg-avis-haut { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.vg-avis-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.vg-saisie { display: flex; flex-direction: column; gap: 7px; }

/* ---------- La bulle d aide ----------
   Un rond « ? » qui garde l explication au chaud. Les fenêtres de réglages
   portaient des paragraphes entiers : on les lit une fois, puis ils encombrent.

   La bulle s ouvre au survol ET au focus clavier : sur un écran tactile il n y
   a pas de survol, mais une tape donne le focus, et le rond répond quand même. */
.aide {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; flex: 0 0 auto;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--panneau-2); border: 1px solid var(--bord-fort);
  color: var(--texte-doux); font-size: .68rem; font-weight: 700;
  cursor: help; user-select: none; vertical-align: middle;
}
.aide:hover, .aide:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }

.aide-bulle {
  position: absolute; z-index: 40;
  top: calc(100% + 7px); left: -8px;
  width: max-content; max-width: min(280px, 62vw);
  padding: 9px 12px;
  background: var(--fond-2); border: 1px solid var(--bord-fort);
  border-radius: 9px; box-shadow: var(--ombre);
  color: var(--texte-doux); font-size: .8rem; font-weight: 400;
  line-height: 1.5; text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; transition: opacity .12s ease;
  pointer-events: none;
}
.aide:hover .aide-bulle, .aide:focus .aide-bulle, .aide:focus-within .aide-bulle {
  opacity: 1; visibility: visible;
}
/* Près du bord droit d une fenêtre, la bulle sort du cadre et se fait rogner.
   Cette variante l accroche à droite du rond. */
.aide.a-gauche .aide-bulle { left: auto; right: -8px; }

/* Le titre d un bloc et son rond sur la même ligne. */
.titre-aide { display: flex; align-items: center; gap: 7px; }

@media (prefers-reduced-motion: reduce) { .aide-bulle { transition: none; } }

/* Le retour au projet, en tête du lecteur : un nom de projet long ne doit pas
   pousser le reste de la barre hors de l'écran. */
#lien-projet { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
