/* ── Dan, l'assistant Décroche Toujours — « Carnet d'atelier » (v166, 18/10/2026) ──
   Direction validée par Daniel : encre navy, papier, le laiton en LUMIÈRE
   (anneau, point, halo) jamais en remplissage. Zéro bordure décorative :
   la structure est portée par les aplats et l'espace (Linear), les
   conversations sans cartes (Intercom Fin), un seul élément vivant pour
   l'état vocal (ChatGPT Voice). Icônes SVG au trait, zéro emoji.
   Charte : navy #1a2340 (14,3:1 sur papier), doré #C7A059 (signal
   graphique uniquement, jamais de texte), papier #faf6ef.
   Cibles : ≥ 48 px partout ; orbe vocal 88 px. Aucun état porté par la
   seule couleur : icône + texte partout. */

:root {
  --dan-encre: #1a2340;
  --dan-encre-2: #3d4459;
  --dan-papier: #faf6ef;
  --dan-surface: #ffffff;
  --dan-creux: #f4edde;
  --dan-laiton: #C7A059;
  --dan-filet: rgba(26, 35, 64, .10);
  --dan-filet-fort: rgba(26, 35, 64, .16);
  --dan-ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --dan-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dan-ease-inout: cubic-bezier(0.76, 0, 0.24, 1);
  --dan-d-rapide: 160ms;
  --dan-d-entree: 240ms;
  --dan-d-sortie: 180ms;
}

