.tsp-chatbot-widget {
    position: fixed;
    right: 20px;
    /* The site's .back-to-top button (bottom:2rem, 50px tall) and the Google
       reCAPTCHA v3 badge (bottom:14px, ~60px tall) both live in this corner -
       sit above both with some breathing room. */
    bottom: 150px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tsp-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0f3460;
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}
.tsp-chatbot-toggle:hover {
    transform: scale(1.06);
}

.tsp-chatbot-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 460px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tsp-chatbot-header {
    background: #0f3460;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 15px;
}
.tsp-chatbot-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.85;
}
.tsp-chatbot-header button:hover {
    opacity: 1;
}

.tsp-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f8fa;
}

.tsp-chatbot-msg {
    max-width: 82%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.tsp-chatbot-msg-bot {
    align-self: flex-start;
    background: #eef1f5;
    color: #222;
    border-bottom-left-radius: 3px;
}
.tsp-chatbot-msg-user {
    align-self: flex-end;
    background: #0f3460;
    color: #fff;
    border-bottom-right-radius: 3px;
}
.tsp-chatbot-msg-error {
    align-self: flex-start;
    background: #fdecea;
    color: #a12622;
    border-bottom-left-radius: 3px;
}
.tsp-chatbot-msg-typing {
    align-self: flex-start;
    background: #eef1f5;
    color: #777;
    font-style: italic;
}

.tsp-chatbot-input-row {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e6e6e6;
    background: #fff;
}
.tsp-chatbot-input-row input {
    flex: 1;
    border: 1px solid #d5d8dc;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 13.5px;
    outline: none;
}
.tsp-chatbot-input-row input:focus {
    border-color: #0f3460;
}
.tsp-chatbot-input-row button {
    background: #0f3460;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 15px;
}
.tsp-chatbot-input-row button:disabled {
    opacity: 0.5;
    cursor: default;
}

.tsp-chatbot-escalate-link {
    background: none;
    border: none;
    border-top: 1px solid #e6e6e6;
    color: #0f3460;
    font-size: 12.5px;
    padding: 8px;
    cursor: pointer;
    text-decoration: underline;
}
.tsp-chatbot-escalate-link:hover {
    color: #1a4d8f;
}

.tsp-chatbot-escalate-form {
    padding: 12px 14px;
    border-top: 1px solid #e6e6e6;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fff;
}
.tsp-chatbot-escalate-form input {
    border: 1px solid #d5d8dc;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}
.tsp-chatbot-primary-btn {
    background: #0f3460;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px;
    font-size: 13.5px;
    cursor: pointer;
}
.tsp-chatbot-primary-btn:disabled {
    opacity: 0.6;
    cursor: default;
}
.tsp-chatbot-link-btn {
    background: none;
    border: none;
    color: #777;
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .tsp-chatbot-panel {
        width: calc(100vw - 24px);
        right: -8px;
        height: calc(100vh - 140px);
    }
}

/* .tsp-chatbot-toggle/.tsp-chatbot-panel/.tsp-chatbot-escalate-form all set
   their own `display`, which at equal CSS specificity overrides the
   browser's default `[hidden] { display: none }` rule. Restore it
   explicitly (higher specificity via the attribute selector) so the
   `hidden` property/attribute actually hides these elements. */
.tsp-chatbot-toggle[hidden],
.tsp-chatbot-panel[hidden],
.tsp-chatbot-escalate-form[hidden] {
    display: none;
}
