/* =========================================================================
   Agent MILEX - widget flottant et page plein ecran

   Toutes les tailles sont pilotees par les variables --chatbot-* ci-dessous :
   c'est le seul endroit a modifier pour changer l'echelle de l'interface.

   ATTENTION : les quatre variables de geometrie du panneau
   (--chatbot-panel-w / -h / -min-w / -min-h) sont relues a l'execution par
   chatbot.js (dockPanelToStandard, dockPanelToKpis, redimensionnement).
   CSS et JS partagent donc ces valeurs : ne pas les dupliquer en dur.
   ========================================================================= */

:root {
    /* --- Typographie ---------------------------------------------------- */
    --chatbot-font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --chatbot-fs-title: 0.8125rem;   /* titre de l'en-tete */
    --chatbot-fs-meta: 0.6875rem;    /* sous-titre, mentions discretes */
    --chatbot-fs-text: 0.8125rem;    /* messages dans le widget */
    --chatbot-fs-text-app: 0.875rem; /* messages en plein ecran */
    --chatbot-fs-chip: 0.75rem;      /* suggestions et actions */
    --chatbot-fs-input: 0.8125rem;
    --chatbot-lh: 1.5;
    --chatbot-lh-tight: 1.3;

    /* --- Espacements ---------------------------------------------------- */
    --chatbot-gap-xs: 4px;
    --chatbot-gap-sm: 6px;
    --chatbot-gap: 8px;
    --chatbot-gap-lg: 12px;
    --chatbot-pad-panel: 10px;
    --chatbot-pad-app: 24px;
    --chatbot-bubble-pad: 7px 10px;
    --chatbot-bubble-pad-app: 10px 13px;
    --chatbot-chip-pad: 5px 10px;

    /* --- Rayons --------------------------------------------------------- */
    --chatbot-radius-panel: 12px;
    --chatbot-radius-bubble: 10px;
    --chatbot-radius-tail: 4px;
    --chatbot-radius-control: 8px;
    --chatbot-radius-chip: 999px;

    /* --- Couleurs ------------------------------------------------------- */
    --chatbot-surface: #ffffff;
    --chatbot-canvas: #f4f6fa;
    --chatbot-ink: #1f2d3d;
    --chatbot-ink-soft: #5b6b7f;
    --chatbot-line: rgba(16, 24, 40, 0.10);
    --chatbot-line-strong: rgba(16, 24, 40, 0.16);
    --chatbot-header-bg: #102a43;
    --chatbot-header-ink: #ffffff;
    --chatbot-header-ink-soft: rgba(255, 255, 255, 0.72);
    --chatbot-accent: #0b5ed7;
    --chatbot-accent-dark: #0a4fb4;
    --chatbot-accent-soft: #eaf2ff;
    --chatbot-send: #198754;
    --chatbot-send-dark: #14703f;

    /* --- Ombres et focus ------------------------------------------------ */
    --chatbot-shadow-panel: 0 1px 2px rgba(16, 24, 40, 0.08), 0 18px 44px rgba(16, 24, 40, 0.18);
    --chatbot-shadow-launcher: 0 10px 26px rgba(7, 49, 93, 0.30);
    --chatbot-shadow-bubble: 0 1px 2px rgba(16, 24, 40, 0.06);
    --chatbot-focus-ring: 0 0 0 3px rgba(11, 94, 215, 0.35);
    --chatbot-focus-ring-dark: 0 0 0 3px rgba(255, 255, 255, 0.55);

    /* --- Geometrie du panneau (partagee avec chatbot.js) ---------------- */
    --chatbot-panel-w: 320px;
    --chatbot-panel-h: 420px;
    --chatbot-panel-min-w: 232px;
    --chatbot-panel-min-h: 220px;
    --chatbot-header-h: 44px;
    --chatbot-control-size: 28px;
    --chatbot-launcher-size: 52px;
    --chatbot-touch-target: 40px;

    --chatbot-transition: 140ms ease;
}

/* =========================================================================
   1. Conteneur flottant et lanceur
   ========================================================================= */

.chatbot-widget {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 1200;
    font-family: var(--chatbot-font);
}