/* ── Bouton flottant : un disque d'encre, le micro en trait laiton ── */
.dan-btn {
  position: fixed; right: 16px; z-index: 80;
  bottom: calc(72px + env(safe-area-inset-bottom) + 12px);
  width: 64px; height: 64px; border-radius: 50%;
  background: #1a2340; color: #faf6ef;
  border: none;
  box-shadow: 0 8px 20px rgba(26, 35, 64, .28), 0 2px 6px rgba(26, 35, 64, .18);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; cursor: pointer; padding: 0;
  font-family: inherit;
}
.dan-btn:active { transform: scale(0.97); transition: transform 120ms var(--dan-ease-out); }
.dan-btn .dan-btn-icone { display: flex; color: #C7A059; line-height: 0; }
.dan-btn .dan-btn-libelle { font-size: 15px; font-weight: 800; line-height: 1.1; letter-spacing: 0.02em; color: #faf6ef; }
/* Vue Planning / Factures : le bouton Dan s'empile AU-DESSUS des boutons
   de création (#plan-fab fixe, #fx-fab) — jamais côte à côte. */
.dan-btn--empile { bottom: calc(72px + env(safe-area-inset-bottom) + 12px + 72px); }
/* QA A→Z 20/10 : empilement mutuel avec la pastille « Parler à Léa »
   (large, z-index 1200, même zone bas-droite) — le disque Dan passe
   AU-DESSUS d'elle au lieu d'être recouvert et incliquable. */
body.lea-talk-on .dan-btn { bottom: calc(72px + env(safe-area-inset-bottom) + 12px + 76px); }
body.lea-talk-on .dan-btn--empile,
body.lea-talk-fab .dan-btn { bottom: calc(72px + env(safe-area-inset-bottom) + 12px + 76px + 84px); }
.dan-cache { display: none !important; }

/* ── Panneau : feuille basse, mobile d'abord ── */
.dan-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  max-height: 82vh; max-height: 82dvh;
  background: var(--dan-papier); color: var(--dan-encre);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -16px 40px rgba(26, 35, 64, .20), 0 -4px 12px rgba(26, 35, 64, .10);
  display: flex; flex-direction: column;
  font-family: inherit;
  translate: 0 24px; opacity: 0;
}
.dan-panel.dan-panel--ouvert {
  translate: 0 0; opacity: 1;
  transition: translate var(--dan-d-entree) var(--dan-ease-sheet),
              opacity var(--dan-d-entree) var(--dan-ease-sheet);
}
@media (min-width: 720px) {
  .dan-panel {
    left: 50%; right: auto; transform: translateX(-50%); width: 560px;
    bottom: 24px; border-radius: 24px;
    box-shadow: 0 24px 60px rgba(26, 35, 64, .28), 0 4px 16px rgba(26, 35, 64, .12);
    translate: 0 12px;
  }
}
.dan-poignee {
  width: 40px; height: 4px; border-radius: 999px; flex: none;
  background: rgba(26, 35, 64, .18); margin: 10px auto 2px;
}

/* ── En-tête : avatar, nom, ligne de statut vivante, une seule sortie ── */
.dan-panel-entete {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 20px 12px; border-bottom: 1px solid var(--dan-filet);
  flex: none;
}
.dan-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--dan-encre); color: var(--dan-laiton);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800;
}
.dan-entete-textes { flex: 1 1 auto; min-width: 0; }
.dan-panel-titre { font-size: 19px; font-weight: 800; margin: 0; letter-spacing: -0.01em; line-height: 1.15; }
.dan-statut {
  display: flex; align-items: center; gap: 7px; margin-top: 1px;
  font-size: 14px; font-weight: 500; color: var(--dan-encre-2); line-height: 1.3;
}
.dan-statut-point { width: 8px; height: 8px; border-radius: 50%; background: var(--dan-laiton); flex: none; }
.dan-statut-point--ecoute { animation: dan-point-pulse 1.6s var(--dan-ease-inout) infinite; }
@keyframes dan-point-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: .55; }
}
.dan-statut-eq { display: none; align-items: flex-end; gap: 2.5px; height: 14px; flex: none; }
.dan-statut-eq i { width: 3px; background: var(--dan-laiton); border-radius: 2px; animation: dan-eq .8s var(--dan-ease-inout) infinite; }
.dan-statut-eq i:nth-child(1) { height: 8px; }
.dan-statut-eq i:nth-child(2) { height: 13px; animation-delay: -.2s; }
.dan-statut-eq i:nth-child(3) { height: 9px; animation-delay: -.45s; }
.dan-statut-eq i:nth-child(4) { height: 12px; animation-delay: -.1s; }
@keyframes dan-eq { 0%, 100% { transform: scaleY(.55); } 50% { transform: scaleY(1); } }
.dan-statut--parle .dan-statut-eq { display: flex; }
.dan-statut--parle .dan-statut-point { display: none; }
.dan-fermer {
  width: 48px; height: 48px; min-width: 48px; border-radius: 12px; flex: none;
  background: transparent; color: var(--dan-encre); border: none;
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.dan-fermer:active { background: rgba(26, 35, 64, .06); }
.dan-raccrocher {
  display: none; min-height: 48px; padding: 0 16px; border-radius: 999px; flex: none;
  background: var(--dan-creux); color: var(--dan-encre); border: none;
  font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.dan-panel--appel .dan-raccrocher { display: block; }
.dan-panel--appel .dan-fermer { display: none; }

/* ── Messages : Dan parle dans la pièce, l'artisan dans sa bulle ── */
.dan-messages {
  overflow-y: auto; padding: 16px 20px 8px; flex: 1 1 auto;
  font-size: 17px; line-height: 1.55;
}
.dan-msg { margin: 0 0 14px; }
.dan-msg--dan { font-weight: 500; }
.dan-msg--dan p { margin: 0; white-space: pre-wrap; }
.dan-msg--artisan { display: flex; justify-content: flex-end; }
.dan-msg--artisan p {
  margin: 0; white-space: pre-wrap; max-width: 85%;
  background: var(--dan-encre); color: var(--dan-papier);
  font-weight: 500; line-height: 1.45;
  padding: 10px 14px; border-radius: 18px 18px 6px 18px;
}
.dan-msg--info {
  background: var(--dan-creux); color: var(--dan-encre-2);
  font-size: 14px; font-weight: 600; text-align: center;
  border-radius: 12px; padding: 10px 14px;
}
.dan-msg--info p { margin: 0; white-space: pre-wrap; }
.dan-msg-qui {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--dan-encre-2); margin-bottom: 3px;
}
.dan-msg-qui::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dan-laiton); }
.dan-msg--nouveau { animation: dan-msg-entre 220ms var(--dan-ease-out) both; }
@keyframes dan-msg-entre {
  from { opacity: 0; transform: translateY(6px); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
/* Ligne système « micro coupé » : dans le fil, relisible, jamais un bandeau. */
.dan-sys {
  display: none; background: var(--dan-creux); color: var(--dan-encre);
  font-size: 14.5px; font-weight: 700; text-align: center;
  border-radius: 12px; padding: 10px 14px; margin: 0 0 14px;
}
.dan-sys--visible { display: block; }

/* Propositions de Dan (reprise, escalade) : des réponses, pas des contrôles. */
.dan-reprendre, .dan-escalade-btn, .dan-degrade-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: calc(100% - 40px); margin: 0 20px 10px; min-height: 56px;
  border-radius: 14px; font-size: 17px; font-weight: 800; cursor: pointer;
  font-family: inherit; padding: 10px 14px; border: none; flex: none;
}
.dan-reprendre { background: var(--dan-encre); color: var(--dan-papier); }
.dan-escalade-btn { background: var(--dan-surface); color: var(--dan-encre); border: 1px solid var(--dan-filet-fort); }
.dan-degrade-btn { background: var(--dan-surface); color: var(--dan-encre); border: 1px solid var(--dan-filet-fort); }

/* ── Dock vocal : l'orbe héros, ses états, son satellite ── */
.dan-dock {
  flex: none; display: flex; flex-direction: column; align-items: center;
  gap: 5px; padding: 8px 20px 2px;
}
.dan-orbe {
  --niveau: 0;
  position: relative; width: 88px; height: 88px; border-radius: 50%;
  background: none; border: 0; cursor: pointer; padding: 0; flex: none;
  font-family: inherit;
}
.dan-orbe-anneau {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--dan-laiton); opacity: 0;
  transition: opacity 180ms var(--dan-ease-inout);
  will-change: transform;
}
.dan-orbe-noyau {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--dan-encre); color: var(--dan-papier);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(26, 35, 64, .25);
  transition: background-color 180ms var(--dan-ease-inout);
}
.dan-orbe:active .dan-orbe-noyau { transform: scale(0.97); }
.dan-orbe--repos .dan-orbe-noyau { animation: dan-respire 3.4s var(--dan-ease-inout) infinite; }
@keyframes dan-respire { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.dan-orbe--ecoute .dan-orbe-anneau {
  opacity: calc(0.3 + var(--niveau) * 0.6);
  transform: scale(calc(1.06 + var(--niveau) * 0.38));
}
.dan-orbe--ecoute .dan-orbe-noyau { background: #232f52; }
.dan-orbe-barres { display: none; gap: 4px; align-items: center; height: 28px; }
.dan-orbe-barres i {
  width: 4px; height: 100%; border-radius: 2px; background: var(--dan-laiton);
  transform: scaleY(0.3); transform-origin: 50% 50%;
  animation: dan-barre .9s var(--dan-ease-inout) infinite;
}
.dan-orbe-barres i:nth-child(2) { animation-duration: .7s; animation-delay: -.25s; }
.dan-orbe-barres i:nth-child(3) { animation-duration: 1.15s; animation-delay: -.5s; }
.dan-orbe-barres i:nth-child(4) { animation-duration: .8s; animation-delay: -.15s; }
.dan-orbe-barres i:nth-child(5) { animation-duration: 1s; animation-delay: -.4s; }
@keyframes dan-barre { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
.dan-orbe--parle .dan-orbe-barres { display: flex; }
.dan-orbe--parle .dan-orbe-icone { display: none; }
.dan-orbe--parle .dan-orbe-anneau {
  opacity: calc(0.2 + var(--niveau) * 0.45);
  transform: scale(calc(1.04 + var(--niveau) * 0.22));
}
.dan-orbe--coupe .dan-orbe-noyau { background: var(--dan-laiton); color: var(--dan-encre); animation: none; }
.dan-orbe--coupe .dan-orbe-anneau { opacity: 0; }
.dan-orbe-libelle { font-size: 14px; font-weight: 600; color: var(--dan-encre); text-align: center; min-height: 20px; }
.dan-satellites { display: none; justify-content: center; padding: 2px 20px 6px; flex: none; }
.dan-panel--appel .dan-satellites { display: flex; }
.dan-satellite {
  display: flex; align-items: center; gap: 7px; min-height: 48px;
  padding: 8px 16px; border-radius: 14px; cursor: pointer;
  background: transparent; color: var(--dan-encre);
  border: 1px solid var(--dan-filet-fort);
  font-size: 15px; font-weight: 600; font-family: inherit;
}
.dan-satellite:active { background: var(--dan-creux); }

/* ── Saisie : la pilule unique, l'envoi est un geste ── */
.dan-saisie { padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); flex: none; }
.dan-panel--appel .dan-saisie { display: none; }
.dan-composer {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--dan-surface); border: 1px solid var(--dan-filet-fort);
  border-radius: 28px; padding: 6px 6px 6px 18px;
}
.dan-composer:focus-within { border-color: var(--dan-encre); box-shadow: 0 0 0 3px rgba(199, 160, 89, .30); }
.dan-champ {
  flex: 1 1 auto; min-height: 44px; max-height: 110px; resize: none;
  border: none; background: transparent; padding: 11px 0;
  font-size: 17px; font-family: inherit; color: var(--dan-encre); outline: none;
}
.dan-champ::placeholder { color: var(--dan-encre-2); }
.dan-envoyer {
  width: 48px; height: 48px; min-width: 48px; border-radius: 50%; cursor: pointer;
  background: var(--dan-encre); color: var(--dan-papier); border: none;
  display: flex; align-items: center; justify-content: center; padding: 0; flex: none;
}

/* ── Halo spotlight : doré, 1,5 s, doublé d'une étiquette texte ── */
@keyframes dan-halo-pulse {
  0% { outline-offset: 2px; }
  50% { outline-offset: 6px; }
  100% { outline-offset: 2px; }
}
.dan-halo {
  outline: 4px solid #C7A059 !important; outline-offset: 3px;
  box-shadow: 0 0 0 7px rgba(199, 160, 89, 0.35);
  animation: dan-halo-pulse 0.75s var(--dan-ease-inout) 2;
  border-radius: 8px;
}
.dan-ici {
  display: inline-block; margin: 6px 0; padding: 6px 12px;
  background: #1a2340; color: #faf6ef; border: none; border-radius: 999px;
  font-size: 16px; font-weight: 800; font-family: inherit;
}

/* ── Ligne injectée dans Compte : interrupteur Dan ── */
.dan-compte-row {
  background: var(--dan-surface); border: 1px solid var(--dan-filet-fort); border-radius: 12px;
  padding: 12px; margin: 10px 0; color: var(--dan-encre);
}
.dan-compte-row .dan-compte-titre { font-size: 16px; font-weight: 800; margin: 0 0 4px; }
.dan-compte-row .dan-compte-txt { font-size: 14px; margin: 0 0 10px; }
.dan-compte-choix { display: flex; flex-wrap: wrap; gap: 10px; }
.dan-compte-choix button {
  min-height: 48px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: var(--dan-surface); color: var(--dan-encre); border: 1px solid var(--dan-filet-fort);
  font-size: 15px; font-weight: 700; font-family: inherit;
}
.dan-compte-choix button.dan-choix--actif { background: var(--dan-encre); color: var(--dan-papier); border-color: var(--dan-encre); }

@media (prefers-reduced-motion: reduce) {
  .dan-panel, .dan-panel.dan-panel--ouvert { transition: none; translate: 0 0; opacity: 1; }
  .dan-orbe--repos .dan-orbe-noyau { animation: none; }
  .dan-orbe--parle .dan-orbe-barres i { animation: none; transform: scaleY(0.6); }
  .dan-orbe--ecoute .dan-orbe-anneau, .dan-orbe--parle .dan-orbe-anneau { transform: none; opacity: 0.85; }
  .dan-statut-eq i, .dan-statut-point--ecoute { animation: none; }
  .dan-msg--nouveau { animation: none; }
  .dan-halo { animation: none; }
  .dan-btn:active, .dan-orbe:active .dan-orbe-noyau { transform: none; }
}

/* ═══ LA BULLE (v166) — forme par défaut : l'écran reste visible ═══ */
.dan-bulle {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 150;
  background: var(--dan-papier); color: var(--dan-encre);
  border-radius: 22px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 16px 40px rgba(26, 35, 64, .26), 0 4px 14px rgba(26, 35, 64, .14);
  font-family: inherit;
  animation: dan-bulle-entre var(--dan-d-entree) var(--dan-ease-sheet) both;
}
@keyframes dan-bulle-entre {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 720px) {
  .dan-bulle { left: auto; width: 430px; right: 24px; bottom: 24px; }
}
.dan-bulle-rangee { display: flex; align-items: center; gap: 11px; }
.dan-bulle .dan-orbe { width: 54px; height: 54px; }
.dan-bulle .dan-orbe-barres { height: 22px; gap: 3.5px; }
.dan-bulle .dan-orbe-barres i { width: 3.5px; }
.dan-bulle-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.dan-bulle-act {
  display: flex; align-items: center; gap: 6px; min-height: 48px;
  padding: 8px 11px; border-radius: 14px; cursor: pointer;
  background: transparent; color: var(--dan-encre);
  border: 1px solid var(--dan-filet-fort);
  font-size: 13.5px; font-weight: 600; font-family: inherit;
}
.dan-bulle-act:active { background: var(--dan-creux); }
.dan-bulle-act--racc { background: var(--dan-creux); border-color: transparent; font-weight: 700; }
.dan-bulle-expand {
  width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px;
  cursor: pointer; color: var(--dan-encre); flex: none;
  display: flex; align-items: center; justify-content: center;
}
.dan-bulle-expand:active { background: rgba(26, 35, 64, .06); }
.dan-bulle-sous { margin-top: 9px; }
.dan-bulle-phrase {
  font-size: 15.5px; font-weight: 500; line-height: 1.42; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dan-bulle-statut {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--dan-encre-2); margin-top: 4px;
}
.dan-bulle .dan-sys { margin: 8px 0 0; }
.dan-bulle-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.dan-bulle-chips:empty { display: none; }
.dan-chip {
  border: 1px solid var(--dan-filet-fort); background: var(--dan-surface); color: var(--dan-encre);
  font-family: inherit; font-size: 15px; font-weight: 600;
  min-height: 48px; padding: 8px 16px; border-radius: 999px; cursor: pointer; margin-top: 8px;
}
.dan-chip--primaire { background: var(--dan-encre); color: var(--dan-papier); border-color: var(--dan-encre); font-weight: 700; }
.dan-bulle-ecrire {
  margin-top: 9px; display: flex; align-items: center; gap: 8px;
  background: var(--dan-surface); border: 1px solid var(--dan-filet-fort);
  border-radius: 999px; padding: 5px 5px 5px 16px;
}
.dan-bulle--appel .dan-bulle-ecrire { display: none; }
.dan-bulle-ecrire input {
  flex: 1 1 auto; border: 0; outline: none; background: transparent;
  font-family: inherit; font-size: 16px; color: var(--dan-encre); min-height: 40px; min-width: 0;
}
.dan-bulle-ecrire input::placeholder { color: var(--dan-encre-2); }
.dan-bulle-envoyer {
  width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none;
  background: var(--dan-encre); color: var(--dan-papier);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
/* Barre d'appel de la vue agrandie */
.dan-appel-barre {
  display: flex; gap: 10px; justify-content: center;
  padding: 10px 20px 2px; flex: none;
}
@media (prefers-reduced-motion: reduce) {
  .dan-bulle { animation: none; }
}
