body, button, input, textarea, select, .message, .message.user, .message.assistant {
  font-family: 'Montserrat', 'Segoe UI Emoji', Arial, sans-serif !important;
}


:root {
  --clr-primary: #654BDE;        /* Header et zones principales */
  --clr-primary-light: #7c66e3;  /* Variante claire du violet */
  --clr-accent: #654BDE;         /* Boutons principaux et accents */
  --clr-accent-dark: #513ab2;    /* Survol des boutons, version foncée */
  --clr-bg: #f3f4f6;
  --clr-surface: #fff;
  --clr-surface-alt: #ede7fd;    /* Fond messages utilisateur (clair violet) */
  --clr-border: #e5e7eb;
  --clr-text: #111827;           /* ✅ Texte principal */
  --clr-subtle: #6b7280;         /* ✅ Texte secondaire */
  --clr-panel: #f8fafc;          /* ✅ Panneaux et surfaces */
  --clr-bubble: #f1f5f9;         /* ✅ Bulles de chat */
  --clr-placeholder: #9ca3af;    /* ✅ Placeholders */
  --radius-lg: 1.25rem;
  --radius-md: 0.75rem;
  --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.05);
  --shadow-header: 0 4px 8px rgba(0, 0, 0, 0.1);
  --header-height: 82px;
  --footer-height: 110px;
}


.attached-files {
  display: none;
  width: 100%;
  padding: 2px 0 2px 0;
  gap: 0.5rem;
  overflow-x: auto;
  max-height: 90px;
}
.attached-files.has-files {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

.file-item {
  background: var(--clr-surface-alt);
  border-radius: 12px;
  padding: 0.3rem 0.9rem 0.3rem 0.7rem;
  font-size: 0.99rem;
  display: flex;
  align-items: center;
  gap: 0.42rem;
  border: 1px solid var(--clr-border);
  margin-right: 0.6rem;
  white-space: nowrap;
}
.remove-file {
  background: transparent;
  color: #c44;
  border: none;
  font-size: 1.12rem;
  margin-left: 0.4rem;
  cursor: pointer;
}

.file-extracted {
  overflow-y: auto;
  max-height: 220px;
  background: #f8f7fc;
  border-radius: 8px;
  border: 1px solid #ece6fd;
  margin-top: 0.5em;
  font-size: 0.98em;
  padding: 0.5em 0.8em;
}


/* GENERAL */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background-color: var(--clr-bg);
  min-height: 100vh;
}

/* STRUCTURE */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-top: var(--header-height); /* Espace pour header fixé */
  transition: margin-left 0.23s;
}

.app-layout:not(.sidebar-open) .main-content,
.app-layout:not(.sidebar-open) footer { margin-left: 0; }