.chatbot-launcher {
    width: var(--chatbot-launcher-size);
    height: var(--chatbot-launcher-size);
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-accent), var(--chatbot-send));
    color: #fff;
    box-shadow: var(--chatbot-shadow-launcher);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform var(--chatbot-transition), box-shadow var(--chatbot-transition);
}

.chatbot-launcher:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(7, 49, 93, 0.36);
}

.chatbot-launcher:active {
    transform: translateY(0);
}

.chatbot-launcher:focus-visible {
    outline: none;
    box-shadow: var(--chatbot-shadow-launcher), var(--chatbot-focus-ring);
}

/* =========================================================================
   2. Coque du panneau
   ========================================================================= */

.chatbot-panel {
    position: fixed;
    right: 24px;
    bottom: 160px;
    width: min(var(--chatbot-panel-w), calc(100vw - 24px));
    height: min(var(--chatbot-panel-h), calc(100vh - 180px));
    min-width: var(--chatbot-panel-min-w);
    min-height: var(--chatbot-panel-min-h);
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 24px);
    background: var(--chatbot-surface);
    border: 1px solid var(--chatbot-line);
    border-radius: var(--chatbot-radius-panel);
    box-shadow: var(--chatbot-shadow-panel);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: var(--chatbot-font);
    color: var(--chatbot-ink);
}

.chatbot-panel[hidden] {
    display: none;
}

/* Cale contre le tableau KPI : on s'efface pour ne pas surcharger la page. */
.chatbot-panel.is-kpi-docked {
    border-color: rgba(11, 94, 215, 0.28);
    border-radius: var(--chatbot-radius-control);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 20px rgba(16, 24, 40, 0.12);
}

/* =========================================================================
   3. En-tete et commandes
   ========================================================================= */

.chatbot-panel-header,
.chatbot-app-header {
    display: flex;
    align-items: center;
    gap: var(--chatbot-gap-lg);
    padding: 14px 16px;
    background: var(--chatbot-header-bg);
    color: var(--chatbot-header-ink);
}

.chatbot-panel-header {
    cursor: move;
    user-select: none;
    gap: var(--chatbot-gap-xs);
    min-height: var(--chatbot-header-h);
    padding: 0 var(--chatbot-gap-sm) 0 var(--chatbot-gap-lg);
    flex: none;
}

.chatbot-panel-header div,
.chatbot-app-header div {
    min-width: 0;
    flex: 1;
}

.chatbot-panel-header strong,
.chatbot-panel-header span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatbot-panel-header strong {
    font-size: var(--chatbot-fs-title);
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: var(--chatbot-lh-tight);
}

.chatbot-panel-header span,
.chatbot-app-header p {
    color: var(--chatbot-header-ink-soft);
    font-size: var(--chatbot-fs-meta);
    margin: 0;
}

.chatbot-app-header p {
    font-size: 0.8125rem;
    margin-top: 2px;
}

/* Boutons de l'en-tete du widget : reduire, fermer, plein ecran et
   « Nouvelle conversation » (ajoute par le gabarit, style ici). */
.chatbot-panel-header .chatbot-reset,
.chatbot-open-app,
.chatbot-minimize,
.chatbot-close {
    position: relative;
    z-index: 4;
    flex: none;
    width: var(--chatbot-control-size);
    height: var(--chatbot-control-size);
    padding: 0;
    border-radius: var(--chatbot-radius-control);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--chatbot-header-ink);
    background: rgba(255, 255, 255, 0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--chatbot-transition), border-color var(--chatbot-transition);
}

.chatbot-panel-header .chatbot-reset:hover,
.chatbot-open-app:hover,
.chatbot-minimize:hover,
.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.34);
    color: var(--chatbot-header-ink);
}

.chatbot-panel-header .chatbot-reset:focus-visible,
.chatbot-open-app:focus-visible,
.chatbot-minimize:focus-visible,
.chatbot-close:focus-visible {
    outline: none;
    box-shadow: var(--chatbot-focus-ring-dark);
}

.chatbot-close:hover {
    background: rgba(220, 53, 69, 0.55);
    border-color: rgba(255, 255, 255, 0.42);
}

/* Bouton « Nouvelle conversation » de la page plein ecran : libelle visible. */
.chatbot-app-header .chatbot-reset {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: var(--chatbot-gap-sm);
    min-height: var(--chatbot-touch-target);
    padding: 0 14px;
    border-radius: var(--chatbot-radius-control);
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.08);
    color: var(--chatbot-header-ink);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background var(--chatbot-transition), border-color var(--chatbot-transition);
}

