.fmsd-sticky {
    position: fixed;
    right: 24px;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 60;
    visibility: hidden;
    pointer-events: none;
}

.fmsd-sticky.is-visible { visibility: visible; }

.fmsd-sticky__button {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px 14px 16px;
    overflow: visible;
    border: 0;
    border-radius: 999px;
    background: var(--fmsd-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    box-shadow: var(--fmsd-shadow-glow);
    transform: translateY(10px);
    transition: opacity .35s ease-out, transform .35s ease-out, box-shadow .2s ease-out;
    pointer-events: none;
    cursor: pointer;
}

.fmsd-sticky.is-visible .fmsd-sticky__button {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.fmsd-sticky.is-visible .fmsd-sticky__button:hover { transform: scale(1.03); }
.fmsd-sticky__button svg { width: 20px; height: 20px; }
.fmsd-sticky__button > span:not(.fmsd-sticky__ping) { position: relative; z-index: 1; }

.fmsd-sticky__ping {
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: var(--fmsd-primary);
    opacity: .35;
    pointer-events: none;
}

.fmsd-sticky.is-visible:not(.is-open) .fmsd-sticky__ping { animation: fmsd-ping 1.2s ease-out infinite; }
.fmsd-sticky.is-visible:not(.is-open) .fmsd-sticky__chevron { animation: fmsd-chevron .6s ease-in-out infinite alternate; }
.fmsd-sticky.is-open .fmsd-sticky__ping,
.fmsd-sticky.is-open .fmsd-sticky__chevron,
.fmsd-sticky.is-open .fmsd-sticky__icon--message { display: none; }
.fmsd-sticky:not(.is-open) .fmsd-sticky__icon--close { display: none; }
.fmsd-sticky__chevron svg { width: 16px; height: 16px; }

.fmsd-sticky__dialog {
    position: fixed;
    top: 50%;
    right: 24px;
    left: auto;
    z-index: 61;
    width: min(440px,calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    margin: 0;
    padding: 0;
    overflow: visible;
    visibility: hidden;
    border: 0;
    background: transparent;
    opacity: 0;
    transform: translate(56px,-50%) scale(.96);
    transform-origin: right center;
    transition: opacity .42s cubic-bezier(.22,1,.36,1), transform .42s cubic-bezier(.22,1,.36,1), visibility .42s;
    pointer-events: none;
}

.fmsd-sticky.is-panel-visible .fmsd-sticky__dialog[open] {
    visibility: visible;
    opacity: 1;
    transform: translate(0,-50%) scale(1);
    pointer-events: auto;
}

.fmsd-sticky__dialog::backdrop { background: rgba(0,0,0,.4); }
.fmsd-sticky__dialog .fmsd-form { width: 100%; }

.fmsd-sticky__sentinel {
    position: absolute;
    top: 200px;
    left: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

@keyframes fmsd-ping {
    to { opacity: 0; transform: scale(1.6); }
}

@keyframes fmsd-chevron {
    to { transform: translateY(-4px); }
}

@media (max-width: 639.98px) {
    .fmsd-sticky {
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        justify-content: center;
        padding: 0;
    }

    .fmsd-sticky__button {
        width: 100% !important;
        min-width: 0;
        min-height: calc(56px + env(safe-area-inset-bottom));
        justify-content: center;
        padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
        border-radius: 0;
    }

    .fmsd-sticky.is-visible .fmsd-sticky__button:hover { transform: translateY(0); }
    .fmsd-sticky.is-visible:not(.is-open) .fmsd-sticky__ping { animation-name: fmsd-ping-mobile; }
    .fmsd-sticky__button [data-fmsd-sticky-label] { font-size: 0; }
    .fmsd-sticky__button [data-fmsd-sticky-label]::after { font-size: 14px; content: attr(data-mobile-label); }
    .fmsd-sticky__dialog { top: 50%; right: 16px; left: 16px; width: auto; max-height: calc(100dvh - 88px); transform: translate(48px,-50%) scale(.96); transform-origin: center; }
    .fmsd-sticky__dialog .fmsd-form { width: 100%; max-height: calc(100dvh - 88px); overflow-y: auto; overscroll-behavior: contain; }
}

@keyframes fmsd-ping-mobile {
    to { opacity: 0; transform: scale(1.02,1.55); }
}

@media (prefers-reduced-motion: reduce) {
    .fmsd-sticky__ping,
    .fmsd-sticky__chevron { animation: none !important; }
    .fmsd-sticky__button { transition-duration: .01ms; }
    .fmsd-sticky__dialog { transition-duration: .01ms; transform: translate(0,-50%) scale(1); }
}

/* Le menu de sélection reste au-dessus des dialogues de devis. */
dialog .select2-container--open { z-index:100; }