.sidebar-toggle:hover { background: var(--clr-surface-alt);}
.sidebar-toggle svg { display: block; stroke: #fff; transition: stroke 0.15s; }
.sidebar-toggle:hover svg { stroke: var(--clr-accent); }

/* SIDEBAR */
.sidebar-history {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 270px;
  background: #fff;
  border-right: 1.5px solid var(--clr-border);
  box-shadow: 3px 0 16px rgba(13, 28, 63, 0.04);
  z-index: 100;
  padding: 1.6rem 0 1.6rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-height: 100vh;
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.23s, opacity 0.22s;
}
.app-layout.sidebar-open .sidebar-history {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.sidebar-title { font-size: 1.2rem; font-weight: 600; color: var(--clr-primary); margin-bottom: 1rem; }
#historyList { flex: 1; overflow-y: auto; padding-right: 0.5rem; }
.history-item {
  background: var(--clr-surface-alt);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  border: 1px solid var(--clr-border);
  transition: background 0.2s, border 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.history-item:hover { background: #e0e7ef; border-color: var(--clr-accent);}
.history-item-title { font-weight: 500; font-size: 1.03rem; color: var(--clr-primary-light); margin-bottom: 0.18rem;}
.history-item-date { color: #64748b; font-size: 0.9rem; }
.history-item-preview {
  color: #52525b;
  font-size: 0.97rem;
  font-style: italic;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Sidebar masquée sur mobile */
@media (max-width: 900px) {
  .sidebar-history { display: none !important; }
  .app-layout.sidebar-open .main-content,
  .app-layout.sidebar-open footer { margin-left: 0 !important; }
  .sidebar-toggle { padding-left: 6px; margin-right: 0; }
}

/* CHAT AREA */
main#chat {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding: 3.5rem 2rem 2rem 2rem;
  overflow-y: auto;
  min-height: 0;
  max-height: calc(100vh - var(--header-height) - var(--footer-height));
  box-sizing: border-box;
}


.error {
  align-self: flex-start;
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.success {
  align-self: flex-start;
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.typing-indicator {
  font-style: italic;
  color: #6b7280;
  font-size: 0.95rem;
  animation: blink 1s infinite alternate;
}

/* ==== FOOTER ==== */
footer {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0.55rem 1rem 0.5rem 1rem;
  background: linear-gradient(135deg, #fff 0%, #f7faff 100%);
  border-top: 1px solid var(--clr-border);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.07);
  margin-top: auto;
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 100;
  min-width: 0;
  box-sizing: border-box;
  height: var(--footer-height);
}

/* INPUT BAR */
.input-bar {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0.55rem 0;
  padding: 0.3rem 0.7rem;
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(40,56,100,0.08);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-sizing: border-box;
}

.input-bar textarea {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 46px;
  border-radius: 1.5rem;
  border: 1.3px solid #d1d5db;
  background: #fff;
  font-size: 1.19rem;
  line-height: 1.55;
  padding: 0.45rem 1rem;
  transition: border-color 0.16s, box-shadow 0.16s;
  box-shadow: none;
  width: 100%;
  margin: 0 0.2rem;
  box-sizing: border-box;
}

.file-btn, .send-btn { flex-shrink: 0; }
.send-btn {
  background: var(--clr-accent);
  color: #fff;
  border: none;
  border-radius: 1.5rem;
  padding: 0.68rem 1.6rem;
  font-size: 1.09rem;
  font-weight: 500;
  cursor: pointer;
  margin-left: 0.4rem;
  transition: background 0.17s, box-shadow 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(37,99,235,0.09);
}
.send-btn:hover { background: var(--clr-accent-dark); }
.file-btn {
  background: #e6efff;
  color: var(--clr-accent);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.38rem;
  margin: 0 0.11rem;
  transition: background 0.18s, color 0.15s;
  box-shadow: 0 2px 7px rgba(37,99,235,0.09);
}
.file-btn:hover, .file-btn:focus { background: var(--clr-accent); color: #fff; }
.file-input { display: none !important; }
.attached-files { display: none; }
.attached-files.has-files { display: flex; }

/* Responsive */
@media (max-width: 900px) {
  .input-bar {
    max-width: 98vw;
    min-width: 0;
    padding: 0.7rem 0.3rem;
    gap: 0.45rem;
    flex-direction: column;
    align-items: stretch;
  }
  .send-btn {
    width: 100%;
    margin-left: 0;
    margin-top: 0.7rem;
  }
  .input-bar textarea {
    min-height: 64px;
    font-size: 1.05rem;
    padding: 1.05rem;
  }
  }


/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px);}
  to { opacity: 1; transform: translateY(0);}
}
@keyframes blink {
  from { opacity: 0.5; }
  to { opacity: 1; }
}
.readonly-banner {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  border-radius: var(--radius-md);
  margin: 1rem 2rem 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.input-bar.readonly {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.1);
}

.input-bar.readonly textarea,
.input-bar.readonly button {
  cursor: not-allowed;
}

#resumeConversationBtn {
  display: none;
  position: fixed;
  top: calc(var(--header-height) + 10px);
  right: 1.5rem;
  z-index: 200;
  background-color: #fef9c3;
  color: #92400e;
  font-weight: 500;
  border: 1.5px solid #fde68a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}
#resumeConversationBtn:hover {
  background-color: #fde68a;
  color: #7c2d12;
  border-color: #facc15;
}

/* Amélioration du bouton "Revenir à la conversation en cours" */
.resume-button {
  background-color: #0a84ff;
  color: white;
  font-weight: 500;
  padding: 0.55rem 1.2rem;
  border-radius: 10px;
  margin-left: 0.6rem;
  display: none;
  transition: background-color 0.25s ease;
}

.resume-button:hover {
  background-color: #006ee6;
}
/* === MENU KEBAB UNIFIÉ === */
.menu-wrapper {
  position: relative;
  margin-right: 1rem;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--clr-text, #333);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color 0.2s;
  font-size: 1.2rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

#menuDropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 9999;
  background: #10131a;
  color: #e6e9f2;
  min-width: 240px;
  border: 1px solid #1f2430;
  border-radius: 12px;
  padding: 0.35rem;
  box-shadow: 0 14px 40px rgba(0,0,0,0.35);
}

#menuDropdown.open {
  display: flex;
  flex-direction: column;
}

#menuDropdown button {
  all: unset;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: inherit;
}

#menuDropdown button:hover {
  background: #181d27;
}

/* Mode sombre */
body.dark-mode #menuDropdown {
  background: #1a1d29;
  border-color: #2d3748;
  color: #e2e8f0;
}

body.dark-mode #menuDropdown button:hover {
  background: #2d3748;
}

body.dark-mode .menu-toggle {
  color: #e2e8f0;
}

body.dark-mode .menu-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}
/* Styles pour les boutons spéciaux dans le menu */
#menuDropdown button.danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

#menuDropdown button.danger:hover {
  background: #fee2e2;
}


.header-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.celia-logo {
  height: 64px;
  object-fit: contain;
  display: block;
}