.chatbot-app-header .chatbot-reset:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.38);
}

.chatbot-app-header .chatbot-reset:focus-visible {
    outline: none;
    box-shadow: var(--chatbot-focus-ring-dark);
}

/* =========================================================================
   4. Fil de messages
   ========================================================================= */

.chatbot-messages,
.chatbot-app-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: var(--chatbot-pad-app);
    background: var(--chatbot-canvas);
    /* Barre de defilement discrete */
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 24, 40, 0.22) transparent;
}

.chatbot-messages::-webkit-scrollbar,
.chatbot-app-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track,
.chatbot-app-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb,
.chatbot-app-messages::-webkit-scrollbar-thumb {
    background: rgba(16, 24, 40, 0.18);
    border: 2px solid transparent;
    background-clip: content-box;
    border-radius: 999px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover,
.chatbot-app-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 24, 40, 0.32);
    background-clip: content-box;
}

.chatbot-panel .chatbot-messages {
    padding: var(--chatbot-pad-panel);
}

.chatbot-message {
    display: flex;
    margin-bottom: var(--chatbot-gap);
}

.chatbot-message:last-child {
    margin-bottom: 0;
}

.chatbot-message.user {
    justify-content: flex-end;
}

.chatbot-bubble {
    max-width: 88%;
    min-width: 0;
    padding: var(--chatbot-bubble-pad-app);
    border-radius: var(--chatbot-radius-bubble);
    background: var(--chatbot-surface);
    color: var(--chatbot-ink);
    border: 1px solid var(--chatbot-line);
    box-shadow: var(--chatbot-shadow-bubble);
    white-space: pre-line;
    overflow-wrap: anywhere;
    line-height: var(--chatbot-lh);
    font-size: var(--chatbot-fs-text-app);
}

/* Reponse de l'agent : surface claire, angle bas-gauche redresse. */
.chatbot-message.bot .chatbot-bubble {
    border-bottom-left-radius: var(--chatbot-radius-tail);
}

/* Message de l'utilisateur : aplat colore, angle bas-droit redresse. */
.chatbot-message.user .chatbot-bubble {
    background: var(--chatbot-accent);
    color: #fff;
    border-color: var(--chatbot-accent);
    border-bottom-right-radius: var(--chatbot-radius-tail);
    border-bottom-left-radius: var(--chatbot-radius-bubble);
    box-shadow: 0 1px 2px rgba(11, 94, 215, 0.28);
}

.chatbot-panel .chatbot-bubble {
    max-width: 90%;
    padding: var(--chatbot-bubble-pad);
    font-size: var(--chatbot-fs-text);
}

/* =========================================================================
   5. Puces : actions dans une reponse, suggestions sous le fil
   ========================================================================= */

.chatbot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--chatbot-gap-sm);
    margin-top: var(--chatbot-gap);
    padding-top: var(--chatbot-gap);
    border-top: 1px solid var(--chatbot-line);
}

.chatbot-actions button,
.chatbot-suggestions button,
.chatbot-topic-list button {
    max-width: 100%;
    border: 1px solid rgba(11, 94, 215, 0.24);
    background: var(--chatbot-surface);
    color: var(--chatbot-accent);
    border-radius: var(--chatbot-radius-chip);
    padding: var(--chatbot-chip-pad);
    font-family: inherit;
    font-size: var(--chatbot-fs-chip);
    line-height: var(--chatbot-lh-tight);
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: background var(--chatbot-transition), border-color var(--chatbot-transition),
        color var(--chatbot-transition);
}

.chatbot-actions button:hover,
.chatbot-suggestions button:hover,
.chatbot-topic-list button:hover {
    background: var(--chatbot-accent-soft);
    border-color: rgba(11, 94, 215, 0.45);
    color: var(--chatbot-accent-dark);
}

.chatbot-actions button:active,
.chatbot-suggestions button:active,
.chatbot-topic-list button:active {
    background: #dbe9ff;
}

.chatbot-actions button:focus-visible,
.chatbot-suggestions button:focus-visible,
.chatbot-topic-list button:focus-visible {
    outline: none;
    border-color: var(--chatbot-accent);
    box-shadow: var(--chatbot-focus-ring);
}

