.chatbot-badge {
    background: #e74c3c;
    color: #fff;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.9em;
    margin-left: 6px;
    vertical-align: middle;
    display: none;
}

.chatbot-popup {
    display: none;
    position: fixed !important;
    width: min(500px, 42vw);
    max-width: 500px;
    height: clamp(500px, calc(600px - 20vh), 520px);
    bottom: 90px;
    right: 30px;
    border: 3px solid #af0ccf;
    background-color: #00ff95;
    z-index: 2147483647 !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    isolation: isolate;
    transform: translateZ(0);
    flex-direction: column;
}

.chatbot-popup.is-minimized {
    height: auto !important;
    min-height: 0;
}

.chatbot-popup.is-minimized #chatbot-form,
.chatbot-popup.is-minimized #chatbot-status,
.chatbot-popup.is-minimized #chatbot-messages,
.chatbot-popup.is-minimized #chatbot-poll-composer {
    display: none !important;
}

@media (max-height: 760px) and (min-width: 701px) and (hover: hover) and (pointer: fine) {
    .chatbot-popup {
        width: min(620px, 72vw);
        max-width: 72vw;
    }
}

.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-height: 34px;
    padding: 5px 8px;
    background: linear-gradient(180deg, rgba(176, 236, 204, 0.76) 0%, rgba(112, 214, 162, 0.62) 100%);
    border-bottom: 1px solid rgba(42, 128, 85, 0.28);
    backdrop-filter: blur(14px) saturate(1.15);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    order: 1;
    flex: 0 0 auto;
    margin-left: auto;
}

.chatbot-header-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(82, 222, 115, 0.62) 0%, rgba(26, 160, 63, 0.42) 100%);
    color: rgba(10, 58, 24, 0.72);
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48), inset 0 -1px 0 rgba(0, 0, 0, 0.05), 0 2px 6px rgba(15, 23, 42, 0.08);
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.chatbot-header-button:hover {
    filter: saturate(1.08) brightness(1.02);
    border-color: rgba(255, 255, 255, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56), inset 0 -1px 0 rgba(0, 0, 0, 0.06), 0 3px 8px rgba(15, 23, 42, 0.1);
}

.chatbot-header-button-minimize {
    background: linear-gradient(180deg, rgba(255, 214, 102, 0.68) 0%, rgba(235, 179, 37, 0.44) 100%);
    color: rgba(116, 74, 5, 0.82);
}

.chatbot-header-button:focus {
    outline: 2px solid rgba(37, 99, 235, 0.45);
    outline-offset: 2px;
}

.chatbot-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    order: 2;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255, 119, 112, 0.68) 0%, rgba(232, 60, 52, 0.46) 100%);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48), inset 0 -1px 0 rgba(0, 0, 0, 0.05), 0 2px 6px rgba(15, 23, 42, 0.08);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    color: rgba(120, 12, 12, 0.8);
    font-weight: 700;
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.chatbot-close:hover {
    filter: saturate(1.08) brightness(1.02);
    border-color: rgba(255, 255, 255, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56), inset 0 -1px 0 rgba(0, 0, 0, 0.06), 0 3px 8px rgba(15, 23, 42, 0.1);
}

.chatbot-close:active {
    transform: scale(0.96);
}

.chatbot-close:focus {
    outline: 2px solid rgba(37, 99, 235, 0.45);
    outline-offset: 2px;
}

.chatbot-hint {
    display: none;
    color: #af0ccf;
    font-size: 0.95em;
    margin-left: 12px;
    position: absolute;
    top: 40px;
    left: 240px;
    background: #fffbe7;
    padding: 4px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px #af0ccf33;
    z-index: 1002;
}

.chatbot-messages {
    max-height: none;
    overflow-y: auto;
    background: #fffbe7;
    border-radius: 6px;
    margin-bottom: 0;
    padding: 8px 8px 0 8px;
    font-size: 0.98em;
    box-shadow: 0 2px 8px #af0ccf33;
    flex: 1 1 auto;
    min-height: 0;
}

.chatbot-poll-composer {
    display: none;
    position: absolute;
    top: 30px;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 2;
}

.chatbot-poll-composer.is-open {
    display: block;
}

.chatbot-poll-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fffbe7;
    border: 1px solid #00cc77;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.chatbot-status {
    margin: 8px 8px 0 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.84em;
}

.chatbot-status.is-success {
    background: #e7f9ef;
    color: #19663a;
    border: 1px solid #b9e5c8;
}

.chatbot-status.is-error {
    background: #fff1f1;
    color: #9b1c1c;
    border: 1px solid #f1c4c4;
}

.chatbot-poll-card-header {
    margin-bottom: 10px;
    color: #14532d;
}

.chatbot-poll-form {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
}