.drop-zone {
  display: none;   /* caché par défaut */
  width: 100%;
  min-height: 62px;
  background: #eef6ff;
  color: #344054;
  border: 2px dashed var(--clr-accent);
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: 1.08rem;
  line-height: 60px;
  margin: 0.7rem 0 1.3rem 0;
  transition: border-color 0.18s, background 0.18s;
  cursor: pointer;
  z-index: 150;
  position: relative;
}
.drop-zone.active {
  display: block; /* visible quand active */
  border-color: #34aaff;
  background: #dbeafe;
  color: #1e40af;
}
pre {
  font-family: "Fira Mono", "Menlo", "Consolas", monospace;
  font-size: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: none;
  border: none;
  margin: 0;
  padding: 0;
  max-width: 100%;
}
.file-extracted {
  overflow-x: auto;
  max-width: 100%;
}
/* === PAGE DE SÉLECTION DES MODULES (home.html) — CORRIGÉ === */

.home-selector .app-grid {
  display: grid;
  grid-template-columns: repeat(3, 160px);
  gap: 40px;
  justify-content: center;
  margin-top: var(--header-height); /* ✅ corrige le chevauchement */
}


.home-selector .app-card {
  background-color: var(--clr-surface);
  border-radius: var(--radius-lg);
  width: 160px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  color: var(--clr-primary);
  font-size: 1rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
}


.home-selector .app-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}


body.dark-mode .home-selector .app-card:hover *,
body.dark-mode .home-selector .app-card:hover span {
  color: white !important;
  fill: white !important;
}


/* icône uniquement */
.home-selector .app-card > span.material-symbols-outlined {
  font-size: 2.4rem;
  margin-bottom: 10px;
}



.home-selector header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--clr-primary);
  margin-bottom: 0.5rem;
}

.home-selector header p {
  font-size: 1.1rem;
  color: var(--clr-subtle);
  margin: 0;
}
.page-below-header {
  padding-top: var(--header-height); /* ✅ pousse le contenu réel vers le bas */
}

/* 🔁 Vidéo plein écran en fond */
#bgVideo {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 100vw;
  min-height: 100vh;
  object-fit: cover;
  z-index: -1;
}

/* ✅ S'assurer que le container est au-dessus */
.login-container {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.88); /* Légère transparence */
  -webkit-backdrop-filter: blur(5px);    /* ✅ pour Safari/Chrome */
  backdrop-filter: blur(5px);            /* ✅ pour tous les autres */
}


