.rk-float-dock {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1060;
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    padding: 0.35rem;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    box-shadow:
        0 12px 32px rgba(15, 23, 42, 0.16),
        0 2px 8px rgba(15, 23, 42, 0.08);
}

.rk-float-dock__divider {
    width: 1px;
    margin: 0.5rem 0.2rem;
    background: rgba(15, 23, 42, 0.12);
    align-self: stretch;
}

.rk-float-dock__btn {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    min-width: 3.5rem;
    height: 3.5rem;
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #334155;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.rk-float-dock__btn .bi {
    font-size: 1.2rem;
    line-height: 1;
}

.rk-float-dock__caption {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1;
    text-transform: uppercase;
}

.rk-float-dock__btn--chat {
    color: #006d88;
}

.rk-float-dock__btn--chat:hover,
.rk-float-dock__btn--chat:focus-visible {
    background: rgba(0, 136, 168, 0.12);
    color: #005a70;
}

.rk-float-dock__btn--chat.is-active {
    background: rgba(0, 136, 168, 0.16);
    color: #005a70;
}

.rk-float-dock__btn--help {
    color: #007693;
}

.rk-float-dock__btn--help:hover,
.rk-float-dock__btn--help:focus-visible {
    background: rgba(0, 137, 123, 0.12);
    color: #004d40;
}

.rk-float-dock__btn--help.is-open {
    background: #475569;
    color: #fff;
}

.rk-float-dock__btn--help.is-pulse {
    animation: rk-float-dock-pulse 2.4s ease-in-out 3;
}

.rk-float-dock__badge {
    position: absolute;
    top: 0.1rem;
    right: 0.15rem;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.22rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1.05rem;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

@keyframes rk-float-dock-pulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 0 6px rgba(0, 137, 123, 0.16); }
}

