.xa-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1200;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}

.xa-panel {
    position: fixed;
    right: 22px;
    bottom: 78px;
    width: min(390px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 120px));
    z-index: 1200;
    display: none;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
    overflow: hidden;
}

.xa-panel.is-open {
    display: flex;
}

.xa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.xa-header-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.xa-header-copy strong {
    font-size: 1rem;
}

.xa-header-copy span {
    font-size: .82rem;
    opacity: .7;
}

.xa-close {
    border: 0;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.xa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f8fa;
}

.xa-message {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.xa-message.assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
}

.xa-message.user {
    align-self: flex-end;
    background: #e7f0ff;
}

.xa-message.pending {
    opacity: .65;
    font-style: italic;
}

.xa-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(0, 0, 0, .08);
    background: #fff;
}

.xa-input {
    flex: 1;
    min-width: 0;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
}

.xa-send {
    border: 0;
    border-radius: 12px;
    padding: 0 16px;
    font-weight: 700;
    cursor: pointer;
}

.xa-send:disabled,
.xa-input:disabled {
    opacity: .6;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .xa-panel {
        right: 12px;
        bottom: 72px;
        width: calc(100vw - 24px);
        height: min(620px, calc(100vh - 96px));
    }

    .xa-launcher {
        right: 12px;
        bottom: 12px;
    }
}

/* Preguntas sugeridas según la pantalla */
.xa-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 14px 12px;
    background: #fff;
}

.xa-suggestions[hidden] {
    display: none;
}

.xa-suggestion {
    appearance: none;
    border: 1px solid #dbe4f0;
    background: #f8fafc;
    color: #334155;
    border-radius: 999px;
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
    line-height: 1.25;
    cursor: pointer;
    transition:
        background .15s ease,
        border-color .15s ease,
        transform .15s ease;
}

.xa-suggestion:hover {
    background: #eef4ff;
    border-color: #b9cdf3;
    transform: translateY(-1px);
}

.xa-suggestion:active {
    transform: translateY(0);
}

@media (max-width: 640px) {
    .xa-suggestions {
        gap: 6px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .xa-suggestion {
        font-size: 11px;
    }
}

/* ===== Pulido visual IA XRAYEDU ===== */

.xa-launcher {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    letter-spacing: -0.01em;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

.xa-launcher-badge,
.xa-title-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.xa-launcher-badge {
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border-radius: 9px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.22);
    font-size: 11px;
}

.xa-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.xa-title-wrap > div {
    min-width: 0;
}

.xa-title-wrap strong {
    display: block;
    line-height: 1.2;
}

.xa-title-wrap small {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 400;
    opacity: .72;
    line-height: 1.25;
}

.xa-title-badge {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.22);
    font-size: 11px;
}

.xa-panel {
    box-shadow:
        0 24px 70px rgba(15, 23, 42, .20),
        0 4px 16px rgba(15, 23, 42, .10);
}

.xa-message.assistant {
    border: 1px solid #e7edf5;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}

.xa-suggestion {
    font-weight: 500;
}

.xa-privacy-note {
    padding: 0 14px 9px;
    font-size: 10.5px;
    line-height: 1.35;
    color: #64748b;
    background: #fff;
}

.xa-form textarea {
    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

.xa-form textarea:focus {
    outline: none;
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148,163,184,.14);
}

.xa-form button[type="submit"] {
    font-weight: 700;
    transition:
        transform .15s ease,
        box-shadow .15s ease,
        opacity .15s ease;
}

.xa-form button[type="submit"]:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15,23,42,.16);
}

.xa-form button[type="submit"]:active:not(:disabled) {
    transform: translateY(0);
}

@media (max-width: 640px) {
    .xa-title-wrap small {
        display: none;
    }

    .xa-privacy-note {
        font-size: 10px;
    }
}