.sidebar-new-btn {
  background-color: var(--clr-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background 0.18s, box-shadow 0.2s;
  width: calc(100% - 1.2rem);
  margin-left: 0.1rem;
  text-align: left;
}

.sidebar-new-btn:hover {
  background-color: var(--clr-accent-dark);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}


body.dark-mode {
  --clr-bg: #0e121a;
  --clr-text: #f1f1f1;
  --clr-panel: #1c1f26;
  --clr-border: #3c3f47;
  --clr-accent: #836fff; /* ton violet */
  --clr-bubble: #22252d;
  --clr-placeholder: #aaa;
  --clr-surface: #1e1e1e;
}

body.dark-mode {
  background-color: var(--clr-bg);
  color: var(--clr-text);
}

/* Messages */
body.dark-mode .message {
  background: var(--clr-bubble);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}

/* Barre d'entrée (input-bar + textarea) */
body.dark-mode .input-bar {
  background: var(--clr-panel);
  border-top: 1px solid var(--clr-border);
  box-shadow: none;
}

body.dark-mode .input-bar textarea {
  background-color: var(--clr-surface);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
  box-shadow: none;
}

body.dark-mode .input-bar textarea::placeholder {
  color: var(--clr-placeholder);
}

body.dark-mode .input-bar input::placeholder {
  color: var(--clr-placeholder);
}

/* Bouton d'envoi */
body.dark-mode .send-btn {
  background-color: var(--clr-accent);
  color: white;
}

/* Sidebar */
body.dark-mode .sidebar-history {
  background-color: var(--clr-panel);
  color: var(--clr-text);
  border-right: 1px solid var(--clr-border);
}

/* Fichiers */
body.dark-mode .file-item {
  background-color: var(--clr-panel);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}

/* Bannière de lecture seule */
body.dark-mode .readonly-banner {
  background: #2d2f39;
  color: var(--clr-text);
}
body.dark-mode footer {
  background: var(--clr-panel) !important;
  border-top: 1px solid var(--clr-border) !important;
  box-shadow: none !important;
}
.chart-wrapper {
  max-width: 700px;
  margin: 0 auto;
  height: 280px;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}
.chart-card {
  padding: 1.5rem;
  border-radius: 1rem;
  background-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px); /* ✅ Compatibilité Safari */
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.chart-card:hover {
  transform: scale(1.02);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 💡 Deux colonnes fixes */
  gap: 2rem;
}

/* === DARK MODE : Cards - hover ultra propre === */
body.dark-mode .home-selector .app-card {
  background-color: var(--clr-surface);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
  transition: background 0.23s, box-shadow 0.23s, border-color 0.22s;
}

body.dark-mode .home-selector .app-card:hover {
  background-color: var(--clr-accent);
  color: #fff !important;
  border-color: var(--clr-accent);
  box-shadow: 0 12px 24px rgba(131, 111, 255, 0.24);
  /* accent violet très léger pour l'ombre */
}

body.dark-mode .home-selector .app-card:hover *,
body.dark-mode .home-selector .app-card:hover span {
  color: #fff !important;
  fill: #fff !important;
  stroke: #fff !important;
}

/* Spécial pour SVGs */
body.dark-mode .home-selector .app-card:hover svg {
  fill: #fff !important;
  stroke: #fff !important;
}
/* ===== ALIGNEMENT PRO "AVATAR + BULLE" ===== */
.message-row {
  display: flex;
  align-items: flex-start;      /* AVATAR EN HAUT */
  gap: 0.95rem;                 /* Plus d'espace avatar <-> bulle */
  margin-bottom: 1.3rem;
  width: 100%;
  padding-left: 0.3px;           /* Plus d'air côté gauche */
  padding-right: 18px;
}

.message-row.user {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.message-row.assistant {
  flex-direction: row;
  justify-content: flex-start;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  margin-top: 0;
  box-shadow: 0 2px 10px rgba(90,90,90,0.09);
}

.message {
  display: block;
  max-width: 920px;
  min-width: 150px;
  padding: 0.55rem 2rem 0.5rem 1.3rem;  /* <--- padding-bottom réduit */
  border-radius: 1.3rem 1.4rem 1.2rem 1.4rem;
  line-height: 1.52;
  word-break: break-word;
  box-shadow: 0 2px 14px rgba(0,0,0,0.07);
  font-size: 1.13rem;
  margin: 0;
}


.message > *:first-child,
.message p:first-child {
  margin-top: 0 !important;
}

.message > *:last-child,
.message p:last-child {
  margin-bottom: 0 !important;
}

.message.user {
  background: var(--clr-surface-alt);
  color: #222243; /* texte foncé en mode clair */
  margin-left: auto;
  border: 1px solid var(--clr-accent);
  border-bottom-right-radius: 0.5rem;
  border-top-right-radius: 1.45rem;
  border-top-left-radius: 1.45rem;
  border-bottom-left-radius: 1.45rem;
}

.message.assistant {
  background: var(--clr-surface);
  color: #111827;
  margin-right: auto;
  border: 1px solid var(--clr-border);
  border-bottom-left-radius: 0.5rem;
  border-top-right-radius: 1.45rem;
  border-top-left-radius: 1.45rem;
  border-bottom-right-radius: 1.45rem;
}

/* Effet dark mode pour la bulle */
body.dark-mode .message.user {
  background: #4b4587;
  color: #fff;
  border: 1px solid var(--clr-accent);
}
body.dark-mode .message.assistant {
  background: #232534;
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}

/* Responsive, pour que ça reste "chat" sur mobile */
@media (max-width: 600px) {
  .message {
    max-width: 97vw;
    font-size: 0.96rem;
    padding: 0.85rem 0.7rem;
  }
  .avatar {
    width: 32px;
    height: 32px;
  }
}
.qpoqqcc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.6;
}

.qpoqqcc-table th,
.qpoqqcc-table td {
  text-align: left;
  padding: 12px 16px;
  vertical-align: top;
  border: 1px solid var(--clr-border);
}

/* Largeur personnalisée des colonnes */
.qpoqqcc-table th:nth-child(1),
.qpoqqcc-table td:nth-child(1) {
  width: 15%;
}

/* Colonne "Synthèse" */
.qpoqqcc-table th:nth-child(2),
.qpoqqcc-table td:nth-child(2) {
  width: 40%;
}

/* Colonne "Score" */
.qpoqqcc-table th:nth-child(3),
.qpoqqcc-table td:nth-child(3) {
  width: 10%;
}

/* Colonne "Pondération" */
.qpoqqcc-table th:nth-child(4),
.qpoqqcc-table td:nth-child(4) {
  width: 35%;
}


.qpoqqcc-table th {
  background-color: #343a40;
  color: #fff;
}

.qpoqqcc-table td {
  background-color: var(--clr-surface);
  color: #1f2937;
}

body.dark-mode .qpoqqcc-table td {
  background-color: var(--clr-bubble);
  color: var(--clr-text);
}

body.dark-mode .qpoqqcc-table th {
  background-color: #1e1e2f;
  color: #fff;
}
.admin-badge {
  background: #fde68a;        /* Jaune clair */
  color: #92400e;             /* Marron foncé */
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: 0.5rem;
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
/* ... ton CSS existant ... */

/* === Sous-menu Qualification (home.html) === */
.submenu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 0.5rem;
}
.hidden { display: none; }

.btn-sub {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.btn-sub:hover {
  background: var(--clr-accent);
  color: #fff;
}

/* Dark mode */
body.dark-mode .btn-sub {
  background: var(--clr-panel);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}
body.dark-mode .btn-sub:hover {
  background: var(--clr-accent);
  color: #fff;
}
/* Uniformiser la taille de la tuile Qualification */
#qualificationTile {
  width: 160px;   /* identique aux autres */
  height: 160px;  /* identique aux autres */
  position: relative;
}

/* Sous-menu flottant sous la tuile */
#qualificationMenu {
  position: absolute;
  top: 100%;      /* juste sous la tuile */
  left: 0;
  right: 0;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  margin-top: 8px;
  padding: 8px;
  box-shadow: var(--shadow-sm);
  z-index: 50;
}
/* Style du bouton-titre dans la tuile Qualification */
#qualificationToggle {
  all: unset; /* supprime les styles par défaut du bouton */
  display: flex;
  align-items: center;
  gap: .5rem;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: inherit; /* reprend la couleur de la tuile */
  text-align: center;
}