/* Les suggestions sont deplacees par chatbot.js en fin de fil : elles suivent
   la derniere reponse et defilent avec la conversation. */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--chatbot-gap-sm);
    margin-top: var(--chatbot-gap);
}

.chatbot-suggestions[hidden] {
    display: none;
}

.chatbot-panel .chatbot-suggestions {
    gap: var(--chatbot-gap-xs);
}

.chatbot-panel .chatbot-suggestions button {
    padding: 4px 9px;
    font-size: var(--chatbot-fs-chip);
}

/* =========================================================================
   6. Zone de saisie
   ========================================================================= */

.chatbot-form,
.chatbot-app-form {
    display: flex;
    align-items: center;
    gap: var(--chatbot-gap);
    padding: var(--chatbot-gap-lg);
    background: var(--chatbot-surface);
    border-top: 1px solid var(--chatbot-line);
    flex: none;
}

.chatbot-form {
    gap: var(--chatbot-gap-sm);
    padding: var(--chatbot-gap-sm) var(--chatbot-pad-panel) var(--chatbot-gap);
}

.chatbot-form input,
.chatbot-app-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--chatbot-line-strong);
    border-radius: var(--chatbot-radius-control);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--chatbot-ink);
    background: var(--chatbot-surface);
    outline: none;
    transition: border-color var(--chatbot-transition), box-shadow var(--chatbot-transition);
}

.chatbot-form input {
    min-height: 34px;
    padding: 6px 10px;
    font-size: var(--chatbot-fs-input);
}

.chatbot-form input::placeholder,
.chatbot-app-form input::placeholder {
    color: var(--chatbot-ink-soft);
}

.chatbot-form input:focus,
.chatbot-app-form input:focus {
    border-color: var(--chatbot-accent);
    box-shadow: var(--chatbot-focus-ring);
}

.chatbot-form button,
.chatbot-app-form button {
    border: 0;
    border-radius: var(--chatbot-radius-control);
    background: var(--chatbot-send);
    color: #fff;
    padding: 0 14px;
    min-width: 42px;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--chatbot-transition), box-shadow var(--chatbot-transition);
}

.chatbot-form button:hover,
.chatbot-app-form button:hover {
    background: var(--chatbot-send-dark);
}

.chatbot-form button:focus-visible,
.chatbot-app-form button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.40);
}

.chatbot-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    min-width: 34px;
    width: 34px;
    min-height: 34px;
    padding: 0;
    font-size: 0.8125rem;
}

/* =========================================================================
   7. Poignees de redimensionnement
   ========================================================================= */

.chatbot-resize-handle {
    position: absolute;
    z-index: 3;
}

.chatbot-resize-top {
    top: 0;
    left: 18px;
    right: 18px;
    height: 10px;
    cursor: ns-resize;
}

.chatbot-resize-right {
    top: 18px;
    right: 0;
    bottom: 18px;
    width: 10px;
    cursor: ew-resize;
}

.chatbot-resize-bottom {
    left: 0;
    right: 18px;
    bottom: 0;
    height: 10px;
    cursor: ns-resize;
}

.chatbot-resize-left {
    top: 18px;
    left: 0;
    bottom: 18px;
    width: 10px;
    cursor: ew-resize;
}

.chatbot-resize-top-left,
.chatbot-resize-top-right,
.chatbot-resize-bottom-left,
.chatbot-resize-bottom-right {
    width: 22px;
    height: 22px;
}