.chatbot-poll-options-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.chatbot-poll-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    background: #f3fff8;
    color: #14532d;
}

.chatbot-poll-toggle-hint {
    margin-top: -2px;
    padding: 0 10px;
    font-size: 0.82em;
    color: #4c6b59;
}

.chatbot-poll-toggle-switch {
    position: relative;
    display: inline-flex;
}

.chatbot-poll-toggle-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chatbot-poll-toggle-slider {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #c7d8cd;
    transition: background 0.2s ease;
}

.chatbot-poll-toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.chatbot-poll-toggle-switch input:checked+.chatbot-poll-toggle-slider {
    background: #25d366;
}

.chatbot-poll-toggle-switch input:checked+.chatbot-poll-toggle-slider::after {
    transform: translateX(20px);
}

.chatbot-poll-option-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: end;
}

.chatbot-emoji-button {
    border: none;
    border-radius: 999px;
    background: #fffbe7;
    color: #14532d;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
    font-size: 19px;
    flex: 0 0 auto;
}

.chatbot-emoji-button:hover {
    background: #ffffff;
}

.chatbot-emoji-picker {
    display: none;
    position: absolute;
    z-index: 6;
    width: min(240px, calc(100% - 16px));
    padding: 10px;
    border-radius: 16px;
    background: #fffbe7;
    border: 1px solid #cdebd7;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.chatbot-emoji-picker.is-open {
    display: grid;
}

.chatbot-emoji-option {
    border: none;
    background: #ffffff;
    border-radius: 12px;
    min-height: 40px;
    font-size: 22px;
    cursor: pointer;
}

.chatbot-emoji-option:hover {
    background: #dffbea;
}

.chatbot-poll-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #1f1f1f;
    font-size: 0.9em;
}

.chatbot-poll-field input {
    border: 1px solid #b9d7c3;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: #ffffff;
}

.chatbot-poll-field input:focus {
    outline: 2px solid #25d366;
    outline-offset: 1px;
}

.chatbot-poll-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 10px;
    background: #fffbe7;
    border-top: 1px solid #d8eadf;
}

.chatbot-poll-secondary {
    border: none;
    background: transparent;
    color: #14532d;
    font: inherit;
    cursor: pointer;
    padding: 6px 0;
}

.chatbot-poll-add-option,
.chatbot-poll-option-remove {
    border: none;
    border-radius: 999px;
    background: #dffbea;
    color: #14532d;
    font: inherit;
    cursor: pointer;
}

.chatbot-poll-add-option {
    align-self: flex-start;
    padding: 8px 12px;
}

.chatbot-poll-add-option:disabled {
    opacity: 0.55;
    cursor: default;
}

.chatbot-poll-option-remove {
    width: 38px;
    height: 38px;
    font-size: 22px;
    line-height: 1;
}

.chatbot-poll-submit {
    margin-left: auto;
}

.chatbot-message {
    background: #00ff95;
    border-radius: 6px;
    margin-bottom: 6px;
    padding: 6px 10px;
    box-shadow: 0 1px 4px #af0ccf22;
    word-break: break-word;
}

.chatbot-message:last-child {
    margin-bottom: 0;
}

.chatbot-message-poll {
    background: #dffbea;
    border: 1px solid #72d59a;
}

.chatbot-message-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.85em;
    color: #1f1f1f;
}

.chatbot-message-time {
    margin-left: auto;
    font-size: 0.8em;
    color: #3a3a3a;
}

.chatbot-message-text {
    margin-top: 2px;
}

.chatbot-message-text-poll {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.chatbot-poll-label {
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0d7a46;
}

.chatbot-poll-label.is-closed {
    color: #8b5e00;
}

.chatbot-poll-question {
    font-weight: 700;
    color: #123524;
}

.chatbot-poll-mode {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3fff8;
    border: 1px solid #cdebd7;
    font-size: 0.82em;
    color: #276749;
}

.chatbot-poll-mode.is-single {
    background: #eef8ff;
    border-color: #bfdcf6;
    color: #1d5f8f;
}

.chatbot-poll-mode.is-multi {
    background: #f3fff8;
    border-color: #cdebd7;
    color: #276749;
}

.chatbot-poll-mode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #dffbea;
    color: #14532d;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.chatbot-poll-mode-icon.is-single {
    background: #d8ecfb;
    color: #1d5f8f;
}

.chatbot-poll-mode-icon.is-multi {
    background: #dffbea;
    color: #14532d;
}

.chatbot-poll-mode-text {
    white-space: nowrap;
}

.chatbot-poll-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chatbot-poll-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chatbot-poll-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #cdebd7;
    border-radius: 999px;
    background: #ffffff;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-align: left;
}

.chatbot-poll-option:disabled {
    cursor: default;
    opacity: 0.92;
}