#qualificationToggle .material-symbols-outlined {
  font-size: 18px;
  opacity: .7;
}
:root {
  --routine-banner-h: 48px;   /* hauteur du bandeau */
}

/* Bandeau visible uniquement en mode routine */
.routine-banner { display: none; }
.routine-mode .routine-banner {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--header-height)); /* juste sous le header fixe */
  height: var(--routine-banner-h);
  align-items: center;
  justify-content: center;
  gap: .6rem;
  background: #6c4ff7;    /* violet ATRYON */
  color: #fff;
  font-weight: 600;
  z-index: 111;            /* au-dessus du contenu, sous/au-dessus du header selon ton z-index */
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  padding: 0 .8rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.routine-banner .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e;       /* petit point vert */
}

/* Décaler le contenu et recalculer la hauteur utile du chat */
.routine-mode main#chat {
  /* on ajoute un offset en haut pour ne pas être sous le bandeau */
  padding-top: calc(3.5rem + var(--routine-banner-h));
  /* on retire le bandeau de la hauteur max calculée */
  max-height: calc(100vh - var(--header-height) - var(--footer-height) - var(--routine-banner-h));
}

/* Si tu utilises aussi .page-below-header sur cette page */
.routine-mode .page-below-header {
  padding-top: calc(var(--header-height) + var(--routine-banner-h));
}

/* Mobile: un peu plus compact */
@media (max-width: 600px) {
  :root { --routine-banner-h: 44px; }
}
.menu-dropdown button { display:flex; align-items:center; gap:.5rem; }
.menu-dropdown button.danger {
  background:#fef2f2; color:#991b1b; border:1px solid #fecaca;
}
.menu-dropdown button.danger:hover { background:#fee2e2; }
.file-attachment.only-name {
  display:inline-block;
  padding:.25rem .5rem;
  border-radius:12px;
  background:rgba(255,255,255,.06);
}
.file-attachment.only-name .file-name {
  font-weight:600;
  text-decoration:none;
}
.file-attachment.only-name .file-name:hover { text-decoration:underline; }
/* ===== QPOQQCC Progress Bar ===== */
/* ===== QPOQQCC – Barre simple et sobre ===== */
:root { --qpoqqcc-h: 56px; } /* sera recalculé en JS si tu veux, sinon 56px va bien */

#qpoqqcc-progress{
  position: sticky;
  top: calc(var(--header-height) + 8px);
  z-index: 105; /* header = 110 */
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  margin: .75rem 2rem 0;           /* aligné avec main#chat */
  box-shadow: var(--shadow-sm);
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* En mode routine : tenir compte du bandeau */
.routine-mode #qpoqqcc-progress{
  top: calc(var(--header-height) + var(--routine-banner-h) + 8px);
}

/* Titre + pourcentage */
#qpoqqcc-progress .progress-header{
  display:flex; align-items:center; justify-content:space-between;
  font-weight:600; color:#111827;
  margin-bottom:6px;
}

/* On cache les pastilles (segments) pour un rendu sobre */
#qpoqqcc-progress .segments{ display:none !important; }

/* Rail + barre de progression */
#qpoqqcc-progress .linear{
  position: relative; height: 8px;
  background: var(--clr-border);
  border-radius: 999px; overflow: hidden;
}
#qpoqqcc-progress .linear .bar{
  position:absolute; left:0; top:0; bottom:0; width:0%;
  background: linear-gradient(90deg, var(--clr-accent), #10b981);
  transition: width .35s ease;
  border-radius: 999px;
}

/* Responsive */
@media (max-width: 900px){
  #qpoqqcc-progress{ margin: .5rem 1rem 0; }
}

/* Dark mode */
body.dark-mode #qpoqqcc-progress{
  background: var(--clr-panel);
  border-color: var(--clr-border);
  box-shadow: none;
}
body.dark-mode #qpoqqcc-progress .progress-header{ color: var(--clr-text); }
body.dark-mode #qpoqqcc-progress .linear{ background: var(--clr-border); }