.chatbot-resize-top-left {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.chatbot-resize-top-right {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.chatbot-resize-bottom-left {
    left: 0;
    bottom: 0;
    cursor: nesw-resize;
}

.chatbot-resize-bottom-right {
    right: 0;
    bottom: 0;
    cursor: nwse-resize;
}

.chatbot-resize-bottom-right::before {
    content: "";
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 9px;
    height: 9px;
    border-right: 2px solid rgba(16, 42, 67, 0.32);
    border-bottom: 2px solid rgba(16, 42, 67, 0.32);
}

/* =========================================================================
   8. Etat reduit
   ========================================================================= */

.chatbot-panel.is-minimized {
    width: min(var(--chatbot-panel-w), calc(100vw - 24px)) !important;
    height: var(--chatbot-header-h) !important;
    min-height: var(--chatbot-header-h);
}

.chatbot-panel.is-minimized .chatbot-messages,
.chatbot-panel.is-minimized .chatbot-suggestions,
.chatbot-panel.is-minimized .chatbot-form,
.chatbot-panel.is-minimized .chatbot-resize-handle {
    display: none;
}

.chatbot-panel.is-minimized .chatbot-panel-header {
    height: var(--chatbot-header-h);
}

/* =========================================================================
   9. Page plein ecran /chatbot/
   ========================================================================= */

.chatbot-app {
    min-height: calc(100vh - 80px);
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    background: #eef3f7;
    font-family: var(--chatbot-font);
    color: var(--chatbot-ink);
}

.chatbot-app-sidebar {
    background: var(--chatbot-surface);
    border-right: 1px solid var(--chatbot-line);
    padding: var(--chatbot-pad-app);
}

.chatbot-brand-block {
    display: flex;
    gap: var(--chatbot-gap-lg);
    align-items: center;
    margin-bottom: 20px;
}

.chatbot-brand-icon {
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: var(--chatbot-radius-control);
    background: var(--chatbot-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.chatbot-brand-block h1 {
    font-size: 1.15rem;
    margin: 0;
    color: var(--chatbot-header-bg);
}

.chatbot-brand-block p {
    margin: 2px 0 0;
    color: var(--chatbot-ink-soft);
    font-size: 0.8125rem;
    line-height: var(--chatbot-lh-tight);
}

.chatbot-shortcuts {
    display: grid;
    gap: var(--chatbot-gap-sm);
    margin-bottom: 20px;
}

.chatbot-shortcuts a {
    display: flex;
    align-items: center;
    gap: var(--chatbot-gap);
    min-height: var(--chatbot-touch-target);
    color: var(--chatbot-ink);
    background: #f7fafc;
    border: 1px solid var(--chatbot-line);
    border-radius: var(--chatbot-radius-control);
    text-decoration: none;
    font-size: 0.8125rem;
    padding: 8px 12px;
    transition: background var(--chatbot-transition), color var(--chatbot-transition),
        border-color var(--chatbot-transition);
}

.chatbot-shortcuts a:hover {
    color: var(--chatbot-accent-dark);
    background: var(--chatbot-accent-soft);
    border-color: rgba(11, 94, 215, 0.32);
}

.chatbot-shortcuts a:focus-visible {
    outline: none;
    border-color: var(--chatbot-accent);
    box-shadow: var(--chatbot-focus-ring);
}

.chatbot-topic-list {
    display: grid;
    gap: var(--chatbot-gap-sm);
}

.chatbot-topic-list button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--chatbot-gap);
    min-height: var(--chatbot-touch-target);
    padding: 8px 12px;
    border-radius: var(--chatbot-radius-control);
    text-align: left;
    color: var(--chatbot-ink);
    border-color: var(--chatbot-line);
}

.chatbot-app-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chatbot-app-header {
    min-height: 72px;
    border-bottom: 1px solid var(--chatbot-line);
}

.chatbot-app-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.chatbot-app-messages {
    padding: var(--chatbot-pad-app);
}

.chatbot-app-form {
    padding: var(--chatbot-gap-lg) var(--chatbot-pad-app) 18px;
}

.chatbot-app-form input {
    min-height: var(--chatbot-touch-target);
}

.chatbot-app-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--chatbot-gap);
    min-height: var(--chatbot-touch-target);
    padding: 0 18px;
    font-size: 0.875rem;
}

.chatbot-highlight {
    outline: 3px solid rgba(25, 135, 84, 0.5);
    outline-offset: 4px;
}

/* =========================================================================
   10. Rendu Markdown des reponses (aligne sur l'echelle ci-dessus)
   ========================================================================= */

.chatbot-bubble p {
    margin: 0 0 0.5em;
}

.chatbot-bubble p:last-child,
.chatbot-bubble ul:last-child,
.chatbot-bubble ol:last-child {
    margin-bottom: 0;
}

.chatbot-bubble ul,
.chatbot-bubble ol {
    margin: 0 0 0.5em;
    padding-left: 1.15em;
}

.chatbot-bubble li {
    margin-bottom: 0.25em;
}

.chatbot-bubble li:last-child {
    margin-bottom: 0;
}

