/* ================================================================
   MedInfo AI Chatbot Design – v1.8.2
   ================================================================ */

/* ── CONTENEUR ─────────────────────────────────────────────────── */
.mwai-chatbot.mwai-timeless-theme {
    border-radius: 16px !important;
    /* NOTE v1.8.2 : overflow visible (pas hidden) pour que les
       popovers de grade ne soient pas coupés par le conteneur */
    box-shadow: 0 4px 28px rgba(34,53,221,0.12) !important;
    border: 1px solid #dde3f5 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif !important;
    background: #f8f9ff !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 85vh !important;
}

.mwai-chatbot.mwai-timeless-theme .mwai-conversation {
    background: #f8f9ff !important;
    padding: 16px !important;
    flex: 1 1 auto !important;
    min-height: 550px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* ── BULLES ─────────────────────────────────────────────────────── */
.mwai-chatbot.mwai-timeless-theme .mwai-reply.mwai-ai .mwai-text {
    background: #ffffff !important;
    color: #1a1f3a !important;
    border: 1px solid #dde3f5 !important;
    border-radius: 4px 18px 18px 18px !important;
    padding: 14px 16px !important;
    box-shadow: 0 2px 8px rgba(34,53,221,0.06) !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
    /* overflow visible pour les popovers */
    overflow: visible !important;
}

.mwai-chatbot.mwai-timeless-theme .mwai-reply.mwai-user .mwai-text {
    background: linear-gradient(135deg, #2235DD 0%, #1a29b8 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 18px 4px 18px 18px !important;
    padding: 12px 16px !important;
    box-shadow: 0 2px 12px rgba(34,53,221,0.30) !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
}

.mwai-chatbot.mwai-timeless-theme .mwai-reply.mwai-ai .mwai-text a { color: #2235DD !important; text-decoration: underline !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-reply.mwai-ai:first-child .mwai-text { background: #eef1ff !important; border-color: #c8d0f5 !important; }

/* ── BADGES DE GRADE (inline dans le texte IA) ─────────────────── */
.medinfo-grade-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    vertical-align: middle;
    margin: 0 2px;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid currentColor;
    transition: opacity 0.15s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
}

.medinfo-grade-badge:hover { opacity: 0.8; transform: scale(1.05); }
.medinfo-grade-badge:active { transform: scale(0.97); }

.medinfo-grade-I    { background: #dbeafe; color: #1d4ed8; }
.medinfo-grade-IIa  { background: #d1fae5; color: #065f46; }
.medinfo-grade-IIb  { background: #fef9c3; color: #854d0e; }
.medinfo-grade-III  { background: #fee2e2; color: #991b1b; }
.medinfo-grade-A    { background: #dbeafe; color: #1d4ed8; }
.medinfo-grade-B    { background: #d1fae5; color: #065f46; }
.medinfo-grade-C    { background: #fef9c3; color: #854d0e; }

/* ── POPOVER DE GRADE ───────────────────────────────────────────── */
/* v1.8.2 : position FIXED, attaché au <body>, jamais coupé par overflow:hidden */
.medinfo-grade-popover {
    position: fixed;
    width: 260px;
    background: #1a1f3a;
    color: #f0f4ff;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 12px;
    line-height: 1.5;
    z-index: 2147483645;
    box-shadow: 0 8px 32px rgba(0,0,0,0.30);
    pointer-events: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Flèche triangulaire en bas du popover */
.medinfo-grade-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #1a1f3a;
}

.medinfo-grade-popover-level {
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
}

.medinfo-grade-popover-ref { font-size:11px; font-weight:700; color:#7c3aed; margin-top:6px; letter-spacing:0.04em; text-transform:uppercase; }
.medinfo-grade-popover-source {
    color: #c8d0f5;
    margin-bottom: 10px;
    font-size: 12px;
}

.medinfo-grade-popover-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #2235DD;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    transition: background 0.15s;
}

.medinfo-grade-popover-link:hover { background: #1a29b8 !important; }

/* ── SECTIONS MASQUÉES (texte brut caché, remplacé par UI stylisée) */
.medinfo-section-raw {
    display: none !important;
}

/* ── SOURCES ────────────────────────────────────────────────────── */
.medinfo-sources-section { margin-top: 16px; border-top: 1px solid #eef1ff; padding-top: 12px; }
.medinfo-sources-header { font-size: 11px; font-weight: 700; color: #4a5586; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.medinfo-source-card { background: #f8f9ff; border: 1px solid #e0e6ff; border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; transition: border-color 0.18s; }
.medinfo-source-card:hover { border-color: #2235DD; }
.medinfo-source-card-meta { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.medinfo-source-card-ref, .medinfo-source-card-short { display:inline-flex; align-items:center; padding:4px 10px; border-radius:999px; font-size:11px; font-weight:700; letter-spacing:0.02em; }
.medinfo-source-card-ref { background: rgba(99,102,241,0.12); color:#1d4ed8; border:1px solid rgba(99,102,241,0.20); }
.medinfo-source-card-short { background: rgba(15,23,42,0.06); color:#334155; border:1px solid rgba(148,163,184,0.28); }
.medinfo-source-card-title { font-size: 13px; font-weight: 600; color: #1a1f3a; margin-bottom: 8px; line-height: 1.4; }
.medinfo-source-card-links { display: flex; gap: 6px; flex-wrap: wrap; }
.medinfo-source-link { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; font-size: 11px; font-weight: 600; border-radius: 20px; text-decoration: none !important; transition: all 0.18s; border: 1px solid; font-family: inherit; }
.medinfo-source-link.pubmed  { color: #065f46; border-color: #6ee7b7; background: #d1fae5; }
.medinfo-source-link.doi     { color: #1d4ed8; border-color: #93c5fd; background: #dbeafe; }
.medinfo-source-link.web     { color: #4a5586; border-color: #dde3f5; background: #f0f3ff; }
.medinfo-source-link.pubmed:hover { background: #065f46; color: #fff; }
.medinfo-source-link.doi:hover    { background: #1d4ed8; color: #fff; }
.medinfo-source-link.web:hover    { background: #4a5586; color: #fff; }

/* ── APPROFONDISSEMENTS ─────────────────────────────────────────── */
.medinfo-deepen-section { margin-top: 14px; padding: 14px 16px; background: #f0fdf4; border: 1px solid #86efac; border-radius: 12px; }
.medinfo-deepen-header { font-size: 11px; font-weight: 700; color: #065f46; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.medinfo-deepen-item { display: flex; align-items: center; gap: 12px; background: #ffffff; border: 1.5px solid #a7f3d0; border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: all 0.18s; font-family: inherit; text-align: left; width: 100%; margin-bottom: 8px; }
.medinfo-deepen-item:last-child { margin-bottom: 0; }
.medinfo-deepen-item:hover { border-color: #059669; background: #f0fdf4; }
.medinfo-deepen-item-icon  { font-size: 22px; flex-shrink: 0; }
.medinfo-deepen-item-body  { flex: 1; }
.medinfo-deepen-item-title { font-size: 13px; font-weight: 600; color: #1a1f3a; margin-bottom: 2px; }
.medinfo-deepen-item-desc  { font-size: 11px; color: #6b7280; line-height: 1.4; }
.medinfo-deepen-item-arrow { color: #059669; font-size: 18px; font-weight: 700; flex-shrink: 0; }

/* ── BOUTONS D'ACTION ───────────────────────────────────────────── */
.medinfo-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 8px; border-top: 1px solid #eef1ff; }
.medinfo-action-btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; font-size: 12px; font-weight: 500; color: #4a5586; background: #f0f3ff; border: 1px solid #dde3f5; border-radius: 20px; cursor: pointer; transition: all 0.18s ease; font-family: inherit; line-height: 1.4; user-select: none; -webkit-user-select: none; }
.medinfo-action-btn:hover   { background: #e0e6ff; border-color: #b3bef5; color: #2235DD; }
.medinfo-like-btn.active    { background: #16a34a; border-color: #16a34a; color: #fff; }
.medinfo-dislike-btn.active { background: #ea580c; border-color: #ea580c; color: #fff; }
.medinfo-report-btn.active  { background: #2235DD; border-color: #2235DD; color: #fff; }

.medinfo-comment-box { margin-top: 8px; padding: 10px 12px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; display: none; }
.medinfo-comment-box.open { display: block; }
.medinfo-comment-box textarea { width: 100%; box-sizing: border-box; border: 1px solid #fdba74; border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; resize: vertical; min-height: 60px; color: #1a1f3a; background: #fff; outline: none; }
.medinfo-comment-box textarea:focus { border-color: #ea580c; }
.medinfo-comment-submit { margin-top: 6px; padding: 5px 14px; font-size: 12px; font-weight: 600; background: #ea580c; color: #fff; border: none; border-radius: 20px; cursor: pointer; font-family: inherit; }

/* ── CALCULATEURS ───────────────────────────────────────────────── */
.medinfo-calculator { margin-top: 14px; background: #f4f6ff; border: 1px solid #c8d0f5; border-radius: 12px; overflow: hidden; font-size: 14px; }
.medinfo-calc-version-toggle { display: flex; margin-bottom: 12px; border: 1px solid #c8d0f5; border-radius: 8px; overflow: hidden; }
.medinfo-calc-version-btn { flex: 1; padding: 6px 10px; font-size: 12px; font-weight: 600; background: #f4f6ff; color: #4a5586; border: none; cursor: pointer; transition: all 0.18s; font-family: inherit; text-align: center; }
.medinfo-calc-version-btn.active { background: #2235DD; color: #fff; }
.medinfo-calculator-header { background: linear-gradient(135deg,#2235DD,#1a29b8); color: #fff; padding: 10px 16px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.medinfo-calculator-body { padding: 14px 16px; }
.medinfo-calc-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #e0e6ff; gap: 10px; cursor: pointer; }
.medinfo-calc-item:last-of-type { border-bottom: none; }
.medinfo-calc-item label { flex: 1; cursor: pointer; color: #1a1f3a; font-size: 13px; line-height: 1.4; }
.medinfo-calc-pts { font-size: 11px; color: #6b7280; white-space: nowrap; margin-right: 10px; }
.medinfo-calc-item input { width: 18px; height: 18px; accent-color: #2235DD; cursor: pointer; flex-shrink: 0; }
.medinfo-calc-select-row { padding: 8px 0; border-bottom: 1px solid #e0e6ff; }
.medinfo-calc-select-row:last-of-type { border-bottom: none; }
.medinfo-calc-select-label { font-size: 13px; color: #1a1f3a; font-weight: 600; margin-bottom: 4px; display: block; }
.medinfo-calc-select { width: 100%; padding: 7px 28px 7px 10px; font-size: 13px; font-family: inherit; border: 1px solid #c8d0f5; border-radius: 8px; background: #fff; color: #1a1f3a; cursor: pointer; outline: none; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5586' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.medinfo-calc-select:focus { border-color: #2235DD; }
.medinfo-calc-section-label { font-weight: 700; font-size: 12px; color: #4a5586; padding: 6px 0 4px; margin-top: 4px; }
.medinfo-calc-pills-row { padding: 8px 0; border-bottom: 1px solid #e0e6ff; }
.medinfo-calc-pills-row:last-of-type { border-bottom: none; }
.medinfo-calc-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.medinfo-calc-pill { appearance: none; -webkit-appearance: none; border: 1.5px solid #c8d0f5; background: #fff; color: #1a1f3a; padding: 8px 12px; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 600; line-height: 1.2; font-family: inherit; transition: all 0.18s ease; }
.medinfo-calc-pill:hover { border-color: #2235DD; color: #2235DD; background: #eef2ff; }
.medinfo-calc-pill.is-selected { background: #2235DD; border-color: #2235DD; color: #fff; box-shadow: 0 4px 12px rgba(34,53,221,0.20); }
.medinfo-calc-result { margin-top: 12px; padding: 14px; background: #ffffff; border: 2px solid #2235DD; border-radius: 10px; text-align: center; }
.medinfo-score-value  { font-size: 36px; font-weight: 800; color: #2235DD; line-height: 1; }
.medinfo-score-label  { font-size: 13px; color: #4a5586; margin-top: 4px; }
.medinfo-score-ref    { font-size: 11px; color: #9ca3af; margin-top: 3px; font-style: italic; }
.medinfo-score-class  { font-size: 14px; font-weight: 800; margin-top: 6px; display: none; }
.medinfo-score-reco   { margin-top: 8px; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.medinfo-score-low    { background: #dcfce7; color: #166534; }
.medinfo-score-medium { background: #fef9c3; color: #854d0e; }
.medinfo-score-high   { background: #fee2e2; color: #991b1b; }

/* ── ZONE DE SAISIE ─────────────────────────────────────────────── */
.mwai-chatbot.mwai-timeless-theme .mwai-input { background: #ffffff !important; border-top: 1px solid #dde3f5 !important; padding: 12px 14px !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-input-text textarea { border: 1px solid #dde3f5 !important; border-radius: 12px !important; padding: 10px 14px !important; font-size: 15px !important; font-family: inherit !important; background: #f8f9ff !important; color: #1a1f3a !important; transition: border-color 0.2s !important; line-height: 1.5 !important; resize: none !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-input-text textarea:focus { outline: none !important; border-color: #2235DD !important; background: #ffffff !important; box-shadow: 0 0 0 3px rgba(34,53,221,0.10) !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-input-text textarea::placeholder { color: #a0a9cc !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-submit-button, .mwai-chatbot.mwai-timeless-theme .mwai-send-button { background: #2235DD !important; color: #fff !important; border: none !important; border-radius: 12px !important; cursor: pointer !important; transition: background 0.2s !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-submit-button:hover { background: #1a29b8 !important; }

/* Boutons AIEMC — fond blanc par défaut, bleu au hover */
.mwai-chatbot.mwai-timeless-theme .mwai-reply-button { background: #ffffff !important; border: 1.5px solid #c8d0f5 !important; color: #1a1f3a !important; border-radius: 20px !important; padding: 7px 16px !important; font-size: 13px !important; font-weight: 500 !important; cursor: pointer !important; transition: all 0.18s !important; margin: 3px !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-reply-button:hover { background: #2235DD !important; border-color: #2235DD !important; color: #fff !important; }

/* ── SCROLLBAR ──────────────────────────────────────────────────── */
.mwai-chatbot.mwai-timeless-theme .mwai-conversation::-webkit-scrollbar       { width: 5px; }
.mwai-chatbot.mwai-timeless-theme .mwai-conversation::-webkit-scrollbar-track  { background: transparent; }
.mwai-chatbot.mwai-timeless-theme .mwai-conversation::-webkit-scrollbar-thumb  { background: #c8d0f5; border-radius: 10px; }
.mwai-chatbot.mwai-timeless-theme .mwai-conversation::-webkit-scrollbar-thumb:hover { background: #2235DD; }

/* ════════════════ PAGE OUTILS ════════════════════════════════════ */
.medinfo-outils-panel { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; max-width: 960px; margin: 0 auto; padding: 0 0 40px; }
.medinfo-outils-header { text-align: center; padding: 36px 24px 28px; background: linear-gradient(135deg, #eef1ff 0%, #e0e6ff 50%, #eef1ff 100%); border-radius: 20px; margin-bottom: 28px; border: 1px solid #c8d0f5; overflow: hidden; position: relative; }
.medinfo-outils-header::before { content: ''; position: absolute; top: -40px; right: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(34,53,221,0.06); }
.medinfo-outils-header-icon { font-size: 40px; margin-bottom: 10px; }
.medinfo-outils-header h2 { font-size: 24px; font-weight: 800; color: #1a1f3a; margin: 0 0 8px; }
.medinfo-outils-header p { font-size: 14px; color: #4a5586; margin: 0; line-height: 1.5; }

.medinfo-outils-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; justify-content: center; padding: 0 4px; }
.medinfo-tab-btn { padding: 8px 18px; font-size: 13px; font-weight: 600; background: #f0f3ff; color: #4a5586; border: 1.5px solid #dde3f5; border-radius: 24px; cursor: pointer; transition: all 0.2s; font-family: inherit; white-space: nowrap; }
.medinfo-tab-btn:hover  { background: #e0e6ff; color: #2235DD; border-color: #c8d0f5; }
.medinfo-tab-btn.active { background: #2235DD; color: #fff; border-color: #2235DD; }
.medinfo-tab-content { display: none; }
.medinfo-tab-content.active { display: block; }

.medinfo-tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.medinfo-tool-card { background: #ffffff; border: 1.5px solid #dde3f5; border-radius: 16px; padding: 20px 16px; cursor: pointer; transition: all 0.22s; box-shadow: 0 2px 8px rgba(34,53,221,0.05); }
.medinfo-tool-card:hover { border-color: #2235DD; box-shadow: 0 6px 20px rgba(34,53,221,0.15); transform: translateY(-3px); }
.medinfo-tool-card-icon  { font-size: 30px; margin-bottom: 12px; display: block; }
.medinfo-tool-card-title { font-size: 14px; font-weight: 700; color: #1a1f3a; margin-bottom: 6px; }
.medinfo-tool-card-desc  { font-size: 12px; color: #6b7280; line-height: 1.5; }

.medinfo-calc-zone { margin-top: 24px; background: #ffffff; border: 1.5px solid #c8d0f5; border-radius: 16px; padding: 20px; box-shadow: 0 4px 20px rgba(34,53,221,0.10); }
.medinfo-calc-zone-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.medinfo-calc-zone-title { font-size: 15px; font-weight: 700; color: #1a1f3a; }
.medinfo-calc-close { padding: 6px 14px; font-size: 13px; background: #f0f3ff; color: #4a5586; border: 1px solid #dde3f5; border-radius: 20px; cursor: pointer; font-family: inherit; transition: all 0.18s; white-space: nowrap; flex-shrink: 0; }
.medinfo-calc-close:hover { background: #fee2e2; color: #991b1b; }
.medinfo-outils-disclaimer { margin-top: 28px; padding: 12px 16px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; font-size: 13px; color: #92400e; text-align: center; }

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mwai-chatbot.mwai-timeless-theme { min-height: 78vh !important; }
    .mwai-chatbot.mwai-timeless-theme .mwai-conversation { min-height: 420px !important; }
    .medinfo-tools-grid { grid-template-columns: 1fr 1fr; }
    .medinfo-outils-header h2 { font-size: 20px; }
    .medinfo-grade-popover { width: 220px; font-size: 11px; }
}
@media (max-width: 480px) { .medinfo-tools-grid { grid-template-columns: 1fr; } }

/* ── NOUVEAUX CALCULATEURS v1.8.3 ─── */
/* mRS — échelle de Rankin : 1 seul select ou radios cliquables */
.medinfo-mrs-scale { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.medinfo-mrs-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
    background: #f8f9ff; border: 1.5px solid #e0e6ff; border-radius: 10px; cursor: pointer; transition: all 0.18s; }
.medinfo-mrs-item.selected { border-color: #2235DD; background: #eef1ff; }
.medinfo-mrs-item-score { font-size: 20px; font-weight: 800; color: #2235DD; min-width: 28px; }
.medinfo-mrs-item-text  { font-size: 13px; color: #1a1f3a; line-height: 1.4; flex: 1; }
/* CAT score — sliders */
.medinfo-cat-item { margin-bottom: 14px; }
.medinfo-cat-label { font-size: 13px; font-weight: 600; color: #1a1f3a; margin-bottom: 4px; display: flex; justify-content: space-between; }
.medinfo-cat-label span { color: #2235DD; font-size: 14px; }
.medinfo-cat-slider { width: 100%; accent-color: #2235DD; }
.medinfo-cat-hints { display: flex; justify-content: space-between; font-size: 10px; color: #9ca3af; margin-top: 2px; }

/* ══════════════════════════════════════════════
   NOUVEAUX STYLES v1.8.4
   ══════════════════════════════════════════════ */

/*
 * Les Shortcuts AI Engine natifs (.mwai-shortcut) remplacent désormais
 * les questions INTERACTION. On leur applique le style MedInfo AI :
 * fond blanc, bordure légère, bleu au hover — proche du style Docmeup.
 */
.mwai-chatbot.mwai-timeless-theme .mwai-shortcuts {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 10px 14px 14px !important;
    background: #f0f3ff !important;
    border-top: 1px solid #dde3f5 !important;
}

.mwai-chatbot.mwai-timeless-theme .mwai-shortcut {
    background: #ffffff !important;
    border: 1.5px solid #c8d0f5 !important;
    color: #1a1f3a !important;
    border-radius: 20px !important;
    padding: 7px 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.18s ease !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
    user-select: none !important;
}

.mwai-chatbot.mwai-timeless-theme .mwai-shortcut:hover {
    background: #2235DD !important;
    border-color: #2235DD !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(34,53,221,0.25) !important;
}

.mwai-chatbot.mwai-timeless-theme .mwai-shortcut.mwai-info    { border-color: #93c5fd !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-shortcut.mwai-success { border-color: #86efac !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-shortcut.mwai-danger  { border-color: #fca5a5 !important; }
.mwai-chatbot.mwai-timeless-theme .mwai-shortcut.mwai-warning { border-color: #fde68a !important; }

/*
 * Les Blocks AI Engine (.mwai-blocks) contiennent les sections
 * SOURCES et APPROFONDISSEMENTS injectées via addBlock().
 * On leur donne un espacement propre dans le flux de la conversation.
 */
.mwai-chatbot.mwai-timeless-theme .mwai-blocks {
    padding: 0 14px 8px !important;
}

.mwai-chatbot.mwai-timeless-theme .mwai-block {
    margin-bottom: 10px !important;
}


/* ══════════════════════════════════════════════
   Modernisation MedInfo AI v1.9.0
   ══════════════════════════════════════════════ */
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized {
    border-radius: 24px !important;
    background: linear-gradient(180deg, #edf2ff 0%, #f8faff 100%) !important;
    overflow: hidden !important;
}

.medinfo-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #1e2fbb 0%, #2f5fe7 55%, #6d8fff 100%);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.14);
}
.medinfo-chatbot-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.medinfo-chatbot-logo { width: 46px; height: 46px; border-radius: 14px; background: rgba(255,255,255,0.16); display: flex; align-items: center; justify-content: center; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2); flex-shrink: 0; overflow: hidden; }
.medinfo-chatbot-logo-img { width: 100%; height: 100%; object-fit: cover; }
.medinfo-chatbot-logo-fallback { font-weight: 800; letter-spacing: 0.04em; }
.medinfo-chatbot-brand-copy { min-width: 0; }
.medinfo-chatbot-brand-title { font-size: 18px; font-weight: 800; line-height: 1.1; }
.medinfo-chatbot-brand-subtitle { font-size: 12px; opacity: 0.86; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.medinfo-chatbot-header-badge { padding: 8px 12px; border-radius: 999px; background: rgba(7, 18, 78, 0.24); border: 1px solid rgba(255,255,255,0.18); font-size: 12px; font-weight: 700; white-space: nowrap; }

.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-conversation {
    background: linear-gradient(180deg, #f5f7ff 0%, #f8faff 100%) !important;
    padding: 18px !important;
}
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-reply.mwai-ai .mwai-text {
    border-radius: 18px !important;
    box-shadow: 0 10px 28px rgba(16,24,40,0.08) !important;
}
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-reply.mwai-user .mwai-text {
    border-radius: 18px !important;
    background: linear-gradient(135deg, #3568f1 0%, #284bd8 100%) !important;
}
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-input {
    background: #f7f9ff !important;
    border-top: 1px solid #dbe3ff !important;
    padding: 14px 16px 16px !important;
}
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-input-text textarea {
    min-height: 56px !important;
    border-radius: 18px !important;
    background: #ffffff !important;
    padding: 14px 16px !important;
}
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-submit-button,
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-send-button,
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-input-submit {
    border-radius: 18px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    box-shadow: 0 10px 24px rgba(34,53,221,0.24) !important;
}

.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-blocks {
    padding: 0 18px 16px !important;
    display: grid;
    gap: 12px;
}
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-block { margin: 0 !important; }
.mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-shortcuts {
    background: transparent !important;
    border-top: 0 !important;
    padding: 0 18px 12px !important;
}

.medinfo-block-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #c9d5ff;
    margin-bottom: 14px;
}
.medinfo-block--interaction .medinfo-block-kicker,
.medinfo-block--deepen .medinfo-block-kicker,
.medinfo-block--sources .medinfo-block-kicker {
    color: #e9d48f;
}

.medinfo-interaction-section,
.medinfo-deepen-section,
.medinfo-sources-section {
    background: radial-gradient(circle at top left, rgba(79,110,255,0.15), transparent 35%), linear-gradient(180deg, #0d1638 0%, #121f49 100%);
    border: 1px solid rgba(225, 196, 108, 0.35);
    border-radius: 22px;
    padding: 18px;
    box-shadow: 0 12px 30px rgba(5, 14, 49, 0.24);
}
.medinfo-interaction-card,
.medinfo-deepen-item,
.medinfo-source-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
    border: 1px solid rgba(225, 196, 108, 0.26);
    border-radius: 18px;
    padding: 16px;
    color: #edf2ff;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.medinfo-interaction-card:hover,
.medinfo-deepen-item:hover,
.medinfo-source-card:hover {
    transform: translateY(-2px);
    border-color: rgba(236, 210, 132, 0.56);
    box-shadow: 0 10px 20px rgba(6, 14, 46, 0.28);
}
.medinfo-interaction-card + .medinfo-interaction-card,
.medinfo-deepen-item + .medinfo-deepen-item,
.medinfo-source-card + .medinfo-source-card { margin-top: 10px; }
.medinfo-interaction-card-head { display: flex; gap: 12px; align-items: flex-start; }
.medinfo-interaction-card-icon,
.medinfo-deepen-item-icon { font-size: 18px; flex-shrink: 0; }
.medinfo-interaction-card-title,
.medinfo-deepen-item-title,
.medinfo-source-card-title { font-size: 16px; font-weight: 700; color: #ffffff; line-height: 1.45; }
.medinfo-interaction-card-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.medinfo-interaction-chip {
    appearance: none;
    border: 1px solid rgba(125, 151, 255, 0.42);
    background: rgba(102, 123, 255, 0.14);
    color: #eef3ff;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}
.medinfo-interaction-chip:hover {
    background: rgba(102, 123, 255, 0.28);
    border-color: rgba(140, 162, 255, 0.7);
}
.medinfo-deepen-item { display: flex; align-items: flex-start; gap: 14px; width: 100%; text-align: left; }
.medinfo-deepen-item-body { flex: 1; }
.medinfo-deepen-item-desc,
.medinfo-source-card-justify,
.medinfo-grade-popover-note {
    font-size: 13px;
    color: #b8c4ef;
    line-height: 1.5;
    margin-top: 8px;
}
.medinfo-deepen-item-arrow { color: #f1d37c; font-size: 18px; font-weight: 800; }
.medinfo-source-card-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.medinfo-source-link {
    min-width: 92px;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border-color: rgba(137, 159, 255, 0.32) !important;
    color: #eef3ff !important;
    padding: 9px 14px;
    font-size: 12px;
}
.medinfo-source-link.doi,
.medinfo-source-link.pubmed,
.medinfo-source-link.web { background: rgba(255,255,255,0.04); }
.medinfo-source-link:hover { background: rgba(99, 121, 246, 0.34) !important; color: #fff !important; }

.medinfo-grade-popover {
    width: 290px;
    background: linear-gradient(180deg, #111a44 0%, #17265d 100%);
    border: 1px solid rgba(225, 196, 108, 0.28);
}
.medinfo-grade-popover-link {
    display: block;
    text-align: center;
    border-radius: 14px;
    padding: 11px 14px;
    font-weight: 700;
    text-decoration: none !important;
    background: linear-gradient(135deg, #2d54e4 0%, #496df6 100%) !important;
    color: #ffffff !important;
    margin-top: 12px;
}
.medinfo-grade-popover-link-primary {
    background: linear-gradient(135deg, #c38d18 0%, #e2b547 100%) !important;
    color: #0d1638 !important;
}
.medinfo-grade-popover-note { margin-top: 10px; }

@media (max-width: 768px) {
    .medinfo-chatbot-header {
        padding: 16px;
        align-items: flex-start;
        flex-direction: column;
    }
    .medinfo-chatbot-header-badge { align-self: flex-start; }
    .mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-blocks,
    .mwai-chatbot.mwai-timeless-theme.medinfo-modernized .mwai-shortcuts { padding-left: 14px !important; padding-right: 14px !important; }
    .medinfo-interaction-section,
    .medinfo-deepen-section,
    .medinfo-sources-section { padding: 16px; border-radius: 18px; }
    .medinfo-interaction-card,
    .medinfo-deepen-item,
    .medinfo-source-card { padding: 14px; border-radius: 16px; }
}


/* ════════════════ MEDINFO REBUILD v2.0 ═══════════════════════════ */
.medinfo-interaction-card { cursor: default; }
.medinfo-deepen-item { cursor: default; }
.medinfo-deepen-item-icon-wrap {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(73, 109, 246, 0.30) 0%, rgba(34, 53, 221, 0.16) 100%);
    border: 1px solid rgba(123, 151, 255, 0.35);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.medinfo-deepen-item-icon { font-size: 20px; }
.medinfo-deepen-item-footer {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.medinfo-deepen-item-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(98, 122, 255, 0.16);
    border: 1px solid rgba(123, 151, 255, 0.34);
    color: #eef3ff;
    font-size: 12px;
    font-weight: 700;
}
.medinfo-deepen-item:hover .medinfo-deepen-item-cta {
    background: rgba(98, 122, 255, 0.28);
    border-color: rgba(144, 166, 255, 0.55);
}
.medinfo-interaction-input-row {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}
.medinfo-interaction-input {
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(123, 151, 255, 0.34);
    background: rgba(7, 14, 40, 0.44);
    color: #ffffff;
    font-size: 14px;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.medinfo-interaction-input::placeholder { color: #aebae6; }
.medinfo-interaction-input:focus {
    border-color: rgba(144, 166, 255, 0.75);
    box-shadow: 0 0 0 3px rgba(73, 109, 246, 0.14);
}
.medinfo-interaction-submit {
    width: 46px;
    min-width: 46px;
    height: 46px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #496df6 0%, #2d54e4 100%);
    color: #ffffff;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 10px 22px rgba(36, 68, 203, 0.28);
}
.medinfo-interaction-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(36, 68, 203, 0.34);
}
.medinfo-interaction-card-title { margin-right: 8px; }
.medinfo-interaction-card + .medinfo-interaction-card { margin-top: 12px; }

/* Footer consolidé — envoi groupé multi-questions */
.medinfo-interaction-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.medinfo-interaction-send-all {
    border: none;
    border-radius: 14px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #496df6 0%, #2d54e4 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 10px 22px rgba(36, 68, 203, 0.28);
    white-space: nowrap;
}
.medinfo-interaction-send-all:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(36, 68, 203, 0.34);
}
.medinfo-interaction-clear {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.medinfo-interaction-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
}
.medinfo-source-card-ref {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(225, 196, 108, 0.15);
    border: 1px solid rgba(225, 196, 108, 0.26);
    color: #f1d37c;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
}
.medinfo-source-card-short {
    color: #c9d5ff;
    font-size: 12px;
    font-weight: 700;
}
@media (max-width: 768px) {
    .medinfo-deepen-item-icon-wrap {
        width: 42px;
        height: 42px;
        min-width: 42px;
        border-radius: 12px;
    }
    .medinfo-interaction-input-row { gap: 8px; }
    .medinfo-interaction-input {
        height: 44px;
    }
    .medinfo-interaction-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .medinfo-interaction-send-all,
    .medinfo-interaction-clear {
        width: 100%;
        text-align: center;
    }
}


/* ══════════════════════════════════════════════
   Polish v2.0.1 / UX v0.1.1
   ══════════════════════════════════════════════ */
.medinfo-source-ref {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    margin: 0 2px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #2251d1;
    font-size: 0.92em;
    font-weight: 700;
    cursor: pointer;
    vertical-align: middle;
    white-space: nowrap;
}
.medinfo-source-ref:hover { background: rgba(59, 130, 246, 0.14); }
.medinfo-interaction-chip.is-selected {
    background: #ffffff !important;
    border-color: #f1d37c !important;
    color: #f8e08b !important;
    box-shadow: 0 0 0 2px rgba(241,211,124,0.16) inset !important;
}
.medinfo-deepen-item { cursor: default; }
.medinfo-deepen-item-cta-btn {
    appearance: none;
    border: 1px solid rgba(97, 123, 240, 0.5);
    background: rgba(72, 103, 231, 0.18);
    color: #ffffff;
    border-radius: 999px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
}
.medinfo-deepen-item-cta-btn:hover {
    background: rgba(72, 103, 231, 0.28);
    transform: translateY(-1px);
}
.medinfo-send-confirm {
    position: fixed;
    inset: 0;
    background: rgba(5, 12, 45, 0.54);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 2147483646;
}
.medinfo-send-confirm.is-open { display: flex; }
.medinfo-send-confirm__dialog {
    width: min(520px, 100%);
    background: #0f1f69;
    color: #eef2ff;
    border: 1px solid rgba(148, 163, 255, 0.3);
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(2, 8, 23, 0.35);
    padding: 20px;
}
.medinfo-send-confirm__title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 10px;
}
.medinfo-send-confirm__text {
    font-size: 15px;
    line-height: 1.55;
    color: #d9e2ff;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 16px;
    word-break: break-word;
}
.medinfo-send-confirm__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.medinfo-send-confirm__btn {
    appearance: none;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.14);
}
.medinfo-send-confirm__btn--ghost {
    background: rgba(255,255,255,0.08);
    color: #eef2ff;
}
.medinfo-send-confirm__btn--primary {
    background: #e0b23a;
    color: #0f1f69;
    border-color: #e0b23a;
}
.medinfo-grade-popover.is-below::after {
    top: -8px;
    bottom: auto;
    border-top: 0;
    border-bottom: 8px solid #132164;
}
@media (max-width: 768px) {
    .medinfo-send-confirm__dialog { padding: 18px; border-radius: 18px; }
    .medinfo-send-confirm__title { font-size: 18px; }
    .medinfo-send-confirm__actions { flex-direction: column-reverse; }
    .medinfo-send-confirm__btn { width: 100%; }
    .medinfo-grade-popover { width: min(320px, calc(100vw - 24px)) !important; }
}


.medinfo-grade-popover-strength {
    margin: 10px 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: #dbe4ff;
    font-size: 12px;
    line-height: 1.45;
}
.medinfo-grade-popover-strength-tag {
    display: inline-block;
    margin-right: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(234,179,8,0.16);
    border: 1px solid rgba(234,179,8,0.28);
    color: #f8dd7b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}


/* ══════════════════════════════════════════════════════════
   v3.0.8 — MODE RAISONNEMENT
══════════════════════════════════════════════════════════ */

/* Toggle button in header */
.medinfo-thinking-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid #e0e7ff;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
    flex-shrink: 0;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    opacity: 0.5;
}
.medinfo-thinking-toggle:hover {
    border-color: #a5b4fc;
    background: rgba(73, 109, 246, 0.06);
    opacity: 0.8;
}
.medinfo-thinking-toggle.is-active {
    border-color: #496df6;
    background: rgba(73, 109, 246, 0.12);
    opacity: 1;
    box-shadow: 0 0 0 3px rgba(73, 109, 246, 0.15);
}
.medinfo-thinking-toggle-icon {
    font-size: 16px;
    line-height: 1;
}

/* Thinking block — collapsible */
.medinfo-block--thinking {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
    border: 1px solid #c7d2fe;
    border-left: 4px solid #496df6;
    border-radius: 12px;
    margin: 8px 0 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.medinfo-block--thinking:hover {
    box-shadow: 0 2px 12px rgba(73, 109, 246, 0.1);
}

.medinfo-thinking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.medinfo-thinking-icon {
    font-size: 18px;
    line-height: 1;
}
.medinfo-thinking-title {
    font-size: 13px;
    font-weight: 700;
    color: #3b4c99;
    letter-spacing: 0.01em;
    flex: 1;
}
.medinfo-thinking-chevron {
    font-size: 14px;
    color: #6b7db8;
    transition: transform 0.25s ease;
}
.medinfo-block--thinking.is-open .medinfo-thinking-chevron {
    transform: rotate(90deg);
}

/* Body — collapsed by default */
.medinfo-thinking-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    padding: 0 16px;
}
.medinfo-block--thinking.is-open .medinfo-thinking-body {
    max-height: 2000px;
    padding: 0 16px 16px;
}

.medinfo-thinking-content {
    font-size: 12.5px;
    line-height: 1.65;
    color: #4a5586;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    white-space: pre-wrap;
    word-break: break-word;
}
.medinfo-thinking-line {
    padding: 1px 0;
}

/* Mobile */
@media (max-width: 600px) {
    .medinfo-thinking-toggle {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .medinfo-thinking-content {
        font-size: 11.5px;
    }
}