/* Empêche le chevauchement avec la zone de chat */
.with-qpo-bar main#chat{
  max-height: calc(100vh - var(--header-height) - var(--footer-height) - var(--qpoqqcc-h));
}
.routine-mode.with-qpo-bar main#chat{
  max-height: calc(100vh - var(--header-height) - var(--footer-height) - var(--routine-banner-h) - var(--qpoqqcc-h));
}
.with-qpo-bar .page-below-header{
  padding-top: calc(var(--header-height) + var(--qpoqqcc-h));
}
/* --- INPUT AUTO-GROW --- */
.input-bar textarea{
  flex: 1 1 0%;
  width: 100%;
  min-width: 0;
  /* Hauteurs : on laisse le JS piloter, mais on borne avec un max raisonnable */
  min-height: 46px;
  height: auto;            /* clé pour l'autogrow */
  max-height: 40vh;        /* ~comme ChatGPT, 35–45vh fonctionne bien */
  overflow-y: hidden;      /* pas de scroll tant qu'on n'a pas atteint max */
  resize: none;            /* l'utilisateur ne "casse" pas le calcul */
  border-radius: 1.5rem;
  border: 1.3px solid #d1d5db;
  background: #fff;
  font-size: 1.19rem;
  line-height: 1.55;
  padding: 0.45rem 1rem;
  transition: border-color .16s, box-shadow .16s;
  box-shadow: none;
  margin: 0 .2rem;
  box-sizing: border-box;
}

/* Quand on a atteint le plafond, on active le scroll vertical proprement */
.input-bar textarea.is-scroll {
  overflow-y: auto;
}



/* ✅ Évite le débordement lié à 100vw */
footer {
  width: 100% !important;   /* à la place de 100vw */
  left: 0; right: 0;        /* on garde le footer full-width sans overflow */
}

/* ✅ Centre et borne la barre d'entrée comme ChatGPT */
footer .input-bar {
  max-width: min(900px, 92vw);  /* borné et centré */
  margin: 0.55rem auto;         /* centre horizontalement */
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--clr-border);
}

/* ✅ Effet focus propre (anneau) */
footer .input-bar:focus-within {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(101,75,222,.15);
}

/* ✅ Textarea autogrow "ChatGPT-like" (garde ton JS d'auto-size) */
footer .input-bar textarea{
  height: auto !important;
  max-height: 40vh !important;
  overflow-y: hidden !important;
  resize: none !important;
  outline: none;                    /* retire l'outline bleu */
  
}

footer .input-bar textarea.is-scroll { overflow-y: auto !important; }

/* ✅ Espace sous le chat = hauteur réelle du footer */
main#chat::after { height: var(--footer-height); }

/* Mobile: on garde une pilule (pas 30%) */
@media (max-width: 900px) {
  footer .input-bar { max-width: 96vw; }
}
/*#qpoqqcc-progress .linear .bar.initial {
  width: 0% !important;
}*/
#closeConversationBtn {
  background: #f87171;
  color: #fff;
  border: none;
  border-radius: 2em;
  font-size: 1em;
  font-weight: 600;
  padding: 0 1.3em;
  height: 2.4em;
  min-width: 70px;
  margin-left: .5em;
  cursor: pointer;
  transition: background .18s;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,.03);
  display: inline-block;
  outline: none;
}
#closeConversationBtn:hover, #closeConversationBtn:focus {
  background: #ef4444;
}
/* ===================== FIX PACK ===================== */
/* 1) Header vraiment centré, sans absolus */
.header-with-centered-logo{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background-color: var(--clr-primary);
  display: grid;                       /* <-- grid 3 colonnes */
  grid-template-columns: 1fr auto 1fr; /* gauche | centre | droite */
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-header);
  z-index: 110;
  padding: 0 1.5rem;
}

/* Le logo reste au centre */
.header-logo-wrapper{ justify-self: center; display:flex; align-items:center; }
.header-with-centered-logo .celia-logo{ height: 56px; max-width: 200px; object-fit: contain; }

/* Bouton menu à gauche, actions à droite — plus d'absolu */
.header-left{ position: static !important; transform: none !important; justify-self: start; }
.header-with-centered-logo .header-actions{ position: static !important; transform: none !important; justify-self: end; }

/* 2) La sidebar est un overlay qui NE pousse PAS le layout */
.sidebar-history{
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 270px;
  transform: translateX(-110%);  /* cachée par défaut */
  opacity: 0; pointer-events: none;
  transition: transform .23s ease, opacity .22s ease;
  z-index: 100;                  /* sous le header */
}
.app-layout.sidebar-open .sidebar-history{
  transform: translateX(0);
  opacity: 1; pointer-events: auto;
}

/* ❌ Annule tout décalage du contenu quand la sidebar s'ouvre */
.app-layout.sidebar-open .main-content,
.app-layout.sidebar-open footer{
  margin-left: 0 !important;
  width: 100% !important;
}

/* 3) Le contenu tient compte du header fixe (et éventuel bandeau routine) */
.main-content{
  margin-top: var(--header-height) !important;
}



