  /* ─── Demo page background ─── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Georgia', serif;
    background: #f0ede8;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c2c2c;
  }
  .demo-label {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: #2c2c2c; color: #f0ede8;
    padding: 6px 18px; border-radius: 20px;
    font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
    opacity: .6;
  }

  /* ══════════════════════════════════════════════════
     CHATBOT WIDGET — copia da qui fino a fine </style>
     ══════════════════════════════════════════════════ */

  /* ── CSS Variables ── */
  :root {
    --cb-primary: #1a3d5c;
    --cb-primary-light: #2a5f8f;
    --cb-accent: #e8a020;
    --cb-surface: #ffffff;
    --cb-surface2: #f4f6f9;
    --cb-border: #d8dde5;
    --cb-text: #1e2a38;
    --cb-text-muted: #6b7c93;
    --cb-bot-bubble: #eef2f8;
    --cb-user-bubble: #1a3d5c;
    --cb-radius: 18px;
    --cb-shadow: 0 12px 48px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
    --cb-w: 380px;
    --cb-h: 560px;
    --cb-btn-size: 60px;
  }

  /* ── Launcher button ── */
  #cb-launcher {
    position: fixed;
    bottom: 28px; right: 28px;
    width: var(--cb-btn-size);
    height: var(--cb-btn-size);
    border-radius: 50%;
    background: var(--cb-primary);
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(26,61,92,.45);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s, box-shadow .2s;
    z-index: 9999;
  }
  #cb-launcher:hover { transform: scale(1.08); box-shadow: 0 10px 28px rgba(26,61,92,.55); }
  #cb-launcher svg { width: 28px; height: 28px; fill: #fff; transition: opacity .2s; }
  #cb-launcher .cb-ico-close { display: none; }
  #cb-launcher.open .cb-ico-chat { display: none; }
  #cb-launcher.open .cb-ico-close { display: block; }

  /* Notification badge */
  #cb-badge {
    position: absolute; top: -4px; right: -4px;
    width: 18px; height: 18px;
    background: var(--cb-accent);
    border-radius: 50%;
    font-size: 10px; font-weight: 700;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: sans-serif;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  }
  #cb-badge.hidden { transform: scale(0); }

  /* ── Chat window ── */
  #cb-window {
    position: fixed;
    bottom: calc(28px + var(--cb-btn-size) + 12px);
    right: 28px;
    width: var(--cb-w);
    height: var(--cb-h);
    background: var(--cb-surface);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    display: flex; flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    transform: translateY(20px) scale(.96);
    opacity: 0;
    pointer-events: none;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s;
    border: 1px solid rgba(0,0,0,.06);
    font-family: 'Segoe UI', system-ui, sans-serif;
  }
  #cb-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
  }

  /* Header */
  #cb-header {
    background: var(--cb-primary);
    padding: 16px 18px;
    display: flex; align-items: center; gap: 12px;
    flex-shrink: 0;
  }
  .cb-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--cb-primary-light);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.25);
  }
  .cb-avatar svg { width: 22px; height: 22px; fill: #fff; }
  .cb-header-info { flex: 1; }
  .cb-header-name {
    color: #fff;
    font-size: 15px; font-weight: 600;
    letter-spacing: .2px;
  }
  .cb-header-status {
    font-size: 12px;
    color: rgba(255,255,255,.65);
    display: flex; align-items: center; gap: 5px;
    margin-top: 2px;
  }
  .cb-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #4cde6a;
    box-shadow: 0 0 0 2px rgba(76,222,106,.3);
    animation: cb-pulse 2s infinite;
  }
  @keyframes cb-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(76,222,106,.3); }
    50% { box-shadow: 0 0 0 5px rgba(76,222,106,.0); }
  }
  #cb-header-close {
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,.7);
    padding: 4px; border-radius: 6px;
    display: flex; align-items: center;
    transition: color .15s, background .15s;
  }
  #cb-header-close:hover { color: #fff; background: rgba(255,255,255,.1); }
  #cb-header-close svg { width: 18px; height: 18px; }

  /* Messages area */
  #cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex; flex-direction: column; gap: 10px;
    background: var(--cb-surface2);
    scroll-behavior: smooth;
  }
  #cb-messages::-webkit-scrollbar { width: 4px; }
  #cb-messages::-webkit-scrollbar-track { background: transparent; }
  #cb-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

  /* Bubbles */
  .cb-msg {
    max-width: 82%;
    display: flex; flex-direction: column;
    animation: cb-in .25s ease both;
  }
  @keyframes cb-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .cb-msg.bot { align-self: flex-start; }
  .cb-msg.user { align-self: flex-end; }

  .cb-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
  }
  .cb-msg.bot .cb-bubble {
    background: var(--cb-bot-bubble);
    color: var(--cb-text);
    border-bottom-left-radius: 4px;
    border: 1px solid #dde4ef;
  }
  .cb-msg.user .cb-bubble {
    background: var(--cb-user-bubble);
    color: #fff;
    border-bottom-right-radius: 4px;
  }
  .cb-time {
    font-size: 10px;
    color: var(--cb-text-muted);
    margin-top: 4px;
    padding: 0 4px;
  }
  .cb-msg.user .cb-time { text-align: right; }

  .cb-bubble ul, .cb-bubble ol {
    margin: 6px 0 6px 18px;
    padding: 0;
    line-height: 1.75;
  }
  .cb-bubble li { margin-bottom: 4px; }
  .cb-bubble a { color: #1a6fbf; }


  /* Bot sender label */
  .cb-sender {
    font-size: 11px;
    font-weight: 600;
    color: var(--cb-primary);
    margin-bottom: 4px;
    padding-left: 2px;
    letter-spacing: .3px;
  }

  /* Quick replies */
  #cb-quick-replies {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 0 14px 10px;
    background: var(--cb-surface2);
  }
  .cb-qr {
    padding: 7px 13px;
    border-radius: 20px;
    border: 1.5px solid var(--cb-primary);
    background: #fff;
    color: var(--cb-primary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
    font-family: inherit;
  }
  .cb-qr:hover { background: var(--cb-primary); color: #fff; }

  /* Typing indicator */
  .cb-typing {
    display: flex; align-items: center; gap: 4px;
    padding: 12px 14px;
    background: var(--cb-bot-bubble);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    border: 1px solid #dde4ef;
  }
  .cb-typing span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--cb-primary-light);
    opacity: .5;
    animation: cb-bounce .9s infinite;
  }
  .cb-typing span:nth-child(2) { animation-delay: .15s; }
  .cb-typing span:nth-child(3) { animation-delay: .3s; }
  @keyframes cb-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-5px); opacity: 1; }
  }

  /* Divider */
  .cb-divider {
    text-align: center;
    font-size: 11px;
    color: var(--cb-text-muted);
    display: flex; align-items: center; gap: 8px;
    padding: 4px 0;
  }
  .cb-divider::before, .cb-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--cb-border);
  }

  /* Input area */
  #cb-input-area {
    padding: 12px 14px;
    background: var(--cb-surface);
    border-top: 1px solid var(--cb-border);
    display: flex; align-items: flex-end; gap: 8px;
    flex-shrink: 0;
  }
  #cb-input {
    flex: 1;
    border: 1.5px solid var(--cb-border);
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 100px;
    line-height: 1.45;
    background: var(--cb-surface2);
    color: var(--cb-text);
    transition: border-color .15s;
  }
  #cb-input:focus { border-color: var(--cb-primary-light); }
  #cb-input::placeholder { color: var(--cb-text-muted); }
  #cb-send {
    width: 40px; height: 40px;
    background: var(--cb-primary);
    border: none; border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .15s;
  }
  #cb-send:hover { background: var(--cb-primary-light); transform: scale(1.07); }
  #cb-send:disabled { background: #b0bec5; cursor: not-allowed; transform: none; }
  #cb-send svg { width: 18px; height: 18px; fill: #fff; }

  /* Footer branding */
  #cb-footer {
    padding: 6px 14px 8px;
    text-align: center;
    font-size: 10px;
    color: var(--cb-text-muted);
    background: var(--cb-surface);
    letter-spacing: .3px;
  }
  #cb-footer a { color: var(--cb-text-muted); text-decoration: none; }

  /* Error message */
  .cb-error {
    background: #fff3f3;
    border: 1px solid #ffc5c5;
    color: #c0392b;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
  }

  /* Mobile responsive */
  @media (max-width: 440px) {
    :root { --cb-w: calc(100vw - 20px); --cb-h: 70vh; }
    #cb-window { right: 10px; bottom: 86px; }
    #cb-launcher { right: 14px; bottom: 14px; }
  }