/* Puces imbriquees sous un element numerote. */
.chatbot-bubble li > ul {
    margin: 0.25em 0 0;
    list-style: circle;
}

.chatbot-bubble ol > li {
    margin-bottom: 0.4em;
}

.chatbot-bubble ol > li::marker {
    font-weight: 600;
}

.chatbot-bubble strong {
    font-weight: 600;
}

.chatbot-bubble code {
    background: rgba(15, 42, 74, 0.08);
    border-radius: var(--chatbot-radius-tail);
    padding: 1px 4px;
    font-family: 'Consolas', 'SFMono-Regular', Menlo, monospace;
    font-size: 0.9em;
}

.chatbot-bubble a {
    color: var(--chatbot-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chatbot-bubble a:hover {
    color: var(--chatbot-accent-dark);
}

.chatbot-bubble a:focus-visible {
    outline: 2px solid var(--chatbot-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Sur l'aplat colore du message utilisateur, code et liens restent lisibles. */
.chatbot-message.user .chatbot-bubble code {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.chatbot-message.user .chatbot-bubble a {
    color: #fff;
}

.chatbot-message.user .chatbot-bubble a:focus-visible {
    outline-color: #fff;
}

/* Curseur pendant la generation progressive */
.chatbot-bubble.is-streaming::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 1em;
    margin-left: 2px;
    background: currentColor;
    opacity: 0.55;
    animation: chatbot-blink 1s steps(2, start) infinite;
    vertical-align: text-bottom;
}

@keyframes chatbot-blink {
    to {
        visibility: hidden;
    }
}

/* =========================================================================
   11. Adaptations ecran et peripherique
   ========================================================================= */

/* Pointeur grossier (tactile) : cibles portees a 40px sans alourdir le
   rendu souris. */
@media (pointer: coarse) {
    .chatbot-panel-header .chatbot-reset,
    .chatbot-open-app,
    .chatbot-minimize,
    .chatbot-close {
        width: var(--chatbot-touch-target);
        height: var(--chatbot-touch-target);
        font-size: 0.875rem;
    }

    .chatbot-panel-header {
        min-height: 48px;
    }

    .chatbot-panel.is-minimized {
        height: 48px !important;
        min-height: 48px;
    }

    .chatbot-panel.is-minimized .chatbot-panel-header {
        height: 48px;
    }

    .chatbot-actions button,
    .chatbot-suggestions button,
    .chatbot-topic-list button,
    .chatbot-panel .chatbot-suggestions button {
        min-height: var(--chatbot-touch-target);
        padding: 8px 14px;
    }

    .chatbot-form input,
    .chatbot-form button {
        min-height: var(--chatbot-touch-target);
    }

    .chatbot-form button {
        width: var(--chatbot-touch-target);
        min-width: var(--chatbot-touch-target);
    }
}

@media (max-width: 900px) {
    .chatbot-app {
        grid-template-columns: 1fr;
    }

    .chatbot-app-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--chatbot-line);
    }
}

/* Petit ecran : le panneau prend la largeur utile sans couvrir toute la
   page ni provoquer de defilement horizontal. */
@media (max-width: 600px) {
    :root {
        --chatbot-pad-app: 16px;
    }

    .chatbot-widget {
        right: 16px;
        bottom: 82px;
    }

    .chatbot-panel {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        height: min(60vh, calc(100vh - 150px));
        max-height: calc(100vh - 120px);
        min-width: 0;
        right: 12px;
        left: auto;
        bottom: 144px;
    }

    .chatbot-panel.is-minimized {
        width: calc(100vw - 24px) !important;
    }

    .chatbot-panel .chatbot-bubble {
        max-width: 94%;
    }

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

    .chatbot-app-form button {
        min-height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chatbot-launcher,
    .chatbot-actions button,
    .chatbot-suggestions button,
    .chatbot-topic-list button,
    .chatbot-shortcuts a,
    .chatbot-form input,
    .chatbot-form button,
    .chatbot-app-form input,
    .chatbot-app-form button,
    .chatbot-panel-header .chatbot-reset,
    .chatbot-app-header .chatbot-reset,
    .chatbot-open-app,
    .chatbot-minimize,
    .chatbot-close {
        transition: none;
    }

    .chatbot-bubble.is-streaming::after {
        animation: none;
    }
}
