:root {
  /* --- Accent et fond de header : personnalisables par client (voir app.js → appliquerConfig) --- */
  --couleur-primaire: #c8102e;
  --couleur-accent: #1c1b19;

  /* --- Base fixe du système "Angle Droit" : ne change jamais par client --- */
  --fond: #f6f4f1;
  --carte: #ffffff;
  --texte: #1c1b19;
  --texte-clair: #6f6a64;
  --bordure: #dad5ce;
  --bordure-forte: #b9b3aa;

  /* Fond du fil de discussion (guide uniquement) — légèrement anthracite,
     pour le distinguer du fond général de l'appli et faire ressortir les
     bulles (blanches côté bot, sombres côté employé) posées dessus. */
  --fond-discussion: #23262b;
  --bordure-discussion: rgba(255, 255, 255, 0.1);

  /* --- Statuts fonctionnels : fixes, indépendants de l'accent du client --- */
  --statut-ok: #3f6b4e;
  --statut-attention: #8a5a12;
  --statut-critique: #c8102e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { overflow-wrap: anywhere; }
.header-titre, .header-titre > div, .header-actions, .zone-utilisateur,
.msg, .bulle, .form-demande-procedure { min-width: 0; }
button, .chip, .badge-categorie, .badge-importance { max-width: 100%; overflow-wrap: anywhere; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select { min-width: 0; max-width: 100%; }

html, body { height: 100%; }
/* 1.0.10 (test Mac d'Ethan) : plus d'effet « élastique » de macOS quand on
   fait défiler une page qui n'a rien à faire défiler (accueil, fenêtre
   application) — avant, réservé aux téléphones (voir verre.css). */
html, body { overscroll-behavior: none; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Cadre de l'appli guide : une colonne étroite façon "chatbox", posée sur le
   fond de page plutôt que de l'occuper entièrement — pensée pour une petite
   fenêtre dédiée (voir lancer-guide.bat) tout en restant correcte dans un
   onglet de navigateur classique. Le tableau de bord et la page de connexion
   n'utilisent pas ce conteneur et gardent leur largeur actuelle. */
.app-shell {
  align-self: center;
  width: 100%;
  max-width: 420px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--carte);
  border-left: 1px solid var(--bordure);
  border-right: 1px solid var(--bordure);
}

.app-shell .header-inner,
.app-shell .categories-bar,
.app-shell .chat,
.app-shell .erreur-chargement,
.app-shell .composer-inner {
  max-width: none;
}

.app-header {
  flex-shrink: 0;
  background: var(--couleur-accent);
  color: white;
  padding: 20px 16px 14px;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 10px;
  gap: 16px;
}

.header-inner > .header-titre {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 auto;
}

.logo { height: 48px; width: auto; border-radius: 0; }

.app-header h1 { margin: 0; font-size: 1.3rem; font-weight: 600; }
.subtitle { margin: 4px 0 0; color: rgba(255, 255, 255, 0.62); font-size: 0.9rem; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-left: auto;
}

.zone-utilisateur {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

/* Boutons de navigation du header (retour au guide / tableau de bord /
   déconnexion) : même gabarit pour les deux, "remplis" (fond clair
   translucide) plutôt que vides, pour bien les distinguer des chips de
   catégorie et des autres éléments du header. */
.lien-deconnexion,
.lien-dashboard {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  text-decoration: none;
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 0;
  white-space: nowrap;
  cursor: pointer;
}
.lien-deconnexion:hover,
.lien-dashboard:hover { background: rgba(255, 255, 255, 0.26); border-color: rgba(255, 255, 255, 0.6); }

.categories-bar {
  max-width: 720px;
  margin: 14px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 14px;
  border-radius: 0;
  border: 1px solid var(--bordure);
  background: white;
  color: var(--texte);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { border-color: var(--couleur-primaire); color: var(--couleur-primaire); }

.bouton-joindre { padding: 9px 12px; }
.fichier-joint-chat {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--bordure);
  background: var(--fond);
  color: var(--texte-clair);
  font-size: .82rem;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.fichier-joint-chat strong { color: var(--texte); }
.procedure-importee { border-top: 1px solid var(--bordure); margin-top: 12px; padding-top: 8px; }
.procedure-importee h3 { font-size: .95rem; margin: 0 0 8px; }
.procedure-importee ol { padding-left: 22px; }
.procedure-importee-boutons { display: flex; gap: 8px; margin-top: 8px; }
.fichier-joint-chat img { width: 100%; max-height: 180px; object-fit: contain; margin-top: 4px; background: #fff; }

.chip-categorie {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: white;
}
.chip-categorie:hover { background: rgba(255, 255, 255, 0.18); color: white; }

.container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 8px;
  /* Aligne la largeur de lecture sur celle du header (.header-inner,
     max-width: 720px) pour une structure cohérente entre la page d'accueil
     (où .app-shell limite de toute façon à 420px, donc sans effet ici) et le
     tableau de bord (qui n'a pas de .app-shell et s'étirait bord à bord). */
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

/* Fond légèrement anthracite derrière le fil de discussion du guide — voir
   --fond-discussion. Scopé à .app-shell (le guide) uniquement : le tableau
   de bord garde son fond clair habituel derrière ses propres cartes. */
.app-shell .container { background: var(--fond-discussion); }
.app-shell .composer {
  background: var(--fond-discussion);
  border-top: 1px solid var(--bordure-discussion);
}

.erreur-chargement {
  max-width: 720px;
  margin: 0 auto 20px;
  color: var(--statut-critique);
  background: rgba(200, 16, 46, 0.06);
  border: 1px solid rgba(200, 16, 46, 0.3);
  border-radius: 0;
  padding: 16px;
  line-height: 1.5;
}
.erreur-chargement code {
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  background: rgba(200, 16, 46, 0.1);
  padding: 1px 6px;
  border-radius: 0;
}
.erreur-chargement a { color: var(--statut-critique); font-weight: 600; }

/* --- Légende des niveaux d'importance / d'accès --- */

.legende-importance {
  max-width: 720px;
  margin: 0 auto 16px;
  border: 1px solid var(--bordure);
  background: var(--carte);
  font-size: 0.85rem;
}
.legende-importance summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--texte-clair);
  list-style: none;
}
.legende-importance summary::-webkit-details-marker { display: none; }
.legende-importance summary::before { content: "▾ "; color: #FF0000; }
.legende-importance:not([open]) summary::before { content: "▸ "; }
.legende-importance ul {
  margin: 0;
  padding: 2px 14px 14px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legende-importance li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1.45;
}
.legende-importance li .badge-importance { flex-shrink: 0; }

/* --- Fil de discussion --- */

.chat {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg { display: flex; max-width: 100%; }
.msg.bot { justify-content: flex-start; }
.msg.user { justify-content: flex-end; }

.bulle {
  max-width: 82%;
  border-radius: 0;
  padding: 13px 16px;
  font-size: 0.94rem;
  line-height: 1.55;
}

.msg.bot .bulle {
  background: var(--carte);
  border: 1px solid var(--bordure);
}

.msg.user .bulle {
  background: var(--couleur-accent);
  color: white;
  border: 1px solid var(--couleur-accent);
}

.reponse-titre {
  font-weight: 600;
  font-size: 1.02rem;
  margin: 8px 0 4px;
}

.reponse-resume { margin: 0; color: var(--texte-clair); }
.bouton-micro { width: 42px; height: 42px; padding: 9px; display: inline-flex; align-items: center; justify-content: center; }
.bouton-micro svg { width: 22px; height: 22px; }
.point-enregistrement { width: 13px; height: 13px; border-radius: 50%; background: var(--statut-critique); box-shadow: 0 0 0 5px color-mix(in srgb, var(--statut-critique) 18%, transparent); }

.reponse-modifie-le {
  margin: 6px 0 0;
  font-size: 0.76rem;
  color: var(--texte-clair);
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

.badges-carte {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-categorie,
.badge-importance {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 0;
  border: 1px solid currentColor;
  background: transparent;
}

.badge-categorie { color: var(--couleur-primaire); }

.badge-importance-mineure { color: var(--statut-ok); }
.badge-importance-moyenne { color: var(--statut-attention); }
.badge-importance-critique { color: var(--statut-critique); }

.suggestions-intro { margin: 0 0 8px; color: var(--texte-clair); font-size: 0.88rem; }
/* « Il manque une procédure ? » (27.09.2026) : la question est le message
   lui-même, donc en texte normal ; la réponse choisie reste visible. */
.question-procedure-manquante .suggestions-intro { color: inherit; font-size: inherit; margin-bottom: 12px; }
.question-procedure-manquante .chip:disabled { opacity: .55; cursor: default; }
.question-procedure-manquante .chip.selectionne:disabled { opacity: 1; color: #000; box-shadow: inset 0 0 0 1.5px #FF0000; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }

.chip-proposer,
.chip-admin {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-weight: 600;
}
.chip-proposer:hover,
.chip-admin:hover { background: rgba(255, 255, 255, 0.18); color: white; border-color: rgba(255, 255, 255, 0.55); }

/* --- Console d'administration dans le fil de discussion --- */

.chip-danger { border-color: var(--statut-critique); color: var(--statut-critique); }
.chip-danger:hover { background: rgba(200, 16, 46, 0.08); }

.chip-lecture-seule { cursor: default; }
.chip-lecture-seule:hover { border-color: var(--bordure); color: var(--texte); }

.historique-liste-chat {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 0.88rem;
  line-height: 1.7;
}
.historique-liste-chat li { margin-bottom: 6px; }
.historique-liste-chat button.chip {
  padding: 3px 10px;
  font-size: 0.76rem;
  margin-left: 4px;
  vertical-align: middle;
}

.form-demande-procedure select {
  font: inherit;
  font-family: "IBM Plex Sans", sans-serif;
  padding: 8px 10px;
  border: 1px solid var(--bordure-forte);
  border-radius: 0;
  background: white;
  color: var(--texte);
}
.form-demande-procedure select:focus { outline: 2px solid var(--couleur-primaire); outline-offset: -1px; }

.choix-importance-chat {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.choix-importance-chat label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  font-weight: 400;
}

/* --- Formulaire de demande de création de procédure (accès standard) --- */

.form-demande-procedure {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.form-demande-procedure label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
}
.form-demande-procedure label span { font-weight: 600; }
.form-demande-procedure input,
.form-demande-procedure textarea {
  font: inherit;
  font-family: "IBM Plex Sans", sans-serif;
  padding: 8px 10px;
  border: 1px solid var(--bordure-forte);
  border-radius: 0;
  background: white;
  color: var(--texte);
}
.form-demande-procedure input:focus,
.form-demande-procedure textarea:focus { outline: 2px solid var(--couleur-primaire); outline-offset: -1px; }
.form-demande-procedure textarea { resize: vertical; }
.form-demande-procedure button {
  align-self: flex-start;
}
.form-demande-procedure button:disabled { opacity: 0.6; cursor: default; }

.confirmation-demande { color: var(--statut-ok); font-weight: 600; margin: 0; }

.modal-piece-jointe { margin: 6px 0 0; }
.modal-piece-jointe a {
  color: var(--couleur-primaire);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}
.modal-piece-jointe a:hover { text-decoration: underline; }

/* Planning de l'équipe (23.09.2026, à la demande de David) : carte affichée
   dans la conversation quand un employé demande « voir le planning » (voir
   construireCartePlanning dans app.js). Vignette cliquable pour une image ou
   un PDF (ouvre la visionneuse plein écran ci-dessous), simple fiche fichier
   pour un Excel (aucun aperçu possible sans bibliothèque dédiée). */
.carte-planning {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 6px;
  max-width: 320px;
}
.carte-planning-vignette {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  border: 1px solid var(--bordure, #D5D5D5);
  border-radius: 6px;
  background: #fff;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
  display: grid;
  place-items: center;
  font: 700 13px 'IBM Plex Mono', monospace;
  color: var(--texte-clair, #6F6A64);
}
.carte-planning-vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carte-planning-vignette-pdf { color: var(--statut-critique, #FF0000); }
.carte-planning-vignette-fichier { cursor: default; }
.carte-planning-infos { min-width: 0; }
.carte-planning-nom { margin: 0 0 2px; font-weight: 600; font-size: 0.9rem; word-break: break-word; }
.carte-planning-details { margin: 0 0 8px; font-size: 0.8rem; color: var(--texte-clair, #6F6A64); }
.carte-planning-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Historique des versions précédentes d'un planning (23.09.2026) : liste
   dépliable sous les actions de la carte, chargée à la demande — voir
   construireCartePlanning / construireLignePlanningAnterieur dans app.js. */
.carte-planning-historique {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--bordure, #E6E1D8);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--texte-clair, #6F6A64);
}
.carte-planning-historique-ligne {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.carte-planning-historique-ligne .carte-planning-actions { gap: 6px; }

/* Visionneuse plein écran (23.09.2026) : superposition par-dessus toute la
   conversation, pour « mettre l'image en grand » comme demandé par Ethan.
   Réutilisable pour tout aperçu futur, pas seulement le planning — voir
   ouvrirVisionneuse()/fermerVisionneuse() dans app.js. */
.visionneuse-fond {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
}
.visionneuse-barre {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #fff;
}
.visionneuse-titre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.visionneuse-barre .chip { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.visionneuse-barre .chip:hover { background: rgba(255, 255, 255, 0.22); }
.visionneuse-fermer {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
.visionneuse-fermer:hover { background: rgba(255, 255, 255, 0.22); }
.visionneuse-contenu {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px 16px;
}
.visionneuse-contenu img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.visionneuse-contenu iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 4px; }

.checklist { padding-left: 20px; margin: 14px 0 0; }
.checklist li { margin-bottom: 12px; padding-left: 4px; }
.checklist input[type="checkbox"] { margin-right: 8px; }
.checklist li.coche span { text-decoration: line-through; color: var(--texte-clair); }

.feedback {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--bordure);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--texte-clair);
}

.btn-feedback {
  border: 1px solid var(--bordure);
  background: white;
  border-radius: 0;
  padding: 6px 10px;
  cursor: pointer;
}
.btn-feedback.selectionne { border-color: var(--couleur-primaire); color: var(--couleur-primaire); }

.feedback-merci { color: var(--statut-ok); font-weight: 600; }

/* --- Zone de saisie --- */

.composer {
  flex-shrink: 0;
  border-top: 1px solid var(--bordure);
  background: var(--fond);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.composer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
}

#question {
  min-width: 0;
  width: 100%;
  flex: 1;
  padding: 12px 14px;
  border-radius: 0;
  border: 1px solid var(--bordure-forte);
  background: white;
  color: var(--texte);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.95rem;
}
#question:focus { outline: 2px solid var(--couleur-primaire); outline-offset: -1px; }

#envoyer {
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid var(--couleur-accent);
  border-radius: 0;
  padding: 0 18px;
  background: var(--couleur-accent);
  color: white;
  cursor: pointer;
}
#envoyer:hover { background: var(--couleur-primaire); border-color: var(--couleur-primaire); }

.admin-message, .admin-message .bulle { width: 100%; max-width: 100%; }
.assistant-entete { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:.78rem; color:var(--texte-clair); margin-bottom:12px; }
.assistant-entete .chip { font-size:.75rem; padding:6px 8px; }
.proposition-ia { border-left:3px solid var(--couleur-accent); background:#f5f5ef; padding:14px; margin:12px 0; color:#242421; }
.proposition-ia ul { padding-left:20px; }
.proposition-ia li, .resultats-ia li { margin:7px 0; overflow-wrap:anywhere; white-space:pre-wrap; }
.proposition-ia button { margin:5px 8px 0 0; }
.proposition-ia .confirmer-ia { background:var(--couleur-primaire); color:white; }
.proposition-edition { display:flex; flex-direction:column; gap:10px; margin:6px 0 4px; }
.proposition-edition label { display:flex; flex-direction:column; gap:4px; font-size:.85rem; font-weight:600; color:var(--texte-clair); }
.proposition-edition input, .proposition-edition textarea, .proposition-edition select { font:inherit; padding:8px 10px; border:1px solid var(--bordure); border-radius:6px; background:white; color:var(--texte); width:100%; box-sizing:border-box; }
.proposition-edition textarea { resize:vertical; min-height:80px; white-space:pre; }
.resultats-ia { max-height:48vh; overflow:auto; padding-left:20px; }
.secret-ia { border:1px solid var(--bordure); padding:12px; overflow-wrap:anywhere; }
.secret-ia code { display:block; margin:10px 0; }
.composer-inner { flex-wrap:wrap; }
#question { resize:vertical; min-height:48px; max-height:160px; flex-basis:60%; }
.composer-inner #dicter,.composer-inner #joindre-media { font-size:.75rem; padding:6px; }
button:disabled { cursor:wait; opacity:.55; }
.admin-message .bulle { padding: 8px; }
.admin-commandes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.admin-cadre { width: 100%; height: 65vh; min-height: 280px; border: 0; background: var(--carte); }
.admin-commandes select { flex: 1; padding: 8px; background: white; color: var(--texte); }
.gestion-ouverte .categories-bar, .gestion-ouverte .legende-importance,
.gestion-ouverte .msg:not(.admin-message), .gestion-ouverte #lien-dashboard { display: none; }
.gestion-ouverte .container { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.gestion-ouverte #chat, .gestion-ouverte .admin-message, .gestion-ouverte .bulle,
.gestion-ouverte #gestion-admin-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; max-width: 100%; }
.gestion-ouverte .admin-cadre { flex: 1; min-height: 0; height: 100%; }
.gestion-ouverte .admin-commandes { flex-shrink: 0; }
.categories-bar { display: none !important; }
@media (max-width: 480px) {
  .app-header { padding: 14px 12px; }
  .header-inner { gap: 10px; }
  .header-actions { width: 100%; margin-left: 0; gap: 8px; }
  .zone-utilisateur { flex-wrap: wrap; white-space: normal; }
  .lien-dashboard, .chip { white-space: normal; }
  .container { padding: 12px 10px 8px; }
  .bulle { max-width: 95%; padding: 12px; }
  .composer { padding-left: 10px; padding-right: 10px; }
  #envoyer { flex-shrink: 0; padding: 0 10px; }
  .logo { max-width: 80px; object-fit: contain; }
}

/* Guide compact : accueil et conversation partagent le même composer. */
body.interface-refonte {
  --couleur-primaire: #000; --couleur-accent: #000; --fond: #fff; --carte: #fff;
  --texte: #000; --texte-clair: #6F6A64; --bordure: #D5D5D5; --bordure-forte: #C7C7C7;
  --statut-ok: #000; --statut-attention: #6F6A64; --statut-critique: #FF0000;
  background: #fff; color: #000; min-width: 0;
}
.interface-refonte .app-header { background: #fff; color: #000; padding: 16px 20px; border-bottom: 1px solid #D5D5D5; }
.interface-refonte .header-inner { flex-wrap: nowrap; gap: 12px; }
.interface-refonte .app-header h1 { font-size: 16px; line-height: 1.35; letter-spacing: .02em; }
.interface-refonte .subtitle { color: #6F6A64; font-size: 12px; }
.interface-refonte .header-actions { flex-wrap: nowrap; width: auto; margin-left: auto; gap: 8px; }
.interface-refonte .zone-utilisateur { color: #6F6A64; }
.interface-refonte #nom-utilisateur-affiche { display: none; }
.interface-refonte .lien-dashboard, .interface-refonte .lien-deconnexion { background: #fff; color: #000; border: 1px solid #D0D0D0; border-radius: 100px; width: 34px; height: 34px; padding: 7px; flex-shrink: 0; }
.interface-refonte .header-actions svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.interface-refonte .badge-importance { font-size: 10px; border-color: #D0D0D0; color: #000; }
.interface-refonte .badge-importance-moyenne, .interface-refonte .badge-importance-critique { border-color: #FF0000; color: #FF0000; background: #fff; }
.interface-refonte .erreur-chargement { background: #fff; border-color: #D5D5D5; color: #000; }
.interface-refonte :focus-visible { outline: 2px solid #6F6A64; outline-offset: 3px; }
body:has(.guide-refonte) { background: #fff; color: #000; }
.guide-refonte {
  --couleur-primaire: #000; --couleur-accent: #000; --fond: #fff; --carte: #fff;
  --texte: #000; --texte-clair: #6F6A64; --bordure: #D5D5D5; --bordure-forte: #C7C7C7;
  --statut-ok: #000; --statut-attention: #6F6A64; --statut-critique: #FF0000;
  position: relative; isolation: isolate; max-width: 480px; width: 100%;
  height: 100dvh; min-height: 480px; flex: none; border: 1px solid #D8D8D8;
  overflow: hidden; background: #fff;
}
.guide-refonte > :not(.accueil-vortex) { position: relative; z-index: 1; }
/* Décor d'accueil (22.09.2026, nuit) : remplace l'ancien décor statique de
   points rouges par une animation de vortex de particules d'ALEEX, pilotée
   par un faux défilement — voir jouerVortexAccueil() dans app.js. Depuis le
   23.09.2026, c'est l'export officiel du site vitrine (iframe isolée, voir
   /aleex-animation-ipad/) plutôt qu'un canvas dessiné directement ici — ce
   conteneur reste donc un simple <div> (l'iframe interne prend width/height
   100% et hérite de son dimensionnement/style ci-dessous). Masqué dès
   qu'une conversation démarre, voir plus bas.
   Retour d'Ethan (22.09, nuit) : couvre désormais toute la hauteur de
   l'écran d'accueil (et non plus seulement les 30% du bas), en arrière-plan
   de tous les éléments (en-tête, titre, zone de chat, barre de saisie —
   chacun garde son propre fond, opaque ou transparent selon l'élément, donc
   le vortex n'apparaît qu'à travers les zones sans fond opaque).
   Voir aussi .accueil-raccourcis ci-dessous, remonté juste sous la barre de
   recherche pour libérer le reste de la hauteur à l'animation. */
.guide-refonte .accueil-vortex { position:absolute; inset:0; width:100%; height:100%; z-index:0; pointer-events:none; display:block; }
.guide-refonte .app-header { height: 60px; flex: 0 0 60px; padding: 0 20px; background: #fff; color: #000; border-bottom: 1px solid #D5D5D5; }
.guide-refonte .header-inner { height: 100%; flex-wrap: nowrap; gap: 8px; }
.guide-refonte .header-titre { gap: 0; }
.guide-refonte .header-titre > div, .guide-refonte #logo, .guide-refonte #nom-utilisateur-affiche { display: none; }
.marque-guide { display: flex; align-items: center; gap: 9px; font-size: 14.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.marque-guide i { width: 9px; height: 9px; background: #FF0000; border-radius: 100px; }
/* Logo ALEEX (23.09.2026) : remplace le point rouge + « PROCÉDURES » en tête de l'accueil. */
.marque-guide .logo-aleex { display: block; height: 22px; width: auto; }
/* Version (1.11.13) : discrète, à côté du logo. */
.marque-guide .version-aleex { align-self: flex-end; font-size: 10px; font-weight: 400; letter-spacing: 0; opacity: .45; line-height: 1; }
.guide-refonte .header-actions { width: auto; margin-left: auto; gap: 8px; flex-wrap: nowrap; }
.guide-refonte .zone-utilisateur { order: 2; }
.guide-refonte .lien-dashboard, .guide-refonte .lien-deconnexion { width: 34px; height: 34px; padding: 7px; border: 1px solid #D0D0D0; border-radius: 100px; background: #fff; color: #000; }
.guide-refonte svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
/* Retour d'Ethan (22.09, nuit) : ne se centre plus verticalement dans
   l'espace disponible (l'ancien "margin-top: auto" poussait tout le
   contenu, bouton et légende compris, vers le bas) — reste compact juste
   sous l'en-tête, pour laisser toute la hauteur restante à l'animation du
   vortex derrière le composer et les boutons (voir .accueil-raccourcis). */
.guide-refonte .accueil-titre { font-size: 24px; font-weight: 600; line-height: 1.35; text-align: center; margin: 0 32px 24px; padding-top: 30px; }
.guide-refonte:not(:has(#chat .msg)) .container { flex: none; padding: 0; overflow: visible; }
.guide-refonte:not(:has(#chat .msg)) .assistant-entete { display: none; }
.guide-refonte .container { background: #fff; padding: 16px; min-height: 0; }
.guide-refonte .composer { padding: 0 32px 14px; background: transparent; border: 0; }
.guide-refonte .composer-inner { display: grid; grid-template-columns: minmax(0,1fr) 54px; gap: 8px; }
.guide-refonte .saisie-pilule { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 16px; border: 1px solid #C7C7C7; border-radius: 100px; background: #fff; min-width: 0; }
.guide-refonte .icone-recherche { color: #6F6A64; }
.guide-refonte #question { min-height: 0; height: 36px; max-height: 36px; line-height: 20px; padding: 8px 0; font-size: 14px; flex: 1; border: 0; outline: none; resize: none; background: transparent; border-radius: 0; }
.guide-refonte #question::placeholder { color: #6F6A64; opacity: 1; }
.guide-refonte .saisie-pilule:focus-within { outline: 2px solid #6F6A64; outline-offset: 2px; }
.guide-refonte #envoyer { grid-row: 1; grid-column: 2; border: 0; background: #FF0000; color: #fff; width: 54px; height: 54px; border-radius: 100px; padding: 15px; display: grid; place-items: center; }
.guide-refonte #envoyer svg { width: 24px; height: 24px; }
.guide-refonte #dicter, .guide-refonte #joindre-media { grid-row: 2; grid-column: 1; width: 32px; height: 32px; padding: 6px; border: 1px solid #D0D0D0; border-radius: 100px; background: #fff; color: #6F6A64; display: grid; place-items: center; }
.guide-refonte #dicter { margin-left: 40px; }
/* Remonté juste sous la barre de recherche (22.09, nuit, retour d'Ethan) :
   n'absorbe plus l'espace restant ("margin-bottom: auto" supprimé) pour
   libérer toute la hauteur en dessous à l'animation du vortex en
   arrière-plan, au lieu de risquer de recouvrir le slogan formé en fin de
   parcours (surtout côté admin, dont la liste de boutons est plus longue). */
.guide-refonte .accueil-raccourcis { padding: 0 32px 30px; }
/* Grille plutôt qu'une ligne centrée à largeur libre : avant, chaque bouton
   avait sa propre largeur et les rangées repliées (flex-wrap) étaient
   centrées indépendamment les unes des autres, ce qui décalait les bords
   d'une rangée à l'autre. En grille, chaque colonne a la même largeur sur
   toute la hauteur : les bords s'alignent, et auto-fit ajoute des colonnes
   quand la fenêtre est large ou n'en garde qu'une ou deux dans une fenêtre
   étroite (format portrait/passeport), sans espace perdu sur les côtés. */
.guide-refonte .suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.guide-refonte .suggestions .chip { width: 100%; box-sizing: border-box; text-align: center; }
.guide-refonte .chip { border: 1px solid #D0D0D0; border-radius: 100px; padding: 8px 14px; background: #fff; color: #000; font-family: 'IBM Plex Sans', sans-serif; font-size: 12.5px; }
.guide-refonte .chip:hover, .guide-refonte .lien-dashboard:hover, .guide-refonte .lien-deconnexion:hover { background: #F6F4F1; border-color: #B9B3AA; }
.legende-compacte { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 16px; margin: 24px 0 14px; font: 10.5px 'IBM Plex Mono', monospace; color: #6F6A64; }
.legende-compacte span { display: flex; align-items: center; gap: 6px; }
.legende-compacte i { width: 7px; height: 7px; flex-shrink: 0; }
.carre-libre { background: #000; }.carre-code { border: 1px solid #6F6A64; }.carre-responsable { background: #FF0000; }
/* Boutons-idées (23.09.2026, demande d'Ethan) : les raccourcis de l'accueil,
   affichés à l'ouverture, repartent dans le vortex au fil du défilement — voir creerEmergenceIdees() dans
   app.js, qui pilote les variables --idee-* image par image. Sans la classe
   .propositions-emergentes (mouvement réduit, conversation démarrée, erreur
   de chargement), tout reste affiché normalement. La mise en page ne bouge
   jamais (opacité/flou/transformation seulement) : le calage du slogan sous
   ce bloc (ajusterSloganY) reste donc exact. */
.guide-refonte .idees-particules { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.guide-refonte:has(#chat .msg) .idees-particules { display: none; }
.guide-refonte .propositions-emergentes .suggestions .chip,
.guide-refonte .propositions-emergentes .legende-compacte {
  opacity: var(--idee-opacite, 1);
  filter: blur(calc(var(--idee-flou, 0) * 1px));
  transform: translateY(calc(var(--idee-decalage, 0) * 1px));
  will-change: opacity, filter, transform;
}
/* Titre d'accueil : caché au départ, il apparaît avec le slogan (classe
   posée dès l'en-tête d'index.html, retirée si l'animation ne tourne pas). */
html.accueil-anime .guide-refonte .accueil-titre {
  opacity: var(--idee-opacite, 0);
  filter: blur(calc(var(--idee-flou, 5) * 1px));
  transform: translateY(calc(var(--idee-decalage, 10) * 1px));
}
.guide-refonte .propositions-emergentes .suggestions .chip { box-shadow: 0 0 0 1px rgb(255 0 0 / var(--idee-contour, 0)); }
/* Atteint au clavier : affiché tout de suite, quel que soit l'avancement. */
.guide-refonte .propositions-emergentes .suggestions .chip:focus-visible { opacity: 1; filter: none; transform: none; pointer-events: auto !important; }
.guide-refonte .propositions-emergentes { position: relative; }
.guide-refonte:has(#chat .msg) .accueil-titre, .guide-refonte:has(#chat .msg) .accueil-raccourcis, .guide-refonte:has(#chat .msg) .accueil-vortex { display: none; }
/* Accueil réorganisé (25.09.2026, demandes d'Ethan) : de haut en bas, le logo,
   le slogan (formé par les particules juste sous l'en-tête, voir
   ajusterSloganY() dans app.js), l'espace libre du vortex, puis, collés en
   bas : les boutons, la légende des couleurs juste au-dessus de la barre de
   saisie, et la barre de saisie. Le titre « Bonjour, comment puis-je vous
   aider ? » occupe la place des boutons et de la légende : il n'apparaît
   qu'une fois ceux-ci repartis dans le vortex (voir creerEmergenceIdees()).
   Seul l'ordre VISUEL change (order) : dans le DOM, donc au clavier, la
   barre de saisie reste le premier champ atteint après l'en-tête. Dès
   qu'une conversation démarre, ces règles ne s'appliquent plus. */
.guide-refonte:not(:has(#chat .msg)) .app-header { order: 0; }
.guide-refonte:not(:has(#chat .msg)) .container { order: 1; }
.guide-refonte:not(:has(#chat .msg)) .accueil-raccourcis { order: 2; margin-top: auto; margin-bottom: 0; padding-top: 12px; padding-bottom: 14px; display: flex; flex-direction: column; }
.guide-refonte:not(:has(#chat .msg)) .accueil-raccourcis .suggestions { order: 1; }
.guide-refonte:not(:has(#chat .msg)) .accueil-raccourcis .legende-compacte { order: 2; margin: 14px 0 0; }
.guide-refonte:not(:has(#chat .msg)) .accueil-titre { order: 0; padding-top: 0; margin: 0 0 16px; }
.guide-refonte:not(:has(#chat .msg)) .composer { order: 4; padding-bottom: 22px; }
/* Accueil animé : titre et boutons ne sont jamais visibles en même temps, le
   titre se superpose donc au bas du bloc (juste au-dessus de la barre de
   saisie) sans réserver de place. Sans animation (mouvement réduit), il
   reste simplement au-dessus des boutons. */
html.accueil-anime .guide-refonte:not(:has(#chat .msg)) .accueil-raccourcis { display: grid; grid-template-columns: minmax(0, 1fr); }
html.accueil-anime .guide-refonte:not(:has(#chat .msg)) .accueil-raccourcis .suggestions { grid-row: 1; grid-column: 1; }
html.accueil-anime .guide-refonte:not(:has(#chat .msg)) .accueil-raccourcis .legende-compacte { grid-row: 2; grid-column: 1; }
html.accueil-anime .guide-refonte:not(:has(#chat .msg)) .accueil-titre { grid-row: 1 / 3; grid-column: 1; align-self: end; margin: 0; pointer-events: none; }
.guide-refonte:has(#chat .msg) .composer { padding: 12px 16px max(12px,env(safe-area-inset-bottom)); border-top: 1px solid #D5D5D5; background: #fff; }
.guide-refonte:has(#chat .msg) .composer-inner { grid-template-columns: minmax(0,1fr) 50px; }
.guide-refonte:has(#chat .msg) #envoyer, .guide-refonte:has(#chat .msg) .saisie-pilule { height: 50px; }
.guide-refonte:has(#chat .msg) #envoyer { width: 50px; padding: 13px; }
.guide-refonte .msg.user .bulle { max-width: 78%; padding: 11px 15px; background: #fff; border: 1px solid rgb(204 204 204 / .92); color: #000; border-radius: 6px; font-size: 14px; }
.guide-refonte .msg.bot .bulle { max-width: 85%; padding: 14px 16px; background: #fff; border: 1px solid #CCC; color: #000; border-radius: 6px; font-size: 14px; }
.guide-refonte .badge-importance { font-size: 10px; letter-spacing: .04em; border-color: #D0D0D0; color: #000; }
.guide-refonte .badge-importance-moyenne, .guide-refonte .badge-importance-critique { border-color: #FF0000; color: #FF0000; background: #fff; }
.guide-refonte .reponse-intro { font-size: 14px; }
.guide-refonte .checklist { list-style: none; padding: 0; margin: 12px 0 0; }
.guide-refonte .checklist li { margin: 0; padding: 11px 0; border-top: 1px solid #E5E5E5; font-size: 13.5px; }
.guide-refonte .checklist label { display: flex; align-items: flex-start; gap: 10px; }
.guide-refonte .checklist input[type=checkbox] { appearance: none; flex: 0 0 16px; width: 16px; height: 16px; margin: 3px 0 0; border: 1.5px solid #6F6A64; border-radius: 0; background: #fff; }
.guide-refonte .checklist input:checked::after { content: '✓'; display: block; color: #000; font-size: 13px; line-height: 13px; }
/* Information (1.11.25) : fiche à lire, mêmes lignes que la checklist, sans case à cocher. */
.liste-information { list-style: none; padding: 0; margin: 12px 0 0; }
.liste-information li { margin: 0; padding: 11px 0; border-top: 1px solid #E5E5E5; font-size: 13.5px; }
.badge-information { border-color: #D0D0D0; color: #000; }
/* Suivi des tâches (23.09.2026) : état du suivi et mention d'information sous la checklist. */
.suivi-etat { margin: 10px 0 0; font-size: 12.5px; color: var(--texte-clair, #6F6A64); }
.suivi-etat.suivi-termine { color: #000; font-weight: 600; }
.suivi-etat.suivi-termine::before { content: '✓ '; color: #FF0000; }
/* Revu le 24.09.2026 : avancement toujours visible, verrouillage après la fin. */
.suivi-etat.suivi-en-cours { color: #000; }
.suivi-etat.suivi-en-cours strong { font-variant-numeric: tabular-nums; }
.suivi-etat .suivi-note { font-weight: 400; color: var(--texte-clair, #6F6A64); }
.suivi-modifier { margin-left: 6px; padding: 2px 10px; border: 1px solid #D0D0D0; border-radius: 100px; background: #fff; color: #000; font: 500 11.5px 'IBM Plex Sans', sans-serif; cursor: pointer; }
.suivi-modifier:hover { background: #F6F4F1; border-color: #B9B3AA; }
.checklist.checklist-verrouillee label { cursor: default; }
.checklist input[type=checkbox]:disabled { cursor: default; }
/* Tâches répétitives (24.09.2026) : proposition de reprise d'une tâche inachevée. */
.suivi-reprise { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; padding: 8px 10px; border: 1px solid #E5E5E5; border-left: 3px solid #FF0000; background: #FAFAFA; font-size: 12.5px; color: #000; }
.suivi-reprise strong { font-variant-numeric: tabular-nums; }
.suivi-reprise-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.suivi-reprise-texte small { font-size: 11.5px; color: var(--texte-clair, #6F6A64); }
.suivi-reprendre { flex: none; margin-left: auto; padding: 3px 12px; border: 0; border-radius: 100px; background: #000; color: #fff; font: 500 11.5px 'IBM Plex Sans', sans-serif; cursor: pointer; }
.suivi-reprendre:hover { background: #333; }
.guide-refonte .feedback { border-top: 1px solid #E5E5E5; color: #6F6A64; font: 10.5px 'IBM Plex Mono', monospace; gap: 8px; }
.guide-refonte .btn-feedback { border: 1px solid #D0D0D0; border-radius: 5px; background: #fff; color: #000; padding: 5px 12px; font: 10px 'IBM Plex Mono', monospace; }
.guide-refonte .btn-feedback.selectionne { background: #1C1B19; border-color: #1C1B19; color: #fff; }
.guide-refonte .msg.bot:has(> .feedback) { flex-direction: column; align-items: flex-start; }
.guide-refonte .msg.bot > .feedback { max-width: 85%; border: 0; margin: 8px 0 0; padding: 0; }
.guide-refonte .feedback > span:first-child { flex-basis: 100%; }
.guide-refonte .proposition-ia { background: #fff; border: 0; padding: 0; color: #000; }
.guide-refonte .proposition-ia .confirmer-ia { background: #fff; color: #000; }
.guide-refonte .point-enregistrement { background: #000; box-shadow: none; }
.guide-refonte .erreur-chargement { background: #fff; color: #000; border-color: #D5D5D5; }
.guide-refonte :focus-visible { outline: 2px solid #6F6A64; outline-offset: 3px; }
@media (max-width: 360px) {
  .guide-refonte .composer, .guide-refonte .accueil-raccourcis { padding-left: 16px; padding-right: 16px; }
  .guide-refonte .app-header { padding: 0 12px; }
  /* .accueil-vortex n'a plus besoin d'être répété ici : la règle de base
     (pleine hauteur) s'applique déjà à toutes les largeurs, voir plus haut. */
}

/* Chat libre (décision du 22.09.2026, revu le 22.09.2026 pour reprendre
   exactement l'apparence du chatbot ALEEX — bulles .msg/.bulle et composer
   en pilule réutilisés tels quels, cf. index.html/app.js) : conversation
   libre avec Claude/GPT, partagée entre le guide employé (chat-libre.html,
   mode "pro") et le tableau de bord admin (mode "debride") — voir
   chat-libre.js. Volontairement autonome (ne dépend pas de .guide-refonte)
   pour s'afficher correctement à la fois en page pleine (chat-libre.html)
   et intégré dans un onglet du tableau de bord (thème différent). */
.chat-libre-page {
  flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%;
  max-width: 760px; margin: 0 auto; overflow: hidden;
}
/* Le <div> hôte fourni par la page (voir chat-libre.js) doit lui-même
   grandir pour remplir .chat-libre-page, sinon il ne prend que la hauteur de
   son contenu (comportement par défaut d'un enfant flex) et .chat-libre-refonte
   grandit avec lui au fil de la conversation au lieu de garder le composer
   fixe en bas avec un défilement interne. */
.chat-libre-page .chat-libre-hote { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-libre-refonte {
  display: flex; flex-direction: column; min-height: 0; background: #fff;
  font-family: 'IBM Plex Sans', sans-serif; color: #000;
}
.chat-libre-page .chat-libre-refonte { flex: 1; min-height: 0; }
/* Le chat libre a toujours besoin de son en-tête (Historique / Nouvelle
   conversation), y compris avant le premier message — contrairement au
   guide principal où .assistant-entete reste masqué tant que #chat est
   vide. La règle .guide-refonte:not(:has(#chat .msg)) .assistant-entete
   (spécificité renforcée par le sélecteur d'ID #chat) prime sinon sur un
   simple enchaînement de classes : !important nécessaire ici pour ce cas
   précis, volontairement isolé à .chat-libre-refonte. */
.chat-libre-refonte .assistant-entete { display: flex !important; }
.section-tableau-bord .chat-libre-refonte { height: 70vh; min-height: 520px; border: 1px solid #D5D5D5; border-radius: 8px; overflow: hidden; }
.chat-libre-refonte .assistant-entete { flex: 0 0 auto; padding: 12px 16px; border-bottom: 1px solid #E5E5E5; margin: 0; }
.chat-libre-entete-actions { display: flex; gap: 8px; }
.chat-libre-toggle-historique.actif { background: #F6F4F1; border-color: #1C1B19; }
.chat-libre-corps { flex: 1; display: flex; min-height: 0; }
.chat-libre-panneau-historique {
  width: 240px; flex-shrink: 0; border-right: 1px solid #E5E5E5; padding: 12px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.chat-libre-conversations { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.chat-libre-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid transparent; border-radius: 4px;
  background: none; font-family: inherit; font-size: 0.85rem; color: #000; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-libre-item:hover { border-color: #B9B3AA; background: #F6F4F1; }
.chat-libre-item.actif { border-color: #FF0000; color: #FF0000; font-weight: 500; }
.chat-libre-vide { color: #6F6A64; font-size: 0.85rem; padding: 8px 10px; }
.chat-libre-refonte .chat { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; margin: 0; max-width: none; }
.chat-libre-refonte .msg.user .bulle { max-width: 78%; padding: 11px 15px; background: #fff; border: 1px solid rgb(204 204 204 / .92); color: #000; border-radius: 6px; font-size: 14px; }
.chat-libre-refonte .msg.bot .bulle { max-width: 85%; padding: 14px 16px; background: #fff; border: 1px solid #CCC; color: #000; border-radius: 6px; font-size: 14px; }
.chat-libre-refonte .message-expediteur { font: 500 11px/1.4 'IBM Plex Sans', sans-serif; color: var(--encre-secondaire, #656565); margin: 0 3px; align-self: flex-end; }
.chat-libre-en-attente .bulle { opacity: 0.8; }
.chat-libre-erreur { color: #FF0000; font-size: 0.85rem; margin: 0 16px; }
.chat-libre-refonte .composer { flex: 0 0 auto; padding: 12px 16px max(12px,env(safe-area-inset-bottom)); border-top: 1px solid #D5D5D5; background: #fff; position: static; }
.chat-libre-refonte .composer-inner { display: grid; grid-template-columns: minmax(0,1fr) 50px; gap: 8px; }
.chat-libre-refonte .saisie-pilule { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 16px; border: 1px solid #C7C7C7; border-radius: 100px; background: #fff; min-width: 0; }
.chat-libre-refonte .saisie-pilule:focus-within { outline: 2px solid #6F6A64; outline-offset: 2px; }
.chat-libre-refonte .icone-recherche { color: #6F6A64; flex-shrink: 0; width: 18px; height: 18px; }
.chat-libre-saisie {
  min-height: 0; height: 36px; max-height: 36px; line-height: 20px; padding: 8px 0; font-size: 14px; flex: 1;
  border: 0; outline: none; resize: none; background: transparent; border-radius: 0; font-family: inherit;
}
.chat-libre-saisie::placeholder { color: #6F6A64; opacity: 1; }
.chat-libre-envoyer {
  border: 0; background: #FF0000; color: #fff; width: 50px; height: 50px; border-radius: 100px; padding: 13px;
  display: grid; place-items: center; cursor: pointer;
}
.chat-libre-envoyer svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-libre-envoyer:disabled { opacity: 0.6; cursor: default; }
@media (max-width: 640px) {
  .chat-libre-corps { position: relative; }
  .chat-libre-panneau-historique {
    position: absolute; inset: 0; z-index: 2; width: 100%; background: #fff;
  }
}

/* ==========================================================================
   Espace IA privé / Discuter avec l'IA (26.09.2026, demande d'Ethan) : même
   langage que le chat ALEEX (bulles, expéditeur au-dessus, avion en papier,
   carré rouge du logo) + animations. Voir chat-libre.js et chat-anime.js.
   ========================================================================== */
.chat-libre-refonte .msg { flex-direction: column; gap: 5px; margin: 0 0 14px; }
.chat-libre-refonte .msg.bot { align-items: flex-start; }
.chat-libre-refonte .msg.user { align-items: flex-end; }
.chat-libre-refonte .message-expediteur { align-self: auto; }
.section-tableau-bord .chat-libre-refonte { height: min(74vh, 760px); min-height: 520px; border: 1px solid #E3E3E3; border-radius: 18px; background: #fff; }
/* Barre : historique à gauche, titre de la conversation au centre, nouvelle à droite. */
.chat-libre-refonte .chat-libre-barre { display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; }
.chat-libre-titre-conversation { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font: 600 13.5px 'IBM Plex Sans', sans-serif; color: #000; }
.chat-libre-barre .chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.chat-libre-barre .chip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.chat-libre-toggle-historique[data-nombre]:not([data-nombre=""])::after { content: attr(data-nombre); min-width: 18px; padding: 0 5px; border-radius: 100px; background: #EDEDED; color: #333; font: 600 10.5px/18px 'IBM Plex Sans', sans-serif; text-align: center; }
.chat-libre-toggle-historique.actif svg { stroke: #FF0000; }
/* Historique : glisse depuis la gauche, rangé par date. */
.chat-libre-corps { position: relative; }
.chat-libre-panneau-historique { width: 270px; padding: 10px 10px 14px; background: #FBFBFB; opacity: 0; transform: translateX(-14px); transition: opacity .2s ease, transform .22s cubic-bezier(.2,.8,.2,1); }
.chat-libre-panneau-historique.ouvert { opacity: 1; transform: none; }
.chat-libre-groupe { margin: 12px 6px 4px; font: 500 10.5px 'IBM Plex Mono', monospace; letter-spacing: .05em; text-transform: uppercase; color: #8A8A8A; }
.chat-libre-groupe:first-child { margin-top: 2px; }
.chat-libre-ligne { display: flex; align-items: center; gap: 2px; border-radius: 10px; transition: background .15s, opacity .2s, transform .2s; }
.chat-libre-ligne:hover { background: #F6F4F1; }
.chat-libre-ligne .chat-libre-item { flex: 1; min-width: 0; border: 0 !important; background: none !important; padding: 8px 8px 8px 22px; position: relative; font-size: 13px; }
.chat-libre-ligne.actif .chat-libre-item { color: #000; font-weight: 600; }
.chat-libre-ligne.actif .chat-libre-item::before { content: ""; position: absolute; left: 8px; top: 50%; width: 6px; height: 6px; margin-top: -3px; background: #FF0000; }
.chat-libre-supprimer { flex: none; width: 26px; height: 26px; margin-right: 4px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #8A8A8A; cursor: pointer; opacity: 0; transition: opacity .15s, background .15s, color .15s; }
.chat-libre-supprimer svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.chat-libre-ligne:hover .chat-libre-supprimer, .chat-libre-supprimer:focus-visible, .chat-libre-ligne.confirmer .chat-libre-supprimer { opacity: 1; }
.chat-libre-ligne.confirmer .chat-libre-supprimer { background: #FF0000; color: #fff; }
.chat-libre-ligne.disparait { opacity: 0; transform: translateX(-10px); }
/* Accueil d'une conversation vide. */
.chat-libre-accueil { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px 10px; text-align: center; }
.chat-libre-accueil h3 { margin: 0; font: 600 21px 'IBM Plex Sans', sans-serif; color: #000; animation: accueil-monte .5s cubic-bezier(.2,.8,.2,1) both; }
.chat-libre-marque { width: 14px; height: 14px; background: #FF0000; animation: marque-respire 2.8s ease-in-out infinite; }
@keyframes marque-respire { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,0,0,0); } 50% { transform: scale(.82); box-shadow: 0 0 0 9px rgba(255,0,0,.08); } }
.chat-libre-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 520px; }
.chat-libre-suggestions .chip { animation: accueil-monte .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes accueil-monte { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.chat-libre-efface > * { animation: chat-efface .26s ease-in forwards; }
@keyframes chat-efface { to { opacity: 0; transform: translateY(-14px); filter: blur(1.5px); } }
/* Bulles : même rendu que le chat ALEEX ; réponses mises en forme. */
.chat-libre-refonte .msg.bot .bulle { line-height: 1.6; }
.chat-libre-refonte .msg.user .bulle { white-space: pre-wrap; }
.chat-libre-en-attente .bulle { opacity: 1; color: #8A8A8A; }
/* Saisie : pas de cadre dans la pilule, icône au trait, hauteur automatique. */
html:root .chat-libre-refonte .saisie-pilule { height: auto !important; min-height: 50px; align-items: center; padding: 6px 16px; border-radius: 26px; }
html:root .chat-libre-refonte .chat-libre-saisie { border: 0 !important; outline: none !important; box-shadow: none !important; border-radius: 0 !important; padding: 7px 0 !important; min-height: 20px; height: 34px; max-height: 116px; line-height: 20px; overflow-y: auto; font: 14px 'IBM Plex Sans', sans-serif !important; }
.chat-libre-refonte .icone-saisie { flex: none; width: 18px; height: 18px; fill: none; stroke: #6F6A64; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.chat-libre-refonte.saisie-multiligne .saisie-pilule { align-items: flex-end; }
.chat-libre-refonte.saisie-multiligne .icone-saisie { margin-bottom: 8px; }
.chat-libre-refonte .composer-inner { align-items: end; }
.chat-libre-erreur { margin: 0 16px 8px; padding: 8px 12px; border-radius: 10px; background: #FFF4F4; color: #C92736; font-size: 13px; }
@media (max-width: 640px) {
  .chat-libre-refonte .chat-libre-barre .chip span:not([aria-hidden]) { display: none; }
  .chat-libre-refonte .chat-libre-nouvelle { font-size: 0; gap: 0; }
  .chat-libre-refonte .chat-libre-nouvelle span[aria-hidden] { font-size: 18px; }
  .chat-libre-panneau-historique { position: absolute; inset: 0; z-index: 2; width: 100%; }
  .chat-libre-accueil h3 { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-libre-marque, .chat-libre-accueil h3, .chat-libre-suggestions .chip, .chat-libre-efface > * { animation: none !important; }
  .chat-libre-panneau-historique { transition: none; }
}
/* Espace IA privé — suite (26.09.2026) : pièces jointes, « Arrêter », dépôt. */
.chat-libre-refonte .chat-libre-pieces { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 2px; }
.chat-libre-refonte .chat-libre-pieces[hidden] { display: none; }
.chat-libre-joindre { flex: none; width: 30px; height: 30px; margin-left: -6px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #6F6A64; cursor: pointer; transition: background .15s, color .15s; }
.chat-libre-joindre:hover { background: #F6F4F1; color: #000; }
.chat-libre-joindre svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-libre-refonte.saisie-multiligne .chat-libre-joindre { margin-bottom: 3px; align-self: flex-end; }
/* Dictée dans l'Espace IA privé (1.10.14) : même allure que le trombone. */
.chat-libre-dicter { flex: none; width: 30px; height: 30px; margin-right: -6px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #6F6A64; cursor: pointer; transition: background .15s, color .15s; }
.chat-libre-dicter[hidden] { display: none; }
.chat-libre-dicter:hover { background: #F6F4F1; color: #000; }
.chat-libre-dicter svg { width: 18px; height: 18px; }
.chat-libre-dicter .point-enregistrement { width: 11px; height: 11px; background: #000; box-shadow: none; }
.chat-libre-dicter.dictee-transcription, .bouton-micro.dictee-transcription { opacity: .5; cursor: progress; }
.chat-libre-refonte.saisie-multiligne .chat-libre-dicter { margin-bottom: 3px; align-self: flex-end; }
.puce-fichier { display: inline-flex; align-items: center; gap: 7px; max-width: 240px; padding: 4px 8px 4px 4px; border: 1px solid #DADADA; border-radius: 10px; background: #fff; font: 12.5px 'IBM Plex Sans', sans-serif; color: #000; animation: accueil-monte .3s cubic-bezier(.2,.8,.2,1) both; }
.puce-fichier > span:not(.puce-fichier-icone) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puce-fichier img { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; flex: none; }
.puce-fichier-icone { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; background: #F2F2F2; font: 600 9px 'IBM Plex Mono', monospace; color: #6F6A64; }
.puce-fichier-retirer { flex: none; width: 20px; height: 20px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #8A8A8A; font-size: 15px; line-height: 1; cursor: pointer; }
.puce-fichier-retirer:hover { background: #FF0000; color: #fff; }
.bulle-fichiers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bulle-fichiers-seuls .bulle-fichiers { margin-top: 0; }
.chat-libre-refonte.depot-actif .chat { outline: 2px dashed #FF0000; outline-offset: -10px; background: #FFF8F8; }
/* « Arrêter » : le bouton d'envoi montre le carré du logo, en blanc. */
.chat-libre-envoyer .carre-arret { display: block; width: 14px; height: 14px; background: #fff; border-radius: 2px; }
.chat-libre-envoyer.chat-libre-arreter { animation: arret-pulse 1.6s ease-in-out infinite; }
@keyframes arret-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,0,0,.25); } 50% { box-shadow: 0 0 0 7px rgba(255,0,0,0); } }
@media (prefers-reduced-motion: reduce) { .chat-libre-envoyer.chat-libre-arreter, .puce-fichier { animation: none; } }

/* ==========================================================================
   Annuaire (27.09.2026) : panneau de l'accueil (icône carnet) et fiches de
   contact dans le chat. Voir annuaire.js.
   ========================================================================== */
.panneau-annuaire { width: min(520px, calc(100vw - 24px)); }
/* En-tête et recherche fixes, seule la liste défile (rien ne passe sous la recherche). */
.panneau-annuaire[open] { display: flex; flex-direction: column; overflow: hidden; }
.panneau-annuaire .heures-entete { position: static; flex: 0 0 auto; }
.panneau-annuaire .annuaire-barre { flex: 0 0 auto; padding: 0 18px 10px; }
.panneau-annuaire .annuaire-liste { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.panneau-annuaire .annuaire-recherche { width: 100%; box-sizing: border-box; min-height: 42px; padding: 9px 14px; border-radius: 100px; border: 1px solid #D0D0D0; background: rgba(255,255,255,.85); font: 15px 'IBM Plex Sans', sans-serif; }
.panneau-annuaire .annuaire-liste { padding: 4px 18px 18px; display: grid; gap: 16px; }
.annuaire-groupe { display: grid; gap: 8px; }
.annuaire-groupe > h3 { margin: 4px 2px 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #6F6A64; }
.annuaire-vide { margin: 12px 2px; color: #6F6A64; }
.carte-contact { padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.82); border: 1px solid rgba(0,0,0,.06); box-shadow: 0 6px 16px -12px rgba(60,20,20,.3); display: grid; gap: 8px; }
.carte-contact-tete { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.carte-contact-nom { font-size: 15px; }
.carte-contact-sous { font-size: 12.5px; color: #6F6A64; }
.carte-contact-lignes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ligne-contact { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.valeur-contact { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; font-size: 14px; }
.lien-site { color: inherit; }
.actions-contact { display: inline-flex; gap: 6px; }
.carte-contact .chip { min-height: 32px; padding: 5px 12px; font-size: 12.5px; text-decoration: none; border-radius: 100px !important; display: inline-flex; align-items: center; justify-content: center; }
.carte-contact .bouton-appeler { position: relative; isolation: isolate; font-weight: 600; }
.carte-contact .chip.copie { background: #EDF7F0; border-color: #9CCDAE; color: #1E6B3A; }
.carte-contact-note { margin: 0; font-size: 13px; color: #3D3A36; white-space: pre-line; }
.cartes-contacts { display: grid; gap: 8px; margin: 8px 0; max-width: 460px; }
@media (pointer: coarse) { .carte-contact .chip { min-height: 38px; padding: 7px 14px; } }

/* Bouton discret « animations » (28.09.2026) : sous la barre de saisie, à
   gauche, juste après le trombone et le micro ; accueil seulement. */
.guide-refonte #bouton-animations { grid-row: 2; grid-column: 1; justify-self: start; margin-left: 80px; width: 32px; height: 32px; padding: 6px; border: 1px solid #D0D0D0; border-radius: 100px; background: #fff; color: #6F6A64; display: grid; place-items: center; opacity: .75; }
.guide-refonte #bouton-animations[hidden], .guide-refonte:has(#chat .msg) #bouton-animations { display: none !important; }
.guide-refonte #bouton-animations:hover, .guide-refonte #bouton-animations:focus-visible { opacity: 1; }
.guide-refonte #bouton-animations svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.guide-refonte #bouton-animations .icone-lecture path { fill: currentColor; stroke-width: 1.4; }
/* Micro ou trombone absents (transcription indisponible, compte sans pièces
   jointes) : le bouton se rapproche pour ne pas laisser de trou. */
.guide-refonte #dicter[hidden] ~ #bouton-animations { margin-left: 40px; }
.guide-refonte #dicter[hidden] ~ #joindre-media[hidden] + #bouton-animations { margin-left: 0; }
