.chatbot-modal { --chatbot-accent: #24658c; --chatbot-soft: #edf5fa; }
.chatbot-modal .modal-dialog { width: calc(100vw - 2rem) !important; max-width: 980px; }
.chatbot-modal .modal-content.card { height: 84vh; height: 84dvh; width: 100%; color: var(--neo-text); background: var(--neo-bg, #fff) !important; }
.chatbot-modal .modal-body { padding: 28px 36px !important; background: var(--neo-light-bg); }
.chatbot-modal [data-chatbot-messages] { max-width: 800px; margin: 0 auto; }
.chatbot-modal .modal-footer { border-color: var(--neo-border); padding: 16px 28px !important; }
.chatbot-modal .modal-footer form, .chatbot-modal [data-chatbot-status], .chatbot-modal [data-chatbot-error] { max-width: 800px; margin-left: auto; margin-right: auto; }
.chatbot-modal [data-chatbot-status]:empty { display: none; }
.chatbot-modal .chatbot-welcome { min-height: 100%; display: flex; align-items: center; justify-content: center; }
.chatbot-modal [hidden] { display: none !important; }
.chatbot-message { margin-bottom: 28px; min-width: 0; }
.chatbot-message:last-child { margin-bottom: 0; }
.chatbot-author { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; font-weight: 650; color: var(--neo-text); }
.chatbot-avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 9px; color: var(--chatbot-accent); background: var(--chatbot-soft); }
.chatbot-message-user { margin-left: auto; max-width: 85%; width: fit-content; }
.chatbot-message-user .chatbot-author { justify-content: flex-end; }
.chatbot-message-user .chatbot-message-content { padding: 12px 18px; background: var(--chatbot-soft); border: 1px solid var(--neo-border); border-radius: 14px 4px 14px 14px; }
.chatbot-message-assistant .chatbot-message-content { margin-left: 36px; padding: 16px 18px; background: var(--neo-bg, #fff); border: 1px solid var(--neo-border); border-radius: 4px 14px 14px 14px; box-shadow: 0 2px 5px var(--neo-shadow); }
.chatbot-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.75; max-width: 72ch; }
.chatbot-results { margin: 14px 0 18px; overflow-wrap: anywhere; }
.chatbot-results:first-child { margin-top: 0; }
.chatbot-results-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--neo-text-muted); }
.chatbot-result-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--neo-bg); border: 1px solid var(--neo-border); color: var(--neo-text); font-size: 11px; }
.chatbot-dossier-list { display: grid; gap: 10px; }
.chatbot-dossier { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px; border: 1px solid var(--neo-border); border-radius: 10px; background: var(--neo-bg); box-shadow: 0 2px 5px var(--neo-shadow); }
.chatbot-dossier-identity { display: flex; gap: 12px; min-width: 0; }
.chatbot-dossier-icon { display: flex; align-items: center; justify-content: center; flex: 0 0 36px; height: 36px; border-radius: 9px; font-size: 18px; background: var(--chatbot-soft); color: var(--chatbot-accent); }
.chatbot-dossier-details { min-width: 0; }
.chatbot-dossier-name { font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--neo-text); }
.chatbot-dossier-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; font-size: 13px; color: var(--neo-text-muted); }
.chatbot-dossier-reference { font-size: 12px; }
.chatbot-dossier-type { margin-top: 6px; font-size: 12px; color: var(--neo-text-muted); }
.chatbot-dossier-actions { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; gap: 12px; max-width: 42%; }
.chatbot-dossier-status { padding: 4px 9px; border-radius: 6px; background: var(--chatbot-soft); color: var(--chatbot-accent); font-size: 12px; font-weight: 600; line-height: 1.4; }
.chatbot-dossier-link { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; color: var(--chatbot-accent); font-size: 13px; font-weight: 650; text-decoration: none; }
.chatbot-dossier-link:hover { color: var(--neo-text); text-decoration: underline; }
.chatbot-dossier-link:focus-visible { outline: 2px solid var(--chatbot-accent); outline-offset: 4px; border-radius: 3px; }
.chatbot-results-note, .chatbot-empty { font-size: 13px; color: var(--neo-text-muted); margin: 10px 0 0; line-height: 1.5; }
.chatbot-modal .neo-action-btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.chatbot-modal.rdv-form-neo textarea.form-control { min-height: 52px; max-height: 120px; resize: vertical; padding: 13px 15px; font-size: 14px; line-height: 1.5; border-radius: 10px; }
.chatbot-modal [data-chatbot-send] { width: 44px; min-width: 44px; height: 44px; flex: 0 0 44px; }
.chatbot-modal .modal-title { flex-shrink: 0; white-space: nowrap; }
.chatbot-modal .modal-header .neo-action-btn { width: auto; }
.chatbot-session-notice { font-size: 11px; color: var(--neo-text-muted); margin-top: 8px; }
[data-theme="dark"] .chatbot-modal { --chatbot-accent: #a4d5f2; --chatbot-soft: #263844; }
@media (max-width: 575.98px) {
    .chatbot-modal .modal-dialog { width: calc(100vw - 1rem) !important; }
    .chatbot-modal .modal-content.card { height: 94vh; height: 94dvh; }
    .chatbot-modal .modal-body { padding: 18px 14px !important; }
    .chatbot-modal .modal-footer { padding: 12px 14px !important; }
    .chatbot-message-user { max-width: 92%; }
    .chatbot-message-assistant .chatbot-message-content { margin-left: 0; padding: 14px; }
    .chatbot-dossier { padding: 14px; flex-direction: column; align-items: stretch; gap: 12px; }
    .chatbot-dossier-actions { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; max-width: none; padding-top: 10px; border-top: 1px solid var(--neo-border); }
}

.chatbot-modal .chatbot-sheet { overflow: auto; max-height: 260px; border: 1px solid #dce4ed; border-radius: 8px; margin-top: 8px; background: #fff; }
.chatbot-modal .chatbot-sheet th { position: sticky; top: 0; background: #edf4fa; font-weight: 600; }
.chatbot-modal .chatbot-sheet td, .chatbot-modal .chatbot-sheet th { min-width: 130px; max-width: 300px; padding: 8px 12px; font-size: 12px; overflow-wrap: anywhere; }
.chatbot-modal .chatbot-attachments { max-height: 260px; overflow: auto; }
.chatbot-modal .chatbot-attachment { border: 1px solid #dce4ed; border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; font-size: 13px; }
.chatbot-modal .chatbot-creation { border: 1px solid #c7dbea; border-radius: 12px; padding: 16px; background: #f6faff; margin-bottom: 12px; }
.chatbot-modal .chatbot-creation summary { cursor: pointer; font-size: 13px; font-weight: 600; }

.chatbot-modal .chatbot-attachment .chatbot-sheet th:first-child, .chatbot-modal .chatbot-attachment .chatbot-sheet td:first-child { min-width: 44px; width: 44px; }

.chatbot-modal.chatbot-expanded .modal-dialog { width: 100vw !important; max-width: none; height: 100dvh; margin: 0; }
.chatbot-modal.chatbot-expanded .modal-content.card { height: 100dvh; max-height: 100dvh; border-radius: 0; }
.chatbot-modal.chatbot-expanded [data-chatbot-messages] { max-width: 1400px; }
.chatbot-modal.chatbot-expanded .chatbot-attachments { max-height: 45dvh; }
.chatbot-modal.chatbot-expanded .chatbot-sheet { max-height: 35dvh; }
.chatbot-preview-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chatbot-preview-toolbar .form-select { width: auto; max-width: 200px; }
.chatbot-attachment-summary { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.chatbot-attachment-summary > span { min-width: 0; overflow-wrap: anywhere; }
.chatbot-attachment-summary button { flex-shrink: 0; }
.chatbot-reply-loading { display: flex; align-items: center; gap: 10px; min-height: 26px; color: var(--chatbot-accent); font-size: 14px; line-height: 1.5; }
.chatbot-reply-loading .spinner-border { flex-shrink: 0; }
.chatbot-reply-loading:not(:first-child) { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) { .chatbot-reply-loading .spinner-border { animation: none; } }

/* Conversation-first layout, with window controls instead of a header bar. */
.chatbot-modal .modal-dialog { width: calc(100vw - 3rem) !important; max-width: 1600px; margin: 1.5rem auto; }
.chatbot-modal .modal-content.card { height: calc(100dvh - 3rem); max-height: calc(100dvh - 3rem); position: relative; }
.chatbot-modal .modal-body { padding: 58px 24px 24px !important; }
.chatbot-modal [data-chatbot-messages], .chatbot-modal.chatbot-expanded [data-chatbot-messages] { max-width: none; }
.chatbot-modal .modal-footer { padding: 12px 24px !important; }
.chatbot-modal .modal-footer form, .chatbot-modal [data-chatbot-status], .chatbot-modal [data-chatbot-error] { max-width: none; }
.chatbot-window-actions { position: absolute; top: 10px; right: 16px; z-index: 5; display: flex; gap: 6px; padding: 4px; border-radius: 24px; background: var(--neo-bg, #fff); }
.chatbot-window-actions .neo-action-btn { width: 32px; height: 32px; min-height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.chatbot-modal .chatbot-text { max-width: 100ch; }
.chatbot-modal .chatbot-attachments { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; }
.chatbot-modal .chatbot-attachment { max-width: 100%; width: fit-content; margin: 0 0 6px; padding: 6px 10px; background: var(--chatbot-soft); }
.chatbot-modal .chatbot-attachment[open] { width: 100%; }
.chatbot-attachment-summary > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 560px; }
.chatbot-modal .chatbot-remove-file { border: 0; background: transparent; color: var(--neo-text-muted); padding: 4px; line-height: 1; border-radius: 4px; }
.chatbot-modal .chatbot-remove-file:hover { background: var(--neo-bg, #fff); color: #b42318; }
.chatbot-attach-button { display: inline-flex; justify-content: center; align-items: center; width: 36px; height: 40px; flex-shrink: 0; font-size: 22px; cursor: pointer; color: var(--chatbot-accent); }
.chatbot-modal .chatbot-tool-details { padding: 10px 12px; margin-bottom: 8px; }
.chatbot-modal .chatbot-sheet th:first-child, .chatbot-modal .chatbot-sheet td:first-child { min-width: 44px; }
.chatbot-modal.chatbot-expanded .chatbot-attachments { max-height: 220px; }
.chatbot-modal .chatbot-attachment .chatbot-sheet { max-height: 150px; }
.chatbot-modal .chatbot-session-notice { margin-top: 5px; }
@media (max-width: 575.98px) {
    .chatbot-modal .modal-dialog { width: calc(100vw - 1rem) !important; margin: .5rem auto; }
    .chatbot-modal .modal-content.card { height: calc(100dvh - 1rem); max-height: calc(100dvh - 1rem); }
    .chatbot-modal .modal-body { padding: 56px 12px 16px !important; }
    .chatbot-modal .modal-footer { padding: 10px 12px !important; }
    .chatbot-attachment-summary > span { max-width: calc(100vw - 110px); }
}
.chatbot-modal.chatbot-expanded .modal-dialog { width: 100vw !important; margin: 0; }
.chatbot-modal.chatbot-expanded .modal-content.card { height: 100dvh; max-height: 100dvh; }

#sidebarChatbotModal .chatbot-question { min-width: 0; margin: .75rem 0; padding: 1rem; border: 1px solid #cbdce8; border-radius: 14px; background: #f7fbff; }
#sidebarChatbotModal .chatbot-question legend { float: none; width: auto; margin-bottom: .75rem; }
#sidebarChatbotModal .chatbot-choice-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: .5rem; }
#sidebarChatbotModal .chatbot-choice { display: flex; flex-direction: column; gap: .25rem; text-align: left; padding: .75rem 1rem; background: white; border: 1px solid #cbdce8; border-radius: 10px; color: inherit; overflow-wrap: anywhere; }
#sidebarChatbotModal .chatbot-choice:hover:not(:disabled), #sidebarChatbotModal .chatbot-choice[aria-pressed="true"] { background: #e8f4ff; border-color: #2784c3; }
#sidebarChatbotModal .chatbot-choice:focus-visible { outline: 3px solid #2784c3; outline-offset: 2px; }
#sidebarChatbotModal .chatbot-choice:disabled { cursor: default; opacity: .7; }

#sidebarChatbotModal .chatbot-help-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: .75rem; margin: .5rem 0; }
#sidebarChatbotModal .chatbot-help-card { min-width: 0; padding: 1rem; border: 1px solid #cbdce8; border-radius: 12px; background: #f7fbff; overflow-wrap: anywhere; }
#sidebarChatbotModal .chatbot-help-card > .chatbot-dossier-link { display: inline-flex; margin: .5rem 0; }
#sidebarChatbotModal .chatbot-workflow-stage { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .75rem 0; border-bottom: 1px solid #dde6ee; }
#sidebarChatbotModal .chatbot-workflow-stage:last-child { border-bottom: 0; }

.chatbot-text.chatbot-markdown { white-space: normal; }
.chatbot-markdown > :last-child { margin-bottom: 0; }
.chatbot-markdown p, .chatbot-markdown ul, .chatbot-markdown ol, .chatbot-markdown blockquote { margin: 0 0 .75rem; }
.chatbot-markdown ul, .chatbot-markdown ol { padding-left: 1.5rem; }
.chatbot-markdown li > p { margin-bottom: .25rem; }
.chatbot-markdown h1, .chatbot-markdown h2, .chatbot-markdown h3, .chatbot-markdown h4, .chatbot-markdown h5, .chatbot-markdown h6 { font-size: 1.05em; font-weight: 700; margin: 1rem 0 .5rem; }
.chatbot-markdown blockquote { border-left: 3px solid var(--neo-border); padding-left: 1rem; color: var(--neo-text-muted); }
.chatbot-markdown pre { white-space: pre; overflow: auto; padding: .75rem; background: var(--chatbot-soft); border-radius: 6px; }
.chatbot-markdown table { display: block; overflow-x: auto; border-collapse: collapse; margin-bottom: .75rem; }
.chatbot-markdown th, .chatbot-markdown td { border: 1px solid var(--neo-border); padding: .4rem .65rem; }
.chatbot-markdown a { color: var(--chatbot-accent); text-decoration: underline; }

/* Override the site's global .modal .modal-dialog margin: auto !important. */
#sidebarChatbotModal .modal-dialog { margin: 24px auto !important; height: calc(100dvh - 48px); min-height: 0; max-width: min(1600px, calc(100vw - 48px)) !important; }
#sidebarChatbotModal .modal-content.card { height: 100%; max-height: 100%; }
.chatbot-examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 960px; margin: 20px auto 0; }
.chatbot-example { border: 1px solid var(--neo-border); border-radius: 12px; padding: 14px 16px; background: var(--neo-bg, #fff); color: var(--chatbot-accent); font-size: 13px; line-height: 1.5; text-align: left; }
.chatbot-example-title { display: block; font-weight: 600; margin-bottom: 5px; }
.chatbot-example-description { display: block; color: var(--neo-text, #334155); font-size: 12px; font-weight: 400; }
.chatbot-example:hover { background: var(--chatbot-soft); }
.chatbot-example:focus-visible { outline: 2px solid var(--chatbot-accent); outline-offset: 3px; }
.chatbot-example:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 575.98px) {
    .chatbot-examples { grid-template-columns: minmax(0, 1fr); }
    #sidebarChatbotModal .modal-dialog { margin: 12px auto !important; height: calc(100dvh - 24px); max-width: calc(100vw - 24px) !important; }
}
#sidebarChatbotModal.chatbot-expanded .modal-dialog { margin: 0 !important; height: 100dvh; max-width: 100vw !important; }