/* 4) Footer full width, jamais en 100vw */
footer{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  width: 100% !important;
  height: var(--footer-height);
  box-sizing: border-box;
}
/* Si sidebar ouverte, on ne touche pas au footer */
.app-layout.sidebar-open footer{
  margin-left: 0 !important;
  width: 100% !important;
}

/* 5) Zone de chat : espace sous le header + au-dessus du footer */
main#chat{
  padding: 2rem 2rem 2rem 2rem; /* marge intérieure */
  max-height: calc(100vh - var(--header-height) - var(--footer-height));
}


/* 6) Bouton menu plus "classique" (évite l'effet pill flottant décentré) */
.sidebar-toggle{
  background: none;
  border: none;
  height: 44px; width: 44px;
  display:flex; align-items:center; justify-content:center;
  border-radius: 10px;
  cursor: pointer;
}
.sidebar-toggle:hover{ background: rgba(255,255,255,.15); }

/* 7) Sécurité: aucun style ne doit re-déplacer le header ou le footer */
.centered-header{ display:none !important; }  /* tu avais deux systèmes : on n'en garde qu'un */
/* (garde uniquement .header-with-centered-logo) */


/* ===== HOTFIX HEADER GLOBAL ===== */

/* 1) On fige le système centré si .header-with-centered-logo est présent */
.header-with-centered-logo{
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  align-items: center !important;
  justify-content: center !important;
}
.header-with-centered-logo .header-left{
  position: static !important;
  transform: none !important;
  justify-self: start !important;
}
.header-with-centered-logo .header-logo-wrapper{
  justify-self: center !important;
  display: flex !important; align-items: center !important;
}
.header-with-centered-logo .header-actions{
  position: static !important;
  transform: none !important;
  justify-self: end !important;
}

/* 2) Si une page utilise encore header.header-main, on neutralise l'absolu hérité */
header.header-main .header-left{
  position: static !important;
  left: auto !important; top: auto !important; transform: none !important;
}
header.header-main .header-right{
  margin-left: auto !important;
}

/* 3) Bouton menu « … » : garantie côté droit */
.menu-wrapper{ margin-right: 0 !important; }
.header-actions .menu-wrapper,
.header-right .menu-wrapper{
  margin-left: .75rem !important;
}
.header-actions{ right: 1.5rem; }

/* 4) Sidebar = overlay (aucun décalage du layout) */
.app-layout.sidebar-open .main-content,
.app-layout.sidebar-open footer{
  margin-left: 0 !important;
  width: 100% !important;
}

/* 5) Footer sans overflow horizontal */
footer{
  width: 100% !important;
  left: 0 !important; right: 0 !important;
}

/* 6) Textarea : une seule source de vérité + pas de border-radius 30% en mobile */
.input-bar textarea{
  border-radius: 1.5rem !important;
}


/* 7) On évite tout scroll horizontal global */
html, body{ overflow-x: hidden !important; }

