/* Styles isolés de l’assistant : palette CiviConnect, sans dépendance. */
#cc-help {
    font-family: inherit;
    color: #153e32;
    font-size: 16px;
    line-height: 1.55;
}
#cc-help *, #cc-help *::before, #cc-help *::after {
    box-sizing: border-box;
}
#cc-help button, #cc-help input {
    font: inherit;
}
#cc-help button {
    cursor: pointer;
}
#cc-help button:focus-visible, #cc-help a:focus-visible, #cc-help input:focus-visible {
    outline: 3px solid #a64b14;
    outline-offset: 3px;
}
#cc-help .cc-help-launch {
    position: fixed;
    right: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 18px;
    border: 1px solid #ffffff;
    border-radius: 30px;
    background: #153e32;
    color: #ffffff;
    box-shadow: 0 5px 22px #153e3226;
}
#cc-help.cc-help-messages .cc-help-launch {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}
#cc-help-panel {
    position: fixed;
    right: 20px;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    z-index: 95;
    display: flex;
    flex-direction: column;
    width: min(580px, calc(100vw - 24px));
    height: min(780px, calc(100dvh - 100px));
    max-height: calc(100dvh - 100px);
    overflow: hidden;
    border: 1px solid #c9d4cd;
    border-radius: 20px;
    background: #fffefa;
    box-shadow: 0 12px 48px #153e322b;
}
#cc-help-panel[hidden] {
    display: none;
}
#cc-help .cc-help-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 16px;
    background: #153e32;
    color: white;
    flex-shrink: 0;
}
#cc-help h2 {
    margin: 0;
    font-size: 18px;
    color: inherit;
    line-height: 1.3;
}
#cc-help .cc-help-head p {
    margin: 4px 0 0;
    font-size: 13px;
    color: #e0ece5;
}
#cc-help .cc-help-close {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 1px solid #87a498;
    border-radius: 12px;
    color: white;
    background: transparent;
    font-size: 28px;
}
#cc-help .cc-help-note {
    margin: 0;
    padding: 8px 16px;
    color: #566357;
    font-size: 12px;
    background: #f2f3eb;
    flex-shrink: 0;
}
#cc-help .cc-help-log {
    flex: 1 1 auto;
    min-height: 70px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
}
#cc-help .cc-help-message {
    padding: 12px;
    border-radius: 12px;
    background: #eef2ec;
    margin: 0 18px 12px 0;
    overflow-wrap: anywhere;
}
#cc-help .cc-help-message p {
    margin: 0;
    font-size: 16px;
    line-height: 1.65;
    white-space: pre-line;
    color: #233d32;
}
#cc-help .cc-help-user {
    margin-left: 24px;
    margin-right: 0;
    background: #fff0e4;
}
#cc-help .cc-help-message a {
    display: inline-block;
    padding: 10px 0 0;
    font-weight: 700;
    color: #153e32;
    text-decoration: underline;
}
#cc-help .cc-help-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    border-top: 1px solid #dfe5dd;
    max-height: 150px;
    overflow-y: auto;
    flex-shrink: 0;
}
#cc-help .cc-help-choices button {
    min-height: 44px;
    padding: 8px 11px;
    border: 1px solid #a9bdb0;
    border-radius: 12px;
    background: white;
    color: #153e32;
    font-size: 14px;
    text-align: left;
}
#cc-help .cc-help-choices button:hover {
    background: #e8eee5;
}
#cc-help .cc-help-form {
    padding: 0 14px 10px;
    flex-shrink: 0;
}
#cc-help .cc-help-form label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}
#cc-help .cc-help-form > div {
    display: flex;
    gap: 8px;
}
#cc-help input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 8px;
    border: 1px solid #a9bdb0;
    border-radius: 10px;
    color: #153e32;
    background: white;
    font-size: 16px;
}
#cc-help .cc-help-form button {
    width: 44px;
    flex-shrink: 0;
    border: 0;
    border-radius: 10px;
    background: #153e32;
    color: white;
}
#cc-help .cc-help-foot {
    padding: 0 14px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
    font-size: 11px;
    color: #526256;
}
#cc-help .cc-help-reset {
    min-height: 32px;
    border: 0;
    background: transparent;
    color: #153e32;
    text-decoration: underline;
    font-size: 12px;
}
@media (max-width: 600px) {
    #cc-help-panel {
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        height: calc(100dvh - 24px - env(safe-area-inset-bottom, 0px));
        max-height: calc(100dvh - 24px - env(safe-area-inset-bottom, 0px));
    }
    #cc-help .cc-help-launch {
        right: 12px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    #cc-help:has(#cc-help-panel:not([hidden])) .cc-help-launch {
        visibility: hidden;
    }
}
@media (max-height: 500px) {
    #cc-help-panel {
        bottom: 8px;
        height: calc(100dvh - 16px);
        max-height: calc(100dvh - 16px);
    }
    #cc-help .cc-help-head {
        padding: 8px 12px;
    }
    #cc-help .cc-help-head p, #cc-help .cc-help-note, #cc-help .cc-help-foot span {
        display: none;
    }
    #cc-help .cc-help-choices {
        max-height: 58px;
        padding: 6px 12px;
    }
}

/* Indicateur discret de préparation des conseils. */
#cc-help .cc-help-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    font-size: 14px;
    color: #526256;
}
#cc-help .cc-help-dots {
    display: inline-flex;
    gap: 4px;
}
#cc-help .cc-help-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #153e32;
    animation: cc-help-pulse 900ms ease-in-out infinite;
}
#cc-help .cc-help-dots i:nth-child(2) { animation-delay: 150ms; }
#cc-help .cc-help-dots i:nth-child(3) { animation-delay: 300ms; }
#cc-help button:disabled { cursor: wait; opacity: 0.6; }
@keyframes cc-help-pulse {
    0%, 100% { opacity: 0.35; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
    #cc-help .cc-help-dots i { animation: none; }
}

/* Dans la messagerie, l’aide est rangée dans l’en-tête. */
#cc-help.cc-help-messages .cc-help-launch {
    display: none;
}
#cc-help.cc-help-docked {
    flex: 0 0 auto;
    margin-left: auto;
}
#cc-help.cc-help-docked .cc-help-launch {
    display: inline-flex;
    position: static;
    min-height: 44px;
    padding: 8px 12px;
    box-shadow: none;
}