.chatbot-poll-option::after {
    content: '';
    position: absolute;
    inset: 0;
    width: var(--poll-fill, 0%);
    background: rgba(37, 211, 102, 0.14);
    z-index: 0;
}

.chatbot-poll-option>* {
    position: relative;
    z-index: 1;
}

.chatbot-poll-option::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #25d366;
    border-radius: 50%;
    flex: 0 0 auto;
}

.chatbot-poll-option.is-selected {
    border-color: #25d366;
}

.chatbot-poll-option.is-selected::before {
    background: #25d366;
}

.chatbot-poll-option-text {
    flex: 1 1 auto;
}

.chatbot-poll-option-stats {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.82em;
    color: #276749;
}

.chatbot-poll-total {
    font-size: 0.82em;
    color: #276749;
    white-space: nowrap;
    margin-left: auto;
}

.chatbot-poll-footer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chatbot-poll-voters-toggle {
    border: none;
    background: transparent;
    color: #1d5f8f;
    padding: 0;
    font: inherit;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-left: auto;
    white-space: nowrap;
}

.chatbot-poll-voters-modal {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 3;
    padding: 12px;
    background: rgba(10, 27, 18, 0.34);
    align-items: center;
    justify-content: center;
}

.chatbot-poll-voters-modal.is-open {
    display: flex;
}

.chatbot-poll-voters-window {
    display: flex;
    flex-direction: column;
    width: min(100%, 380px);
    max-height: 100%;
    background: #fffbe7;
    border: 1px solid #00cc77;
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
    overflow: hidden;
}

.chatbot-poll-voters-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #d8ecfb;
    color: #123524;
}

.chatbot-poll-voters-close {
    border: none;
    background: transparent;
    color: #1d5f8f;
    font: inherit;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.chatbot-poll-voters-window-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px 14px;
    overflow-y: auto;
}

.chatbot-poll-voters-summary {
    font-size: 0.8em;
    font-weight: 600;
    color: #1d5f8f;
}

.chatbot-poll-voters-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chatbot-poll-voters-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-poll-voters-option {
    font-size: 0.84em;
    font-weight: 700;
    color: #123524;
}

.chatbot-poll-voters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chatbot-poll-voter-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #cfe3f2;
    font-size: 0.8em;
    color: #25465f;
}

.chatbot-poll-voter-chip.is-self {
    background: #eaf7ef;
    border-color: #cdebd7;
    color: #276749;
    font-weight: 600;
}

.chatbot-poll-close-btn {
    border: none;
    border-radius: 999px;
    background: #fff2cc;
    color: #6b4f00;
    padding: 7px 12px;
    font: inherit;
    cursor: pointer;
}

.chatbot-poll-closed-note {
    font-size: 0.82em;
    color: #8b5e00;
    white-space: nowrap;
}

.chatbot-unread-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 8px 0;
    font-size: 0.72em;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chatbot-unread-divider::before,
.chatbot-unread-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid #bfbfbf;
}

.chatbot-unread-divider::before {
    margin-right: 8px;
}

.chatbot-unread-divider::after {
    margin-left: 8px;
}

.whatsapp-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #25d366;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px #25d36633;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 0;
    padding: 0;
    flex: 0 0 auto;
}

.whatsapp-send-btn:hover {
    background: #128c7e;
}

.whatsapp-send-btn img {
    height: 22px;
    width: 22px;
    filter: drop-shadow(0 1px 1px #128c7e33);
}

.form-container {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-width: none;
    padding: 10px 8px 8px;
    margin-bottom: 8px;
    background-color: rgba(86, 226, 43, 0.911);
    box-sizing: border-box;
    flex: 0 0 auto;
}

.chatbot-input-shell {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

#chatbot-input {
    width: 100%;
    height: 40px;
    padding: 0 10px 0 44px;
    border: none;
    border-radius: 999px;
    background: #ffffff;
    font: inherit;
    box-sizing: border-box;
}

.chatbot-input-shell.has-text #chatbot-input {
    padding: 0 10px;
}

#chatbot-input:focus {
    outline: 2px solid rgba(37, 211, 102, 0.35);
    outline-offset: 1px;
}

.chatbot-input-poll-button {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #0d7a46;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.chatbot-input-shell.has-text .chatbot-input-poll-button {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.9);
}

.chatbot-input-emoji {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
}

.chatbot-input-poll-button:hover {
    background: rgba(13, 122, 70, 0.06);
}

.chatbot-input-poll-button:focus {
    outline: 2px solid rgba(37, 99, 235, 0.45);
    outline-offset: 2px;
}

.form-container textarea {
    width: 88%;
    padding: 15px;
    margin: 5px 0 22px 0;
    border: none;
    background: white;
    resize: none;
    min-height: 300px;
    min-width: 200px;
}

.form-container textarea:focus {
    background-color: white;
    outline: none;
}