.mdtf-assistant {
    position: fixed;
    right: 20px;
    bottom: 88px;
    z-index: 1105;
    font-family: inherit;
}

.mdtf-assistant__launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 12px 14px;
    border: 0;
    border-radius: 999px;
    background: var(--primary, #004a80);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 74, 128, 0.28);
    transition: transform 0.18s ease, background 0.18s ease;
}

.mdtf-assistant__launcher:hover {
    background: var(--primary-dark, #003660);
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(0, 74, 128, 0.34);
}

.mdtf-assistant__launcher-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.mdtf-assistant.is-open .mdtf-assistant__launcher {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.mdtf-assistant__panel {
    width: min(380px, calc(100vw - 28px));
    height: min(560px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(0, 74, 128, 0.12);
    border-radius: 18px;
    box-shadow: 0 20px 48px rgba(15, 35, 55, 0.22);
    overflow: hidden;
}

.mdtf-assistant__panel[hidden] {
    display: none !important;
}

.mdtf-assistant__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary, #004a80), var(--primary-light, #1a6aad));
    color: #fff;
}

.mdtf-assistant__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.mdtf-assistant__subtitle {
    margin: 4px 0 0;
    font-size: 0.78rem;
    opacity: 0.9;
}

.mdtf-assistant__close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.mdtf-assistant__messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f6f8fb;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mdtf-assistant__bubble {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.45;
}

.mdtf-assistant__bubble p {
    margin: 0;
}

.mdtf-assistant__bubble--assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid rgba(0, 74, 128, 0.1);
    color: #1a2b3c;
}

.mdtf-assistant__bubble--user {
    align-self: flex-end;
    background: var(--primary, #004a80);
    color: #fff;
}

.mdtf-assistant__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px 0;
    background: #fff;
}

.mdtf-assistant__chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(0, 74, 128, 0.2);
    background: #fff;
    color: var(--primary, #004a80);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.mdtf-assistant__chip--wa {
    border-color: #25d366;
    color: #128c45;
}

.mdtf-assistant__composer {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 12px;
    background: #fff;
    border-top: 1px solid rgba(0, 74, 128, 0.08);
}

.mdtf-assistant__composer textarea {
    flex: 1;
    resize: none;
    min-height: 42px;
    max-height: 110px;
    border: 1px solid rgba(0, 74, 128, 0.18);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    font-size: 0.92rem;
}

.mdtf-assistant__send {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: var(--accent, #f1a139);
    color: #1a2b3c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mdtf-assistant__send svg {
    width: 18px;
    height: 18px;
}

.mdtf-assistant__error {
    margin: 0;
    padding: 0 12px 10px;
    color: #b42318;
    font-size: 0.82rem;
    background: #fff;
}

.mdtf-assistant__escalate {
    padding: 10px 12px;
    background: #fff8ef;
    border-top: 1px solid rgba(241, 161, 57, 0.35);
}

.mdtf-assistant__escalate[hidden] {
    display: none !important;
}

.mdtf-assistant__escalate-title {
    margin: 0 0 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #1a2b3c;
}

.mdtf-assistant__escalate-form {
    display: grid;
    gap: 8px;
}

.mdtf-assistant__escalate-form label {
    display: grid;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #415468;
}

.mdtf-assistant__escalate-form input,
.mdtf-assistant__escalate-form textarea {
    border: 1px solid rgba(0, 74, 128, 0.18);
    border-radius: 10px;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 400;
}

.mdtf-assistant__escalate-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mdtf-assistant__btn {
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.mdtf-assistant__btn--primary {
    background: var(--primary, #004a80);
    color: #fff;
}

.mdtf-assistant__btn--ghost {
    background: transparent;
    color: #415468;
    border: 1px solid rgba(0, 74, 128, 0.2);
}

.mdtf-assistant .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .mdtf-assistant {
        right: 14px;
        bottom: 78px;
    }

    .mdtf-assistant__launcher {
        padding: 14px;
    }

    .mdtf-assistant__launcher-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .mdtf-assistant__panel {
        width: calc(100vw - 28px);
        height: min(70vh, 560px);
    }
}
