.rrc-chat-widget {
    --rrc-chat-navy: #1b365d;
    --rrc-chat-navy-hover: #244a78;
    --rrc-chat-orange: #fdb813;
    --rrc-chat-bottom: 174px;
    --rrc-chat-right: 30px;
    font-family: inherit;
}

.rrc-chat-widget,
.rrc-chat-widget * {
    box-sizing: border-box;
}

/* ---------- Collapsed: branded "Ask RRC AI" pill ---------- */
.rrc-chat-launcher {
    position: fixed;
    right: var(--rrc-chat-right);
    bottom: var(--rrc-chat-bottom);
    z-index: 1060;
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 8px 8px;
    border: 1px solid rgba(253, 184, 19, 0.38);
    border-radius: 999px;
    background: var(--rrc-chat-navy);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(18, 33, 53, 0.32);
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
    animation: rrc-chat-arrive 700ms ease-out 400ms both;
}

.rrc-chat-launcher:hover {
    background: var(--rrc-chat-navy-hover);
    border-color: var(--rrc-chat-orange);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(18, 33, 53, 0.36);
}

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

.rrc-chat-launcher-icon {
    position: relative;
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--rrc-chat-orange);
    color: var(--rrc-chat-navy);
}

.rrc-chat-launcher-icon::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 10px;
    height: 10px;
    border: 2px solid var(--rrc-chat-navy);
    border-radius: 50%;
    background: #22c55e;
}

.rrc-chat-launcher-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: none;
}

.rrc-chat-launcher-text {
    padding-right: 2px;
    color: #fff;
}

@keyframes rrc-chat-arrive {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rrc-chat-panel {
    position: fixed;
    right: var(--rrc-chat-right);
    bottom: calc(var(--rrc-chat-bottom) + 64px);
    z-index: 1060;
    display: flex;
    width: min(390px, calc(100vw - 32px));
    height: min(560px, calc(100dvh - 280px));
    min-height: min(340px, calc(100dvh - 280px));
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(27, 54, 93, 0.12);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 14px 45px rgba(18, 33, 53, 0.24);
}

.rrc-chat-panel[hidden],
.rrc-chat-quick-actions[hidden],
.rrc-chat-typing[hidden] {
    display: none !important;
}

.rrc-chat-header {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 2px solid var(--rrc-chat-orange);
    background: var(--rrc-chat-navy);
    color: #fff;
}

.rrc-chat-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.rrc-chat-avatar {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--rrc-chat-orange);
    color: var(--rrc-chat-navy);
}

.rrc-chat-avatar svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    stroke: none;
}

.rrc-chat-heading-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.rrc-chat-title {
    font-size: 1rem;
    line-height: 1.3;
}

.rrc-chat-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.82rem;
}

.rrc-chat-close {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.rrc-chat-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.rrc-chat-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
}

.rrc-chat-messages {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 16px;
    background: #f7f9fc;
    overscroll-behavior: contain;
}

.rrc-chat-message {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.rrc-chat-message-assistant {
    align-self: flex-start;
    border: 1px solid #e4e9f0;
    border-bottom-left-radius: 5px;
    background: #fff;
    color: #27364a;
}

.rrc-chat-message-user {
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    background: var(--rrc-chat-navy);
    color: #fff;
}

.rrc-chat-typing {
    align-self: flex-start;
    color: #5f6f82;
    font-size: 0.82rem;
}

.rrc-chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 14px 12px;
    background: #f7f9fc;
}

.rrc-chat-quick-action {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: var(--rrc-chat-navy);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}

.rrc-chat-quick-action:hover {
    border-color: var(--rrc-chat-orange);
    background: #fffaf0;
}

.rrc-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e7ebf0;
    background: #fff;
}

.rrc-chat-input {
    width: 0;
    min-width: 0;
    min-height: 44px;
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: #243247;
    font: inherit;
    font-size: 16px;
}

.rrc-chat-input:focus {
    border-color: var(--rrc-chat-navy);
    outline: 2px solid rgba(27, 54, 93, 0.18);
    outline-offset: 1px;
}

.rrc-chat-send {
    min-width: 64px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: var(--rrc-chat-orange);
    color: #202a36;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.rrc-chat-send:hover {
    background: #f2a900;
}

.rrc-chat-widget button:focus-visible {
    outline: 3px solid #f28c00;
    outline-offset: 3px;
}

@media (max-width: 576px) {
    .rrc-chat-widget {
        --rrc-chat-bottom: 20px;
        --rrc-chat-right: 88px;
    }

    .rrc-chat-launcher {
        min-height: 56px;
        justify-content: center;
        gap: 0;
        padding: 6px;
    }

    .rrc-chat-launcher-text {
        display: none;
    }

    .rrc-chat-launcher-icon {
        width: 42px;
        height: 42px;
    }

    .rrc-chat-panel {
        right: 12px;
        bottom: 88px;
        width: calc(100vw - 24px);
        height: min(520px, calc(100dvh - 112px));
        min-height: min(300px, calc(100dvh - 112px));
        border-radius: 16px;
    }

    .rrc-chat-messages {
        padding: 13px;
    }
}

@media (max-width: 360px) {
    .rrc-chat-header {
        padding: 12px;
    }

    .rrc-chat-form {
        gap: 6px;
        padding: 9px;
    }

    .rrc-chat-send {
        min-width: 58px;
        padding: 0 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rrc-chat-launcher {
        animation: none;
        transition: none;
    }
}