/* Ajoute ces règles tout en bas de ton CSS (après tout le reste) */
.header-with-centered-logo {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.header-logo-wrapper {
  grid-column: 2;         /* force le logo au centre */
  justify-self: center;
}

.header-actions {
  grid-column: 3;         /* force les actions à droite */
  justify-self: end;
}
/* === Unifier la taille du logo dans tous les headers === */
.celia-logo {
  height: 64px;
  max-height: calc(var(--header-height) - 18px); /* garde une marge dans le header */
  width: auto;
  display: block;
}

/* Neutralise les anciennes sur-spécificités */
.header-with-centered-logo .celia-logo,
header.header-main .celia-logo {
  height: 64px !important;
  max-height: calc(var(--header-height) - 18px) !important;
}

/* Option mobile : un poil plus compact */
@media (max-width: 600px) {
  .celia-logo {
    height: 48px !important;
    max-height: 48px !important;
  }
}
/* === TEST.HTML : bouton menu (gauche) === */
.coachbot-app .header-with-centered-logo .header-left{
  justify-self: start;
  padding-left: 1rem;
}

/* Taille + couleur + centrage du hamburger */
.coachbot-app .header-with-centered-logo .sidebar-toggle{
  width: 48px !important;
  height: 48px !important;
  border: none !important;
  border-radius: 10px;
  background: transparent !important;
  color: #fff !important;          /* hamburger blanc */
  display: flex; align-items: center; justify-content: center;
  font-size: 28px !important;       /* plus grand pour le caractère ☰ */
  line-height: 1 !important;
  padding: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
}

.coachbot-app .header-with-centered-logo .sidebar-toggle:hover{
  background: rgba(255,255,255,.15) !important;   /* léger hover */
}

.coachbot-app .header-with-centered-logo .sidebar-toggle:active{
  background: rgba(255,255,255,.22) !important;
}

/* Neutralise ton ancien hover violet clair qui prenait le dessus */
.sidebar-toggle:hover { background: initial; }
/* Avatar par défaut = coach-bot */
.message-row .avatar{
  width: 38px; height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

/* Si tu veux un avatar différent côté utilisateur (facultatif) */
.message-row.user .avatar{
  background-image: url("user.png"); /* ou retire cette règle si tu veux le bot des deux côtés */
}
/* HOME UNIQUEMENT : cacher barre QPO et bouton menu gauche */
.home-selector #qpoqqcc-progress,
.home-selector .header-left,
.home-selector .sidebar-toggle {
  display: none !important;
}

/* Comme il n'y a pas de barre QPO sur home, gardons juste l'offset du header */
.home-selector .page-below-header { 
  padding-top: var(--header-height) !important; 
}

/* Sécurité : si une classe "with-qpo-bar" est ajoutée par erreur, on la neutralise visuellement sur home */
.home-selector.with-qpo-bar main#chat,
.home-selector.with-qpo-bar .page-below-header {
  max-height: calc(100vh - var(--header-height)) !important;
  padding-top: var(--header-height) !important;
}
/* Base avatar (taille + rendu image) */
.message-row .avatar{
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
/* Avatar : taille + rendu image */
.message-row {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin: 1rem 0;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* Bulle pour rester propre si pas déjà stylée */
.message {
  max-width: 920px;
  padding: .55rem 1rem;
  border-radius: 1.2rem;
  border: 1px solid var(--clr-border);
  background: var(--clr-surface);
}
.message.user {
  background: var(--clr-surface-alt);
  border-color: var(--clr-accent);
}
/* === Rail central façon ChatGPT ============================ */
:root{
  --chat-col: 860px;          /* largeur max de la colonne de messages */
  --page-pad: 32px;           /* marge horizontale de la page */
  --sidebar-w: 270px;         /* largeur de la sidebar */
  --sidebar-gap: 16px;        /* espace entre sidebar et contenu */
  --rail-left-gap: 12px;      /* espace entre sidebar et rail quand ouverte */
  --bubble-offset: 4px;       /* décalage esthétique léger (0–6px) */
}

/* 1) Colonne centrée par défaut */
main#chat{
  display:flex;
  flex-direction:column;
  align-items:center;                 /* centre le rail (état normal) */
  gap: 1.6rem;
  padding: 2rem var(--page-pad);
}
main#chat > .message-row,
#qpoqqcc-progress{
  width: min(var(--chat-col), 100% - (var(--page-pad) * 2));
  margin-left: auto;
  margin-right: auto;
}

/* 2) Sidebar ouverte → rail aligné à gauche contre la sidebar */
.app-layout.sidebar-open main#chat{
  align-items:flex-start;                                  /* rail collé à gauche */
  padding-left: calc(var(--sidebar-w) + var(--rail-left-gap));
  padding-right: var(--page-pad);
}
.app-layout.sidebar-open main#chat > .message-row,
.app-layout.sidebar-open #qpoqqcc-progress{
  margin-left: 0;                                          /* bord gauche commun */
  margin-right: auto;
  /* largeur du rail = fenêtre - sidebar - gap - padding droit */
  width: min(
    var(--chat-col),
    calc(100% - (var(--sidebar-w) + var(--rail-left-gap) + var(--page-pad)))
  );
}

/* 3) Léger décalage esthétique des bulles */
.message-row.assistant { transform: translateX(calc(-1 * var(--bubble-offset))); }
.message-row.user      { transform: translateX(var(--bubble-offset)); }

/* Bulles compactes + alignement avatar */
.message{
  padding: .95rem 1.15rem;
  line-height: 1.55;
}
.message-row + .message-row{ margin-top: .35rem; }
.message-row{ align-items:flex-start; }
.avatar{ margin-top: 2px; }

/* QPO collée au même rail, sous le header */
#qpoqqcc-progress{
  position: sticky;
  top: calc(var(--header-height) + 8px);
}
/* === Barre QPO alignée sur le rail des messages === */

/* Sidebar fermée : barre centrée */
.main-content #qpoqqcc-progress{
  width: min(var(--chat-col), 100% - (var(--page-pad) * 2)) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Sidebar ouverte : barre calée à gauche (au même rail que les bulles) */
.app-layout.sidebar-open .main-content #qpoqqcc-progress{
  margin-left: calc(var(--sidebar-w) + var(--rail-left-gap)) !important;
  margin-right: auto !important;
  width: min(
    var(--chat-col),
    calc(100% - (var(--sidebar-w) + var(--rail-left-gap) + var(--page-pad)))
  ) !important;
}

/* === Overrides spécifiques au mode Routine (harmonisés avec chat.html) === */
.routine-page .message.user {
  background: #6c43e0;
  color: #ffffff;
  border-color: #6c43e0;
}
.routine-page .message.assistant {
  background: #ffffff;
  color: #0f172a;
  border-color: var(--clr-border);
}
body.dark-mode .routine-page .message.user {
  background: #6c43e0;
  color: #ffffff;
  border-color: #6c43e0;
}
body.dark-mode .routine-page .message.assistant {
  background: #0b0f1a;
  color: #e6e9f2;
  border-color: #1f2937;
}
