/* Estils limitats al giny: no alteren els colors ni els controls del web. */
.termes-bot-wrapper {
    --bot-gold: #ffc107;
    --bot-text: #f7f5ef;
    --bot-muted: #c2bdb4;
    position: fixed; bottom: max(24px, env(safe-area-inset-bottom)); right: max(24px, env(safe-area-inset-right));
    z-index: 99999; font-family: "Mulish", system-ui, sans-serif; color: var(--bot-text); line-height: 1.5;
}
.termes-bot-wrapper *, .termes-bot-wrapper *::before, .termes-bot-wrapper *::after { box-sizing: border-box; }
.termes-bot-wrapper [hidden] { display: none !important; }
.termes-bot-wrapper button, .termes-bot-wrapper input { font: inherit; }
.termes-bot-wrapper button { cursor: pointer; }
.termes-bot-wrapper button:focus-visible, .termes-bot-wrapper a:focus-visible, .termes-bot-wrapper input:focus-visible { outline: 3px solid var(--bot-gold); outline-offset: 3px; }
.termes-bot-wrapper .termes-bot-btn {
    display: flex; align-items: center; justify-content: center; width: 60px; height: 60px;
    border-radius: 50%; border: 0; color: #17130e; background: var(--bot-gold);
    box-shadow: 0 8px 24px #0004; transition: transform .2s;
}
.termes-bot-wrapper .termes-bot-btn:hover { transform: translateY(-3px); }
.termes-bot-wrapper .chat-fallback { padding: 12px 16px; border-radius: 24px; color: #17130e; background: var(--bot-gold); font-weight: 800; }
.termes-bot-wrapper .termes-bot-chat-window {
    position: absolute; bottom: 76px; right: 0; width: 410px; max-width: calc(100vw - 32px);
    height: 620px; max-height: calc(100vh - 120px); max-height: calc(var(--bot-visible-height, 100dvh) - 120px);
    display: flex; flex-direction: column; border: 1px solid #514631; border-radius: 20px;
    background: #171613; box-shadow: 0 18px 55px #0006; overflow: hidden; visibility: visible;
}
.termes-bot-wrapper .hidden-chat { visibility: hidden; pointer-events: none; }
.termes-bot-wrapper .chat-header {
    display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding: 12px;
    background: #292418; border-bottom: 1px solid #514631;
}
.termes-bot-wrapper .chat-avatar { font-size: 26px; width: 36px; flex-shrink: 0; }
.termes-bot-wrapper .chat-title-area { min-width: 0; }
.termes-bot-wrapper .chat-title-area h2 { color: var(--bot-text); margin: 0; font: 800 16px/1.4 "Mulish", system-ui, sans-serif; }
.termes-bot-wrapper .chat-title-area p { color: var(--bot-muted); font-size: 11px; margin: 2px 0 0; }
.termes-bot-wrapper .chat-header-actions { display: flex; align-items: center; margin-left: auto; gap: 2px; }
.termes-bot-wrapper .chat-icon-btn, .termes-bot-wrapper .chat-topics-btn {
    display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px;
    min-width: 36px; min-height: 40px; padding: 6px; background: transparent; color: var(--bot-text);
}
.termes-bot-wrapper .chat-topics-btn { font-size: 12px; color: var(--bot-gold); font-weight: 700; }
.termes-bot-wrapper .chat-header-actions button:hover { background: #ffffff12; }
.termes-bot-wrapper .chat-messages {
    position: relative; display: flex; flex-direction: column; gap: 16px; flex: 1 1 auto;
    min-height: 90px; overflow-y: auto; padding: 18px 14px; overscroll-behavior: contain; scrollbar-width: thin;
}
.termes-bot-wrapper .message { display: flex; flex-direction: column; gap: 6px; max-width: 94%; flex-shrink: 0; }
.termes-bot-wrapper .bot-message { align-self: flex-start; }
.termes-bot-wrapper .user-message { align-self: flex-end; max-width: 88%; }
.termes-bot-wrapper .message-content { padding: 12px 14px; border-radius: 16px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.termes-bot-wrapper .bot-message .message-content { background: #24221d; color: var(--bot-text); border: 1px solid #3b362d; border-bottom-left-radius: 4px; }
.termes-bot-wrapper .user-message .message-content { background: var(--bot-gold); color: #17130e; border-bottom-right-radius: 4px; }
.termes-bot-wrapper .message-content a, .termes-bot-wrapper .message-sources a, .termes-bot-wrapper .chat-legal-notice a { color: #ffdc73; text-decoration: underline; text-underline-offset: 3px; }
.termes-bot-wrapper .message-content a:hover, .termes-bot-wrapper .message-sources a:hover { color: #fff; }
.termes-bot-wrapper .message-content ul, .termes-bot-wrapper .message-content ol { padding-left: 20px; margin: 8px 0; }
.termes-bot-wrapper .message-sources { color: var(--bot-muted); font-size: 11px; padding: 0 4px; line-height: 1.6; }
.termes-bot-wrapper .quick-replies-container { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; flex-shrink: 0; max-height: 132px; overflow-y: auto; border-top: 1px solid #3b362d; }
.termes-bot-wrapper .quick-reply-btn { border: 1px solid #806423; border-radius: 18px; padding: 7px 11px; min-height: 34px; font-size: 12px; font-weight: 700; color: #ffdc73; background: #2a2417; text-align: left; white-space: normal; }
.termes-bot-wrapper .quick-reply-btn:hover { color: #17130e; background: var(--bot-gold); }
.termes-bot-wrapper .chat-footer-wrapper { background: #11110f; flex-shrink: 0; }
.termes-bot-wrapper .chat-input-area { display: flex; align-items: center; gap: 8px; padding: 12px 14px 4px; margin: 0; }
.termes-bot-wrapper .chat-input-area input { flex: 1; min-width: 0; width: 100%; padding: 10px 12px; border: 1px solid #6a6151; border-radius: 20px; color: #fff; background: #24221d; font-size: 16px; }
.termes-bot-wrapper .chat-input-area input::placeholder { color: #bfb8aa; opacity: 1; font-size: 13px; }
.termes-bot-wrapper .chat-input-area button { display: flex; align-items: center; justify-content: center; flex-shrink: 0; height: 44px; width: 44px; border: 0; border-radius: 50%; color: #17130e; background: var(--bot-gold); }
.termes-bot-wrapper .chat-legal-notice { color: var(--bot-muted); font-size: 11px; line-height: 1.5; margin: 8px 16px 12px; text-align: left; }
@media (max-width: 480px) {
    .termes-bot-wrapper { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
    .termes-bot-wrapper .termes-bot-chat-window { position: fixed; left: 8px; right: 8px; bottom: calc(var(--bot-keyboard-bottom, 0px) + max(8px, env(safe-area-inset-bottom))); width: auto; max-width: none; height: 650px; max-height: calc(100vh - 16px); max-height: calc(var(--bot-visible-height, 100dvh) - 16px); border-radius: 16px; }
    .termes-bot-wrapper .chat-header { padding: 10px 8px; gap: 6px; }
    .termes-bot-wrapper .chat-avatar { width: 28px; font-size: 22px; }
    .termes-bot-wrapper .chat-title-area h2 { font-size: 15px; }
    .termes-bot-wrapper .chat-icon-btn { min-width: 32px; }
    .termes-bot-wrapper .chat-messages { padding: 12px; }
}
@media (max-height: 500px) {
    .termes-bot-wrapper .termes-bot-chat-window { position: fixed; bottom: calc(var(--bot-keyboard-bottom, 0px) + 8px); right: 8px; max-height: calc(var(--bot-visible-height, 100dvh) - 16px); }
    .termes-bot-wrapper .chat-messages { min-height: 36px; }
    .termes-bot-wrapper .quick-replies-container { max-height: 54px; padding: 6px 12px; }
    .termes-bot-wrapper .chat-legal-notice { font-size: 10px; margin: 4px 12px 8px; }
    .termes-bot-wrapper .chat-header { padding: 6px 10px; }
}
.termes-bot-wrapper.chat-compact .termes-bot-chat-window { position: fixed; bottom: calc(var(--bot-keyboard-bottom, 0px) + 8px); right: 8px; max-height: calc(var(--bot-visible-height, 100dvh) - 16px); }
.termes-bot-wrapper.chat-compact .chat-messages { min-height: 36px; }
.termes-bot-wrapper.chat-compact .quick-replies-container { max-height: 54px; padding: 6px 12px; }
.termes-bot-wrapper.chat-compact .chat-legal-notice { font-size: 10px; margin: 4px 12px 8px; }
.termes-bot-wrapper.chat-compact .chat-header { padding: 6px 10px; }
@media (prefers-reduced-motion: reduce) {
    .termes-bot-wrapper *, .termes-bot-wrapper *::before, .termes-bot-wrapper *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}