/* Keep Save/Cancel (and other modal footers) clear of Chat/Help */
body:has(.modal.show) .rk-float-dock,
body:has(.modal.show) .rk-help-tip,
body:has(.pva-drawer-backdrop) .rk-float-dock,
body:has(.pva-drawer-backdrop) .rk-help-tip,
body:has(.vm-drawer) .rk-float-dock,
body:has(.vm-drawer) .rk-help-tip,
body:has(.emp-chat-drawer) .rk-float-dock,
body:has(.emp-chat-drawer) .rk-help-tip {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Legacy FAB selectors — hidden so old cached HTML/CSS cannot show duplicates */
.rk-help-fab-wrap,
.rk-help-fab-label,
.rk-help-fab {
    display: none !important;
}

.rk-help-tip {
    position: fixed;
    right: 1.25rem;
    bottom: 5.5rem;
    z-index: 1060;
    width: min(17.5rem, calc(100vw - 2.5rem));
    padding: 0.85rem 1rem 0.9rem;
    background: #fff;
    color: #374151;
    border-radius: 0.85rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    animation: rk-help-tip-in 0.28s ease;
}

.rk-help-tip::after {
    content: "";
    position: absolute;
    right: 1.15rem;
    bottom: -0.45rem;
    width: 0.85rem;
    height: 0.85rem;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 3px 3px 6px rgba(15, 23, 42, 0.08);
}

.rk-help-tip__close {
    position: absolute;
    top: 0.35rem;
    right: 0.4rem;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 0.35rem;
}

.rk-help-tip__close:hover,
.rk-help-tip__close:focus-visible {
    color: #4b5563;
    background: #f3f4f6;
}

.rk-help-tip__text {
    margin: 0 1.25rem 0.65rem 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #4b5563;
}

.rk-help-tip__cta {
    border: none;
    background: transparent;
    color: var(--cpms-primary, #0088a8);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.rk-help-tip__cta:hover,
.rk-help-tip__cta:focus-visible {
    text-decoration: underline;
}

@keyframes rk-help-tip-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rk-help-panel {
    position: fixed;
    bottom: 5.5rem;
    right: 1.25rem;
    z-index: 1060;
    width: min(26rem, calc(100vw - 2rem));
    max-height: min(75vh, 36rem);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    animation: rk-help-slide-in 0.2s ease;
}

@keyframes rk-help-slide-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rk-help-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.rk-help-panel__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.rk-help-panel__title-icon {
    display: inline-flex;
    color: var(--cpms-primary, #0088a8);
}

.rk-help-panel__badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rk-help-panel__body {
    flex: 1;
    min-height: 0;
    padding: 0.75rem 1rem;
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.55;
}

.rk-help-panel__body h2 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 1rem 0 0.4rem;
}

.rk-help-panel__body h2:first-child {
    margin-top: 0;
}

.rk-help-panel__body ul,
.rk-help-panel__body ol {
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.rk-help-panel__body p {
    margin-bottom: 0.5rem;
}

.rk-help-panel__loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 0.875rem;
}

.rk-help-panel__error {
    color: #b02a37;
    font-size: 0.875rem;
}

.rk-help-panel__refresh {
    margin-top: 0.75rem;
}

.rk-help-welcome {
    padding: 0.35rem 0.15rem 0.5rem;
}

.rk-help-welcome__lead {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
}

.rk-help-welcome__sub {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.45;
}

.rk-help-welcome__sub kbd {
    display: inline-block;
    padding: 0.05rem 0.28rem;
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    background: #f8f9fa;
    font-size: 0.72rem;
    color: #495057;
}

.rk-help-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.rk-help-suggestion {
    text-align: left;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #212529;
    border-radius: 0.5rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
    line-height: 1.35;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.rk-help-suggestion:hover:not(:disabled),
.rk-help-suggestion:focus-visible {
    border-color: var(--cpms-primary, var(--bs-primary, #0d6efd));
    background: #f8fafc;
}

.rk-help-suggestion:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rk-help-panel__footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.rk-help-ask-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.rk-help-ask-input {
    flex: 1;
    min-width: 0;
}

.rk-help-ask-btn {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rk-help-panel__actions {
    margin-top: 0.35rem;
    text-align: right;
}

.rk-help-msg {
    margin-bottom: 0.75rem;
}

.rk-help-msg__label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    margin-bottom: 0.2rem;
}

.rk-help-msg__bubble {
    padding: 0.55rem 0.75rem;
    border-radius: 0.65rem;
    line-height: 1.5;
}

.rk-help-msg--user .rk-help-msg__bubble {
    background: var(--cpms-primary, var(--bs-primary, #0d6efd));
    color: #fff;
    margin-left: 1.5rem;
}

.rk-help-msg--assistant .rk-help-msg__bubble {
    background: #f1f3f5;
    color: #212529;
    margin-right: 0.5rem;
}

.rk-help-msg--assistant .rk-help-msg__bubble h2 {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0.75rem 0 0.35rem;
}

.rk-help-msg--assistant .rk-help-msg__bubble h2:first-child {
    margin-top: 0;
}

.rk-help-msg--assistant .rk-help-msg__bubble ul,
.rk-help-msg--assistant .rk-help-msg__bubble ol {
    padding-left: 1.15rem;
    margin-bottom: 0.35rem;
}

.rk-help-msg--assistant .rk-help-msg__bubble p {
    margin-bottom: 0.35rem;
}

.rk-help-msg--assistant .rk-help-msg__bubble p:last-child {
    margin-bottom: 0;
}

@media (max-width: 576px) {
    .rk-float-dock {
        bottom: 1rem;
        right: 1rem;
    }

    .rk-float-dock__btn {
        min-width: 3.1rem;
        height: 3.1rem;
        padding: 0.3rem 0.55rem;
    }

    .rk-help-tip {
        right: 1rem;
        bottom: 5rem;
    }

    .rk-help-panel {
        right: 1rem;
        bottom: 5rem;
        width: calc(100vw - 2rem);
    }
}
