/* ==========================================================================
   style.css — version optimisée (anti-régression)
   Objectif : garder tes styles tels quels + clarifier/structurer sans chambouler.
   - Ajout de variables (facile à ajuster)
   - Harmonisation légère des formulaires/boutons
   - Inbox : category-form, subject-input, historique (summary/chevron), lisibilité
   ========================================================================== */

:root{
    --bg: #f8f6fc;
    --text: #333;
    --primary: #7f5af0;
    --primary-dark: #6845d9;
    --title: #5a4db2;

    --border: #ddd;
    --border-soft: #e7e7ef;

    --card-bg: #fff;
    --shadow: 0 2px 5px rgba(0,0,0,0.05);

    --success: #4caf50;
    --success-dark: #3e8e41;
    --danger: #e53935;
    --danger-dark: #c62828;

    --soft-primary-bg: #faf9ff;
    --soft-primary-bg-2: #f3f1fd;
    --soft-primary-bg-3: #f7f4ff;
    --soft-success-bg: #f4fff7;

    --radius: 8px;
    --radius-lg: 12px;

    --font: "Segoe UI", sans-serif;
}

*{ box-sizing: border-box; }

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
}

/* === NAVIGATION === */
.nav-menu {
    background-color: var(--primary);
    padding: 12px 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.nav-menu a {
    color: white;
    font-weight: bold;
    text-decoration: none;
}

.nav-menu a:hover,
.nav-menu a.active {
    text-decoration: underline;
}

/* === CONTAINERS === */
.container {
    max-width: 1000px;
    margin: auto;
    padding: 20px;
}

h1, h2 {
    color: var(--title);
    margin-bottom: 20px;
}

/* === FORMULAIRES === */
.test-form,
.faq-form,
.filter-form {
    background-color: var(--card-bg);
    padding: 15px;
    border: 1px solid var(--border);
    margin-bottom: 30px;
    border-radius: var(--radius);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.filter-form select,
.filter-form input[type="text"],
.filter-form input[type="date"],
.test-form textarea,
.manual-form textarea,
.faq-form input,
.faq-form select {
    padding: 8px;
    border: 1px solid #aaa;
    border-radius: 6px;
    font-family: inherit;
    font-size: 15px;
    background-color: #fff;
}

.filter-form input[type="text"],
.filter-form input[type="date"] {
    width: 160px;
}

/* === BOUTONS === */
.test-form button,
.faq-form button,
.manual-form button,
.filter-form button,
.btn {
    background-color: var(--primary);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.25s ease, transform 0.05s ease;
}

.btn:hover,
.test-form button:hover,
.faq-form button:hover,
.manual-form button:hover,
.filter-form button:hover {
    background-color: var(--primary-dark);
}

.test-form button:active,
.faq-form button:active,
.manual-form button:active,
.filter-form button:active,
.btn:active {
    transform: translateY(1px);
}

.btn.red { background-color: var(--danger); }
.btn.red:hover { background-color: var(--danger-dark); }
.btn-success { background-color: var(--success); }
.btn-success:hover { background-color: var(--success-dark); }
.btn-danger { background-color: var(--danger); }
.btn-danger:hover { background-color: var(--danger-dark); }

.actions,
.bulk-actions {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.flash {
    background-color: #e8eaf6;
    color: #303f9f;
    padding: 10px;
    border-radius: 6px;
    margin: 20px auto;
    width: fit-content;
}

/* === MESSAGE === */
.message-card {
    background-color: var(--card-bg);
    border: 1px solid #ccc;
    padding: 15px;
    margin-bottom: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 15px;
}

.message-card p {
    margin: 6px 0;
    line-height: 1.4em;
}

.message-card strong {
    color: #2f2b55;
}

/* Neutralisation du rouge et style plus doux */
.message-card.human-required {
    border-left: 6px solid var(--primary);
    background-color: var(--soft-primary-bg-3);
    font-size: 16px;
    font-weight: 600;
    color: inherit;
    box-shadow: 0 2px 8px rgba(127, 90, 240, 0.10);
}

.message-card.replied {
    background-color: var(--soft-success-bg);
    border-left: 6px solid var(--success);
}

/* État pending sans rouge agressif */
.message-card.pending {
    background-color: var(--card-bg);
    border-left: 6px solid #d9d9f2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

/* === FORMULAIRE RÉPONSE MANUELLE === */
.manual-form {
    margin-top: 12px;
    padding: 12px;
    background-color: var(--soft-primary-bg-2);
    border-left: 4px solid var(--primary);
    border-radius: 6px;
}

.manual-form textarea {
    background-color: #fff;
    border: 1px solid #bbb;
    font-size: 14px;
    width: 100%;
    resize: vertical;
    margin-top: 6px;
}

.manual-form button {
    margin-top: 8px;
    background-color: var(--success);
    white-space: nowrap;
}

/* Hint : plus lisible sans agressivité */
.manual-form .hint {
    font-size: 13px;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background-color: #fff;
    border: 1px dashed var(--primary);
    color: #4a3f9a;
    font-weight: 600;
}

/* === BLOC RÉPONSE AUTOMATIQUE === */
.reponse-block {
    background-color: var(--soft-primary-bg-2);
    border-left: 4px solid var(--primary);
    padding: 10px;
    margin-top: 12px;
    border-radius: 6px;
}

/* === HISTORIQUE (neutre + lisible) === */
.history-block { 
    border: 1px solid var(--border-soft); 
    background: var(--soft-primary-bg); 
    padding: 10px; 
    border-radius: 10px; 
    margin-top: 10px;
}

.history-block summary {
    cursor: pointer;
    user-select: none;
    padding: 6px 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    list-style: none;
}

.history-block summary::-webkit-details-marker { display: none; }

/* Chevron léger sans dépendance */
.history-block summary:before {
    content: "▸";
    font-weight: 700;
    color: var(--primary);
    margin-right: 4px;
}
.history-block[open] summary:before { content: "▾"; }

.history-block summary small { color: #666; }

.response-item { 
    border-left: 4px solid #d9d9f2;
    background: #fff;
    padding: 8px 10px;
    border-radius: 8px;
    margin: 8px 0;
}

.response-item p { margin: 4px 0; }
.response-item small { color: #666; }

/* Supprime toute coloration spécifique manual/auto */
.response-item.manual,
.response-item.auto {
    border-left-color: #d9d9f2 !important;
    background: #fff !important;
    color: inherit !important;
}

/* === HINT TEXTE (fallback global) === */
.hint {
    font-size: 13px;
    color: #777;
    margin-top: 8px;
}

/* === PAGINATION === */
.pagination {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-weight: bold;
    flex-wrap: wrap;
}

.pagination a {
    background-color: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
}

.pagination a:hover {
    background-color: var(--primary-dark);
}

.pagination a:focus {
    outline: 3px solid rgba(127, 90, 240, 0.35);
    outline-offset: 2px;
}

/* === BADGES RÉPONSE === */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    line-height: 1;
    vertical-align: middle;
}

.badge-auto { background-color: var(--primary); }
.badge-manual { background-color: var(--success); }
.badge-faq { background-color: #3f51b5; }
.badge-gpt { background-color: #ff9800; }

/* === MESSAGE PAR SOURCE === */
.message-card[data-source="whatsapp"] { border-left: 6px solid #25D366; }
.message-card[data-source="email"] { border-left: 6px solid #4285F4; }
.message-card[data-source="test"] { border-left: 6px solid #aaa; }
.message-card[data-source="messenger"] { border-left: 6px solid #0084FF; }

/* === NAVBAR RESPONSIVE === */
.navbar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    background-color: #d9b3ff;
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: var(--radius-lg);
}

.navbar a {
    text-decoration: none;
    padding: 10px 16px;
    background-color: white;
    border-radius: 8px;
    color: #4b0082;
    font-weight: bold;
    transition: background-color 0.25s, color 0.25s;
}

.navbar a:hover {
    background-color: #f3e6ff;
}

.navbar a.active {
    background-color: #4b0082;
    color: white;
}

/* =======================================================================
   PATCH INBOX (ANTI-RÉGRESSION) — compléments manquants
   ======================================================================= */

.filters { margin-bottom: 18px; }

.filter-form label {
    font-weight: 600;
    color: #4a3f9a;
}

.filter-form button { white-space: nowrap; }

/* Subject input Email (inbox) */
.subject-input {
    width: 100%;
    max-width: 420px;
    padding: 8px;
    border: 1px solid #aaa;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    background-color: #fff;
}

/* Bloc catégorie (set_category) */
.category-form {
    margin-top: 12px;
    padding: 12px;
    background-color: var(--soft-primary-bg);
    border: 1px solid var(--border-soft);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
}

.category-form form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.category-form label {
    font-weight: 600;
    color: #4a3f9a;
}

.category-form select {
    padding: 8px;
    border: 1px solid #aaa;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    background-color: #fff;
}

/* === RESPONSIVE GENERAL === */
@media (max-width: 600px) {
    .container { padding: 10px; }

    .navbar,
    .nav-menu {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .navbar a {
        width: 90%;
        text-align: center;
    }

    .filter-form {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-form select,
    .filter-form input {
        width: 100%;
    }

    .pagination {
        gap: 8px;
    }

    .pagination a,
    .pagination strong {
        padding: 8px 12px;
        font-size: 14px;
    }

    .category-form form {
        flex-direction: column;
        align-items: stretch;
    }

    .category-form select,
    .subject-input {
        max-width: 100%;
        width: 100%;
    }

    .history-block summary {
        align-items: flex-start;
    }

    .history-block summary small {
        display: block;
        width: 100%;
        margin-left: 18px; /* alignement après chevron */
    }
}

/* --- Historique : séparateurs propres entre items --- */
.history-block .response-item {
    margin: 0;
    border-radius: 0;
    padding: 10px 12px;
    border-left: 4px solid #d9d9f2;
}

.history-block .response-item + .response-item {
    border-top: 1px dashed #d9d9f2;  /* ligne en tirets */
}

/* Optionnel : arrondis uniquement aux extrémités pour un rendu "bloc" */
.history-block .response-item:first-of-type {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.history-block .response-item:last-of-type {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.history-sep{
    border: 0;
    border-top: 2px dashed #d9d9f2;
    margin: 12px 0;
}

/* === PATCH HISTORIQUE : séparateurs + thread email === */
.history-sep{
    border-top: 1px dashed #d9d9f2;
    margin: 10px 0;
}

.badge-thread{
    background-color: #607d8b; /* neutre */
}

.response-thread .response-body-thread{
    white-space: pre-wrap;      /* garde les retours à la ligne */
    word-break: break-word;
    color: #444;
}

/* === CONVERSATION (inputs gauche / outputs droite) === */
.conversation {
  margin-top: 10px;
}

.bubble-row {
  display: flex;
  margin: 10px 0;
}

.row-in { justify-content: flex-start; }
.row-out { justify-content: flex-end; }

.bubble {
  width: 100%;
  max-width: 720px;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e7e7ef;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.bubble-in {
  border-left: 5px solid #d9d9f2;
  background: #ffffff;
}

.bubble-out {
  border-left: 5px solid #7f5af0;
  background: #f7f4ff;
}

.bubble-head {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.bubble-meta {
  color: #666;
  font-size: 12px;
}

.bubble-body {
  white-space: pre-wrap;
  line-height: 1.4em;
}

/* séparateur “ligne Maginot” */
.history-sep {
  border: 0;
  border-top: 2px dashed #d9d9f2;
  margin: 10px 0;
}

/* badge input */
.badge-in { background-color: #3f51b5; }

/* thread badge */
.badge-thread { background-color: #607d8b; }

/* =======================================================================
   PATCH CONVERSATION (INBOX) — à coller EN FIN de style.css
   Objectif :
   - affichage chat : inputs à gauche, outputs à droite
   - historique repliable, séparateurs propres
   - sans casser le design existant
   ======================================================================= */

/* Bloc conversation */
.conversation {
    margin-top: 12px;
    background: #faf9ff;
    border: 1px solid #e7e7ef;
    border-radius: 12px;
    padding: 10px;
}

/* Ligne (row) */
.bubble-row {
    display: flex;
    width: 100%;
    margin: 8px 0;
}

/* Inputs à gauche */
.row-in { justify-content: flex-start; }

/* Outputs à droite */
.row-out { justify-content: flex-end; }

/* Bulles */
.bubble {
    max-width: 78%;
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid #e7e7ef;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* Bulle input (client) */
.bubble-in {
    border-left: 4px solid #d9d9f2;
}

/* Bulle output (bot / humain) */
.bubble-out {
    border-left: 4px solid #7f5af0;
    background: #ffffff;
}

/* Header de bulle */
.bubble-head {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

/* Meta (date/canal) */
.bubble-meta {
    color: #666;
    font-size: 12.5px;
}

/* Body */
.bubble-body {
    white-space: pre-wrap; /* conserve retours à la ligne */
    word-break: break-word;
    line-height: 1.45em;
}

/* Badge pour messages reçus */
.badge-in {
    background-color: #6c6c93;
}

/* Badge Thread */
.badge-thread {
    background-color: #607d8b;
    color: #fff;
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

/* Historique repliable */
.history-toggle {
    margin-top: 10px;
    border-radius: 12px;
    border: 1px solid #e7e7ef;
    background: #f7f4ff;
    padding: 8px 10px;
}

.history-toggle summary {
    cursor: pointer;
    user-select: none;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    font-weight: 700;
    color: #2f2b55;
}

.history-toggle summary::-webkit-details-marker {
    display: none;
}

.history-toggle summary:before {
    content: "▸";
    font-weight: 900;
    color: #7f5af0;
    margin-right: 4px;
}

.history-toggle[open] summary:before {
    content: "▾";
}

/* Séparateur “ligne Maginot” */
.history-sep {
    border: none;
    border-top: 1px dashed #d9d9f2;
    margin: 10px 0;
}

/* Responsive : bulles plus larges */
@media (max-width: 600px) {
    .bubble { max-width: 96%; }
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: min(980px, 92vw);
  margin: 32px auto;
}

.card {
  border-radius: 18px;
  padding: 22px;
}

.hero { margin-bottom: 16px; }

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 12px;
}

.title { font-size: 28px; margin: 0 0 8px 0; }
.subtitle { opacity: 0.85; margin: 0 0 18px 0; line-height: 1.45; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
}

.meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

@media (min-width: 720px) {
  .meta { grid-template-columns: 1fr 1fr; }
}

.meta-item {
  padding: 12px;
  border-radius: 14px;
}

.meta-k { font-size: 12px; opacity: 0.75; margin-bottom: 6px; }
.meta-v { font-size: 14px; opacity: 0.95; }

.h2 { margin: 0 0 10px 0; font-size: 18px; }
.list { margin: 0; padding-left: 18px; opacity: 0.9; }
.footer { opacity: 0.55; font-size: 12px; margin-top: 12px; text-align: center; }

/* ===== Thread chat (Inbox) ===== */
.chat-thread {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
}

.chat-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: rgba(0,0,0,.45);
  font-size: 12px;
}
.chat-sep::before,
.chat-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(0,0,0,.08);
}

.chat-row {
  display: flex;
  margin: 10px 0;
}
.chat-row.left { justify-content: flex-start; }
.chat-row.right { justify-content: flex-end; }

.chat-bubble {
  max-width: 72%;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 6px 14px rgba(0,0,0,.05);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-row.left .chat-bubble {
  background: #f3f4f6;
}

.chat-row.right .chat-bubble {
  background: #efeaff; /* mauve clair */
  border-color: rgba(90,60,255,.18);
}

.chat-meta {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(0,0,0,.55);
  display: flex;
  gap: 8px;
}
.chat-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.6);
  font-size: 11px;
}



/* ==========================================================================
   NOUVEAUX STYLES — Inbox redesign + Conversation + Log + 360°
   ========================================================================== */

/* ── FLASH ── */
.flash { padding:10px 16px; border-radius:6px; margin:8px 0; font-size:14px; }
.flash-success { background:#d1fae5; color:#065f46; }
.flash-danger  { background:#fee2e2; color:#991b1b; }
.flash-warning { background:#fef3c7; color:#92400e; }
.flash-info    { background:#dbeafe; color:#1e40af; }

/* ==========================================================================
   INBOX — Layout centré colonne unique
   ========================================================================== */
.inbox-page { background:#f3f4f6; }

.inbox-layout {
  display:flex;
  flex-direction:column;
  height:calc(100vh - 52px);
  overflow:hidden;
  padding:16px 20px;
  box-sizing:border-box;
}

/* ── Carte centrale ── */
.inbox-sidebar {
  background:#fff;
  border-radius:14px;
  box-shadow:0 2px 16px rgba(0,0,0,.08);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  width:100%;
  max-width:1280px;
  margin:0 auto;
  flex:1;
}

.inbox-topbar {
  display:flex;
  gap:10px;
  padding:14px 16px;
  border-bottom:1px solid #e5e7eb;
  align-items:center;
}

.inbox-search-form { flex:1; }
.inbox-search-input {
  width:100%;
  padding:9px 16px;
  border:1px solid #d1d5db;
  border-radius:20px;
  font-size:14px;
  outline:none;
  background:#f9fafb;
}
.inbox-search-input:focus { border-color:#7f5af0; background:#fff; }

.btn-log-interaction {
  white-space:nowrap;
  font-size:13px;
  font-weight:700;
  padding:9px 18px;
  background:linear-gradient(135deg,#7f5af0,#06b6d4);
  color:#fff;
  border-radius:20px;
  text-decoration:none;
  box-shadow:0 2px 10px rgba(127,90,240,.35);
  letter-spacing:.01em;
}
.btn-log-interaction:hover {
  background:linear-gradient(135deg,#6845d9,#0891b2);
  box-shadow:0 4px 14px rgba(127,90,240,.45);
}

.inbox-filters {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding:10px 16px;
  border-bottom:1px solid #e5e7eb;
  background:#fafafa;
}
.inbox-filters select {
  flex:1;
  min-width:120px;
  font-size:13px;
  padding:7px 10px;
  border:1px solid #d1d5db;
  border-radius:6px;
  background:#fff;
  cursor:pointer;
}

.inbox-test-panel {
  padding:8px 12px;
  border-bottom:1px solid #e5e7eb;
  font-size:12px;
  color:#6b7280;
}
.inbox-test-panel summary { cursor:pointer; font-weight:500; }
.inbox-test-form { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.inbox-test-form textarea {
  border:1px solid #d1d5db;
  border-radius:6px;
  padding:6px;
  font-size:12px;
  resize:none;
}
.inbox-test-form button {
  padding:6px 12px;
  background:#7f5af0;
  color:#fff;
  border:none;
  border-radius:6px;
  cursor:pointer;
  font-size:12px;
}

.thread-count {
  padding:7px 16px;
  font-size:13px;
  color:#6b7280;
  background:#f9fafb;
  border-bottom:1px solid #f0f0f0;
}

.thread-list { flex:1; overflow-y:auto; }
.thread-empty { padding:40px 20px; text-align:center; color:#9ca3af; font-size:14px; }

/* ── Thread item ── */
.thread-item {
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:12px;
  border-bottom:1px solid #f3f4f6;
  text-decoration:none;
  color:inherit;
  transition:background .15s;
  position:relative;
}
.thread-item:hover { background:#f9fafb; }
.thread-human  { background:#fff7ed; border-left:3px solid #f97316; }
.thread-pending { border-left:3px solid #f59e0b; }
.thread-replied { border-left:3px solid #10b981; }

.thread-avatar {
  width:40px; height:40px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:18px;
  flex-shrink:0;
}

.thread-body { flex:1; min-width:0; }
.thread-row1 { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.thread-sender { font-weight:600; font-size:13px; color:#111; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.thread-time { font-size:11px; color:#9ca3af; white-space:nowrap; flex-shrink:0; }
.thread-preview { font-size:12px; color:#6b7280; margin:3px 0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-tags { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }

.ttag {
  font-size:10px;
  padding:2px 7px;
  border-radius:999px;
  font-weight:500;
}
.ttag-red    { background:#fee2e2; color:#dc2626; }
.ttag-orange { background:#fef3c7; color:#b45309; }
.ttag-green  { background:#d1fae5; color:#065f46; }
.ttag-purple { background:#ede9fe; color:#7c3aed; }
.ttag-grey   { background:#f3f4f6; color:#6b7280; }

/* ── Bouton spam dans l'inbox ── */
.thread-spam-form {
  position:absolute; right:8px; top:50%; transform:translateY(-50%);
  opacity:0;
  transition:opacity .15s;
}
.thread-list > div:hover .thread-spam-form,
.thread-list > form:hover .thread-spam-form { opacity:1; }
/* Le wrapper de chaque thread doit être position:relative */
.thread-wrapper { position:relative; }
.thread-spam-btn {
  background:none; border:none; cursor:pointer;
  font-size:15px; padding:4px 6px;
  border-radius:6px;
  color:#dc2626;
  line-height:1;
}
.thread-spam-btn:hover { background:#fee2e2; }

/* ── Scrollbar fine sur la liste clients ── */
.ci-list {
  flex:1;
  overflow-y:auto;
  scrollbar-width:thin;
  scrollbar-color:#d1d5db transparent;
}
.ci-list::-webkit-scrollbar { width:5px; }
.ci-list::-webkit-scrollbar-track { background:transparent; }
.ci-list::-webkit-scrollbar-thumb { background:#d1d5db; border-radius:99px; }

/* ── Pagination ── */
.inbox-pagination {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding:12px;
  justify-content:center;
  border-top:1px solid #e5e7eb;
}
.inbox-pagination a, .page-current {
  padding:4px 10px;
  border-radius:6px;
  font-size:13px;
  text-decoration:none;
}
.inbox-pagination a { background:#f3f4f6; color:#374151; }
.inbox-pagination a:hover { background:#e5e7eb; }
.page-current { background:#7f5af0; color:#fff; }


/* ==========================================================================
   CONVERSATION — Layout 3 colonnes
   ========================================================================== */
.conv-page { background:#f3f4f6; }

.conv-layout {
  display:grid;
  grid-template-columns:300px 1fr 280px;
  height:calc(100vh - 52px);
  overflow:hidden;
}

/* ── Mini thread list (gauche) ── */
.conv-thread-list {
  background:#fff;
  border-right:1px solid #e5e7eb;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.conv-back-btn {
  display:block;
  padding:10px 14px;
  font-size:13px;
  font-weight:600;
  color:#7f5af0;
  text-decoration:none;
  border-bottom:1px solid #e5e7eb;
}
.conv-back-btn:hover { background:#f5f3ff; }
.conv-mini-list { flex:1; overflow-y:auto; }

.mini-thread-item {
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-bottom:1px solid #f3f4f6;
  text-decoration:none;
  color:inherit;
  transition:background .12s;
}
.mini-thread-item:hover { background:#f9fafb; }
.mini-active { background:#f5f3ff !important; border-left:3px solid #7f5af0; }
.mini-human  { border-left:3px solid #f97316; }
.mini-pending{ border-left:3px solid #f59e0b; }
.mini-replied{ border-left:3px solid #10b981; }

.mini-icon {
  width:28px; height:28px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:13px;
  flex-shrink:0;
}
.mini-info { flex:1; min-width:0; }
.mini-sender { display:block; font-size:12px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mini-preview { display:block; font-size:11px; color:#9ca3af; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ── Main conversation ── */
.conv-main {
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:#f9fafb;
}

/* Header */
.conv-header {
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 16px;
  background:#fff;
  border-bottom:1px solid #e5e7eb;
  flex-shrink:0;
}
.conv-avatar {
  width:40px; height:40px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:18px;
  flex-shrink:0;
}
.conv-header-info { flex:1; min-width:0; }
.conv-header-name { font-weight:700; font-size:15px; }
.conv-client-link { color:#111; text-decoration:none; }
.conv-client-link:hover { color:#7f5af0; }
.conv-header-meta { font-size:12px; color:#6b7280; margin-top:2px; }
.conv-header-actions { display:flex; gap:8px; align-items:center; flex-shrink:0; }

.conv-cat-select {
  padding:5px 8px;
  border:1px solid #d1d5db;
  border-radius:6px;
  font-size:12px;
  background:#f9fafb;
  cursor:pointer;
}
.conv-btn {
  padding:6px 12px;
  border-radius:6px;
  font-size:12px;
  font-weight:600;
  text-decoration:none;
  white-space:nowrap;
  color:#fff;
}
.conv-btn-blue { background:#3b82f6; }
.conv-btn-blue:hover { background:#2563eb; }

/* Handover banner */
.conv-handover-banner {
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 16px;
  background:#fff7ed;
  border-bottom:2px solid #f97316;
  flex-shrink:0;
}
.conv-handover-icon { font-size:20px; }
.conv-handover-text { font-size:13px; }
.conv-handover-text strong { display:block; color:#c2410c; }

/* Timeline */
.conv-timeline {
  flex:1;
  overflow-y:auto;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:4px;
}

.conv-day-sep {
  display:flex;
  align-items:center;
  gap:10px;
  margin:12px 0;
  color:#9ca3af;
  font-size:11px;
  font-weight:500;
}
.conv-day-sep::before, .conv-day-sep::after {
  content:"";
  flex:1;
  height:1px;
  background:#e5e7eb;
}

.conv-handover-line {
  text-align:center;
  margin:8px 0;
}
.conv-handover-line span {
  display:inline-block;
  padding:4px 14px;
  background:#fff7ed;
  color:#c2410c;
  border:1px dashed #f97316;
  border-radius:999px;
  font-size:11px;
  font-weight:600;
}

.conv-no-messages {
  text-align:center;
  color:#9ca3af;
  padding:40px;
  font-size:14px;
}

/* Messages rows */
.conv-msg-row {
  display:flex;
  align-items:flex-end;
  gap:8px;
  margin:4px 0;
}
.conv-row-in { flex-direction:row; }
.conv-row-out { flex-direction:row-reverse; }

.conv-msg-avatar {
  width:30px; height:30px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:13px;
  font-weight:700;
  flex-shrink:0;
}
.conv-avatar-client { background:#e5e7eb; color:#374151; }
.conv-avatar-bot    { background:#ede9fe; color:#7c3aed; }
.conv-avatar-human  { background:#dbeafe; color:#1d4ed8; }

.conv-bubble-wrap { display:flex; flex-direction:column; max-width:68%; }

.conv-bubble-name {
  font-size:10px;
  color:#9ca3af;
  margin-bottom:3px;
  padding:0 4px;
}
.conv-row-out .conv-bubble-name { text-align:right; }

.conv-bubble {
  padding:10px 13px;
  border-radius:16px;
  font-size:13px;
  line-height:1.5;
  white-space:pre-wrap;
  word-wrap:break-word;
}
.conv-bubble-client {
  background:#fff;
  border:1px solid #e5e7eb;
  border-bottom-left-radius:4px;
}
.conv-bubble-bot {
  background:#ede9fe;
  border:1px solid #c4b5fd;
  border-bottom-right-radius:4px;
  color:#3b0764;
}
.conv-bubble-human {
  background:#dbeafe;
  border:1px solid #93c5fd;
  border-bottom-right-radius:4px;
  color:#1e3a5f;
}
.conv-bubble-handover {
  border-style:dashed;
  opacity:.85;
}

.conv-bubble-meta {
  display:flex;
  align-items:center;
  gap:6px;
  margin-top:4px;
  padding:0 4px;
}
.conv-row-out .conv-bubble-meta { justify-content:flex-end; }

.conv-badge {
  font-size:10px;
  padding:1px 7px;
  border-radius:999px;
  font-weight:500;
}
.conv-badge-client { background:#f3f4f6; color:#6b7280; }
.conv-badge-bot    { background:#ede9fe; color:#7c3aed; }
.conv-badge-human  { background:#dbeafe; color:#1d4ed8; }

/* Reply zone */
.conv-reply-zone {
  background:#fff;
  border-top:1px solid #e5e7eb;
  padding:12px 16px;
  flex-shrink:0;
}
.conv-reply-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:8px;
}
.conv-reply-channel {
  font-size:12px;
  color:#6b7280;
  font-weight:500;
}
.conv-reply-form { display:flex; flex-direction:column; gap:6px; }
.conv-reply-subject {
  padding:6px 10px;
  border:1px solid #e5e7eb;
  border-radius:6px;
  font-size:13px;
  color:#374151;
  background:#fafafa;
}
.conv-reply-row { display:flex; gap:8px; align-items:flex-end; }
.conv-reply-textarea {
  flex:1;
  padding:10px 12px;
  border:1px solid #d1d5db;
  border-radius:12px;
  font-size:13px;
  resize:none;
  font-family:inherit;
  line-height:1.5;
}
.conv-reply-textarea:focus { outline:none; border-color:#7f5af0; }
.conv-reply-send {
  width:38px; height:38px;
  background:#7f5af0;
  color:#fff;
  border:none;
  border-radius:50%;
  font-size:16px;
  cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}
.conv-reply-send:hover { background:#6845d9; }
.conv-reply-actions { display:flex; gap:8px; }
.conv-action-btn {
  padding:6px 14px;
  border:none;
  border-radius:6px;
  font-size:12px;
  font-weight:600;
  cursor:pointer;
}
.conv-action-send { background:#7f5af0; color:#fff; }
.conv-action-send:hover { background:#6845d9; }

/* ── Sidebar droite conversation ── */
.conv-sidebar {
  background:#fff;
  border-left:1px solid #e5e7eb;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:0;
}
.conv-sidebar-section {
  padding:14px 16px;
  border-bottom:1px solid #f3f4f6;
}
.conv-sidebar-title {
  font-size:12px;
  font-weight:700;
  color:#374151;
  text-transform:uppercase;
  letter-spacing:.5px;
  margin:0 0 10px;
}
.conv-sidebar-row {
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:8px;
  margin-bottom:6px;
  font-size:12px;
}
.conv-sidebar-label { color:#6b7280; }
.conv-sidebar-val { font-weight:600; color:#111; text-align:right; }
.conv-sidebar-urgent { color:#dc2626; }
.conv-sidebar-link {
  display:block;
  margin-top:10px;
  font-size:12px;
  color:#7f5af0;
  text-decoration:none;
  font-weight:500;
}
.conv-sidebar-link:hover { text-decoration:underline; }

/* FAQ suggestions */
.conv-faq-item {
  padding:8px;
  background:#f9fafb;
  border-radius:6px;
  margin-bottom:6px;
  cursor:pointer;
  border:1px solid #e5e7eb;
  transition:background .15s;
}
.conv-faq-item:hover { background:#f0fdf4; border-color:#10b981; }
.conv-faq-q { font-size:11px; font-weight:600; color:#374151; margin-bottom:3px; }
.conv-faq-a { font-size:11px; color:#6b7280; line-height:1.4; }


/* ==========================================================================
   LOG INTERACTION
   ========================================================================== */
.log-page { background:#f3f4f6; }

.log-layout {
  display:grid;
  grid-template-columns:1fr 300px;
  gap:24px;
  max-width:900px;
  margin:24px auto;
  padding:0 16px;
}

.log-card {
  background:#fff;
  border-radius:12px;
  box-shadow:0 1px 4px rgba(0,0,0,.08);
  overflow:hidden;
}
.log-card-header {
  padding:20px 24px;
  background:linear-gradient(135deg, #7f5af0, #6845d9);
  color:#fff;
}
.log-title { margin:0 0 4px; font-size:20px; font-weight:700; }
.log-subtitle { margin:0; font-size:13px; opacity:.85; }

.log-form { padding:20px 24px; display:flex; flex-direction:column; gap:16px; }

.log-form-group { display:flex; flex-direction:column; gap:6px; }

.log-label {
  font-size:13px;
  font-weight:600;
  color:#374151;
  display:flex;
  align-items:baseline;
  gap:8px;
}
.log-label-hint { font-size:11px; color:#9ca3af; font-weight:400; }
.log-label-opt  { font-size:11px; color:#9ca3af; font-weight:400; }

.log-input, .log-select {
  padding:10px 14px;
  border:1.5px solid #d1d5db;
  border-radius:8px;
  font-size:14px;
  font-family:inherit;
  background:#f9fafb;
  transition:border .15s;
}
.log-input:focus, .log-select:focus { outline:none; border-color:#7f5af0; background:#fff; }

.log-textarea {
  padding:10px 14px;
  border:1.5px solid #d1d5db;
  border-radius:8px;
  font-size:13px;
  font-family:inherit;
  background:#f9fafb;
  resize:vertical;
  line-height:1.6;
  transition:border .15s;
}
.log-textarea:focus { outline:none; border-color:#7f5af0; background:#fff; }
.log-textarea-sm { min-height:70px; }

/* Channel selector */
.log-channel-select { display:flex; gap:12px; }
.log-channel-opt {
  flex:1;
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  border:1.5px solid #d1d5db;
  border-radius:8px;
  cursor:pointer;
  font-size:13px;
  font-weight:500;
  transition:border .15s, background .15s;
}
.log-channel-opt input { display:none; }
.log-channel-opt.active, .log-channel-opt:has(input:checked) {
  border-color:#7f5af0;
  background:#f5f3ff;
  color:#6845d9;
}
.log-channel-icon {
  width:28px; height:28px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:14px;
}

/* Status selector */
.log-status-row { display:flex; gap:10px; flex-wrap:wrap; }
.log-status-opt { cursor:pointer; }
.log-status-opt input { display:none; }
.log-status-badge {
  display:inline-block;
  padding:6px 14px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
  border:1.5px solid transparent;
  transition:all .15s;
}
.log-status-green  { background:#f0fdf4; color:#065f46; border-color:#a7f3d0; }
.log-status-orange { background:#fffbeb; color:#92400e; border-color:#fcd34d; }
.log-status-red    { background:#fff1f2; color:#9f1239; border-color:#fda4af; }
.log-status-badge.selected {
  box-shadow:0 0 0 3px rgba(127,90,240,.25);
  transform:translateY(-1px);
}

/* Form actions */
.log-form-actions {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding-top:8px;
  border-top:1px solid #f3f4f6;
}
.log-btn {
  padding:10px 20px;
  border-radius:8px;
  font-size:14px;
  font-weight:600;
  text-decoration:none;
  border:none;
  cursor:pointer;
}
.log-btn-cancel { background:#f3f4f6; color:#374151; }
.log-btn-cancel:hover { background:#e5e7eb; }
.log-btn-submit { background:#7f5af0; color:#fff; }
.log-btn-submit:hover { background:#6845d9; }

/* Help panel */
.log-help { display:flex; flex-direction:column; gap:12px; }
.log-help-card {
  background:#fff;
  border-radius:10px;
  padding:14px 16px;
  box-shadow:0 1px 3px rgba(0,0,0,.07);
}
.log-help-title { margin:0 0 8px; font-size:13px; font-weight:700; color:#374151; }
.log-help-card p { margin:0; font-size:12px; color:#6b7280; line-height:1.6; }
.log-help-list { margin:0; padding-left:16px; font-size:12px; color:#6b7280; line-height:1.8; }


/* ==========================================================================
   CLIENT 360°
   ========================================================================== */
.c360-page { background:#f3f4f6; }

.c360-layout {
  max-width:1100px;
  margin:0 auto;
  padding:0 16px;
}

/* Header */
.c360-header {
  display:flex;
  align-items:center;
  gap:16px;
  padding:20px 0 16px;
}
.c360-avatar {
  width:56px; height:56px;
  border-radius:50%;
  background:linear-gradient(135deg, #7f5af0, #06b6d4);
  color:#fff;
  font-size:24px;
  font-weight:700;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.c360-header-info { flex:1; min-width:0; }
.c360-name { margin:0 0 4px; font-size:22px; color:#111; }
.c360-header-meta { font-size:13px; color:#6b7280; }
.c360-header-actions { display:flex; gap:8px; flex-shrink:0; }

/* Body */
.c360-body {
  display:grid;
  grid-template-columns:260px 1fr;
  gap:16px;
  padding-bottom:32px;
}

/* Sidebar stats */
.c360-sidebar { display:flex; flex-direction:column; gap:12px; }

.c360-section {
  background:#fff;
  border-radius:10px;
  padding:14px 16px;
  box-shadow:0 1px 3px rgba(0,0,0,.07);
}
.c360-section-title {
  font-size:12px;
  font-weight:700;
  color:#6b7280;
  text-transform:uppercase;
  letter-spacing:.5px;
  margin:0 0 12px;
}

/* KPI grid */
.c360-kpi-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.c360-kpi {
  background:#f9fafb;
  border-radius:8px;
  padding:10px;
  text-align:center;
}
.c360-kpi-val { font-size:22px; font-weight:700; color:#7f5af0; }
.c360-kpi-label { font-size:11px; color:#6b7280; margin-top:2px; }
.c360-kpi-warn .c360-kpi-val { color:#dc2626; }

/* Channels */
.c360-channel-row {
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
  font-size:13px;
}
.c360-channel-icon {
  width:24px; height:24px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:12px;
  flex-shrink:0;
}
.c360-channel-name { flex:1; color:#374151; }
.c360-channel-count { font-weight:600; color:#7f5af0; font-size:12px; }

/* Category rows */
.c360-cat-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:5px 8px;
  background:#f9fafb;
  border-radius:6px;
  margin-bottom:5px;
  font-size:12px;
}
.c360-cat-name { color:#374151; font-weight:500; }
.c360-cat-count {
  background:#ede9fe;
  color:#7c3aed;
  padding:1px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:600;
}

/* Action links */
.c360-action-link {
  display:block;
  padding:8px 12px;
  background:#f9fafb;
  border:1px solid #e5e7eb;
  border-radius:7px;
  font-size:12px;
  font-weight:600;
  color:#374151;
  text-decoration:none;
  margin-bottom:6px;
  transition:background .15s;
}
.c360-action-link:hover { background:#f5f3ff; border-color:#c4b5fd; color:#7f5af0; }

/* Main timeline */
.c360-main {
  background:#fff;
  border-radius:10px;
  padding:16px;
  box-shadow:0 1px 3px rgba(0,0,0,.07);
  overflow-y:auto;
  max-height:calc(100vh - 180px);
}
.c360-timeline-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px;
  padding-bottom:12px;
  border-bottom:1px solid #f3f4f6;
}
.c360-timeline-count { font-size:12px; color:#9ca3af; }

/* Channel avatar in 360° timeline */
.c360-chan-avatar {
  width:30px; height:30px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:14px;
  flex-shrink:0;
}

/* Response inside 360° */
.c360-response-wrap { margin-top:6px; }

/* Msg link */
.c360-msg-link {
  font-size:11px;
  color:#7f5af0;
  text-decoration:none;
  margin-left:auto;
}
.c360-msg-link:hover { text-decoration:underline; }

/* ==========================================================================
   HARMONISATION LAYOUTS — max-width 1280px partout
   ========================================================================== */
.c360-layout   { max-width:1280px; }
.clients-wrap  { max-width:1280px; margin:0 auto; }

/* Wrapper générique pour les pages qui n'en ont pas */
.page-wrap {
  max-width:1280px;
  margin:0 auto;
  padding:20px 24px 48px;
}

/* ==========================================================================
   FOOTER CX-FLUX
   ========================================================================== */
.site-footer {
  background:linear-gradient(135deg,#1e1b4b 0%,#312e81 60%,#1e3a5f 100%);
  color:#e0e7ff;
  margin-top:48px;
  padding:40px 24px 0;
  font-size:13px;
}

.footer-inner {
  max-width:1280px;
  margin:0 auto;
}

/* Marque */
.footer-brand { margin-bottom:28px; }
.footer-logo {
  font-size:22px;
  font-weight:900;
  color:#fff;
  letter-spacing:-.5px;
  margin-bottom:6px;
}
.footer-tagline {
  font-size:13px;
  color:#a5b4fc;
  font-weight:500;
}

/* Colonnes */
.footer-cols {
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:32px;
  padding-bottom:32px;
  border-bottom:1px solid rgba(255,255,255,.1);
}
.footer-col-title {
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#818cf8;
  margin-bottom:12px;
}

/* Badges canaux dans le footer */
.footer-channels {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  line-height:2;
  color:#c7d2fe;
  font-size:12px;
}
.fch {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:2px 7px;
  border-radius:6px;
  font-size:10px;
  font-weight:800;
  color:#fff;
  letter-spacing:.3px;
}
.fch-blue    { background:#0084ff; }
.fch-green   { background:#25d366; }
.fch-red     { background:#ea4335; }
.fch-purple  { background:#7c3aed; }
.fch-amber   { background:#f59e0b; }
.fch-emerald { background:#10b981; }

/* Features list */
.footer-features {
  list-style:none;
  margin:0;
  padding:0;
  color:#c7d2fe;
  line-height:2;
  font-size:12px;
}

/* À propos */
.footer-about {
  color:#c7d2fe;
  line-height:1.7;
  margin:0;
  font-size:12px;
}

/* Bas */
.footer-bottom {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  padding:16px 0;
  font-size:12px;
  color:#818cf8;
}
.footer-sep { opacity:.4; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .inbox-layout { padding:8px; }
  .conv-layout { grid-template-columns:1fr; }
  .conv-thread-list, .conv-sidebar { display:none; }
  .log-layout { grid-template-columns:1fr; }
  .log-help { display:none; }
  .c360-body { grid-template-columns:1fr; }
  .c360-sidebar { display:none; }
  .footer-cols { grid-template-columns:1fr; gap:20px; }
}
