/* Todos los estilos se limitan al widget para evitar afectar al tema. */
#wepn-chatbot, #wepn-chatbot * { box-sizing: border-box; }
#wepn-chatbot[hidden] { display: none !important; }
#wepn-chatbot {
    --wepn-primary: #234bd1;
    --wepn-text: #182438;
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 999999;
    color: var(--wepn-text);
    font: 400 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: left;
    letter-spacing: normal;
}
#wepn-chatbot button, #wepn-chatbot input {
    font: inherit; letter-spacing: normal; margin: 0; text-transform: none;
}
#wepn-chatbot button {
    appearance: none; cursor: pointer; border: 0; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background-color .18s ease, transform .18s ease;
}
#wepn-chatbot button:focus-visible, #wepn-chatbot input:focus-visible,
#wepn-chatbot .wepn-messages:focus-visible {
    outline: 3px solid #7595ff; outline-offset: 3px;
}
#wepn-chatbot .wepn-toggle {
    width: 60px; height: 60px; padding: 0; border-radius: 50%;
    background: var(--wepn-primary); color: #fff;
    box-shadow: 0 6px 24px rgb(24 36 56 / 20%);
}
#wepn-chatbot .wepn-toggle:hover { background: #1939ac; transform: translateY(-2px); }
#wepn-chatbot .wepn-panel {
    position: absolute; right: 0; bottom: 76px; width: 370px;
    height: 480px; max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px);
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border: 1px solid #e1e6ee; border-radius: 20px;
    box-shadow: 0 12px 40px rgb(24 36 56 / 16%);
    opacity: 0; visibility: hidden; transform: translateY(12px) scale(.98);
    transform-origin: bottom right;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
#wepn-chatbot.wepn-is-open .wepn-panel { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
#wepn-chatbot .wepn-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0; padding: 16px 18px; background: #f7f9ff; border-bottom: 1px solid #e1e6ee;
}
#wepn-chatbot .wepn-header h2 { margin: 0; padding: 0; color: var(--wepn-text); font: 650 17px/1.4 system-ui, sans-serif; }
#wepn-chatbot .wepn-header p { margin: 3px 0 0; padding: 0; color: #526079; font-size: 12px; }
#wepn-chatbot .wepn-close { width: 44px; padding: 0; border-radius: 12px; background: transparent; color: #526079; font-size: 28px; line-height: 1; }
#wepn-chatbot .wepn-close:hover { background: #e6ecfc; }
#wepn-chatbot .wepn-messages {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px 16px;
}
#wepn-chatbot .wepn-message {
    flex-shrink: 0; max-width: 88%; margin: 0; padding: 11px 14px;
    border-radius: 15px; white-space: pre-wrap; overflow-wrap: anywhere;
    font: inherit; text-align: left;
}
#wepn-chatbot .wepn-message--bot { background: #f0f3f8; color: var(--wepn-text); border-bottom-left-radius: 4px; }
#wepn-chatbot .wepn-message--user { align-self: flex-end; background: var(--wepn-primary); color: #fff; border-bottom-right-radius: 4px; }
#wepn-chatbot .wepn-form { display: flex; flex-shrink: 0; gap: 8px; padding: 12px 14px 6px; margin: 0; border-top: 1px solid #e1e6ee; background: #fff; }
#wepn-chatbot .wepn-input {
    appearance: none; flex: 1; min-width: 0; width: auto; height: 44px;
    padding: 10px 12px; border: 1px solid #cbd3df; border-radius: 10px;
    background: #fff; color: var(--wepn-text); box-shadow: none; font-size: 16px;
}
#wepn-chatbot .wepn-input::placeholder { color: #67758a; opacity: 1; }
#wepn-chatbot .wepn-send { padding: 10px 14px; border-radius: 10px; background: var(--wepn-primary); color: #fff; }
#wepn-chatbot .wepn-send:hover { background: #1939ac; }
#wepn-chatbot .wepn-send:disabled { opacity: .6; cursor: wait; }
#wepn-chatbot .wepn-note { flex-shrink: 0; margin: 0; padding: 4px 12px 10px; font-size: 11px; text-align: center; color: #67758a; }
#wepn-chatbot .wepn-sr-only { 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: 480px) {
    #wepn-chatbot { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
    #wepn-chatbot .wepn-panel { width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)); height: 470px; max-height: calc(100vh - 108px); max-height: calc(100dvh - 108px); bottom: 72px; border-radius: 16px; }
    #wepn-chatbot .wepn-toggle { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
    #wepn-chatbot button, #wepn-chatbot .wepn-panel { transition: none; }
}

.wepn-message a { color: inherit; text-decoration: underline; overflow-wrap: anywhere; }
