   /* === UptoData brand tokens === */
    :root {
      --navy:         #0f2744;
      --navy-mid:     #1a3a5c;
      --navy-light:   #254d7a;
      --green:        #3a6b4a;
      --green-mid:    #4e8a62;
      --green-light:  #6aaa7e;
      --green-pale:   #e8f2eb;
      --charcoal:     #1e2328;
      --bg:           #f5f4f0;
      --surface:      #faf9f7;
      --border:       #d5cfc5;
      --text:         #1a1a1a;
      --text-dim:     #2e3740;
      --text-muted:   #6b7280;
      --shadow-sm:    0 2px 12px rgba(15,39,68,.10);
      --shadow-lg:    0 16px 48px rgba(15,39,68,.22);
      --radius:       12px;
      --radius-lg:    18px;
      --font-display: 'Playfair Display', Georgia, serif;
      --font-body:    'Source Sans 3', 'Segoe UI', sans-serif;
    }

   

    /* Demo page backdrop */
  
    @keyframes nudge {
      0%   { opacity: 0; transform: translateY(8px); }
      20%  { opacity: 1; transform: translateY(0); }
      80%  { opacity: 1; transform: translateY(0); }
      100% { opacity: 0; transform: translateY(-4px); }
    }

    /* =========================================================
       CHAT BUBBLE (FAB)
    ========================================================= */
    #ud-fab {
      position: fixed;
      bottom: 28px;
      right: 28px;
      width: 60px;
      height: 60px;
      border-radius: 50%;
      background: linear-gradient(148deg, var(--navy-light) 0%, var(--navy-mid) 45%, var(--navy) 80%);
      border: none;
      cursor: pointer;
      box-shadow: 0 8px 28px rgba(15,39,68,.38), inset 0 1px 0 rgba(255,255,255,.18);
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform .22s ease, box-shadow .22s ease;
      z-index: 9999;
    }
    #ud-fab:hover {
      transform: scale(1.08) translateY(-2px);
      box-shadow: 0 14px 40px rgba(15,39,68,.45), inset 0 1px 0 rgba(255,255,255,.22);
    }
    #ud-fab svg { transition: transform .3s ease, opacity .3s ease; }
    #ud-fab .icon-close {
      position: absolute;
      opacity: 0;
      transform: rotate(-45deg) scale(0.6);
    }
    #ud-fab.open .icon-chat  { opacity: 0; transform: rotate(45deg) scale(0.6); }
    #ud-fab.open .icon-close { opacity: 1; transform: rotate(0deg) scale(1); }

    /* Notification dot */
    .fab-dot {
      position: absolute;
      top: 10px;
      right: 10px;
      width: 11px;
      height: 11px;
      background: var(--green-light);
      border-radius: 50%;
      border: 2px solid #fff;
      animation: pulse-dot 2.4s ease-in-out infinite;
    }
    @keyframes pulse-dot {
      0%, 100% { transform: scale(1); opacity: 1; }
      50%       { transform: scale(1.35); opacity: .7; }
    }
    #ud-fab.open .fab-dot { display: none; }

    /* =========================================================
       CHAT PANEL
    ========================================================= */
    #ud-panel {
      position: fixed;
      bottom: 100px;
      right: 28px;
      width: 380px;
      max-height: 600px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.9);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      z-index: 9998;
      transform: scale(0.88) translateY(24px);
      transform-origin: bottom right;
      opacity: 0;
      pointer-events: none;
      transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .22s ease;
    }
    #ud-panel.open {
      transform: scale(1) translateY(0);
      opacity: 1;
      pointer-events: all;
    }

    /* Header */
    .chat-header {
      background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
      padding: 18px 20px 16px;
      display: flex;
      align-items: center;
      gap: 13px;
      flex-shrink: 0;
    }
    .chat-header-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: rgba(255,255,255,.12);
      border: 1.5px solid rgba(255,255,255,.22);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .chat-header-info { flex: 1; min-width: 0; }
    .chat-header-name {
      font-family: var(--font-display);
      font-size: 1rem;
      font-weight: 700;
      color: #fff;
      line-height: 1.2;
    }
    .chat-header-status {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 0.76rem;
      color: rgba(255,255,255,.65);
      margin-top: 2px;
      font-weight: 600;
    }
    .status-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--green-light);
      flex-shrink: 0;
    }
    .chat-header-close {
      background: none;
      border: none;
      cursor: pointer;
      color: rgba(255,255,255,.55);
      padding: 4px;
      border-radius: 6px;
      transition: color .2s, background .2s;
      line-height: 1;
    }
    .chat-header-close:hover { color: #fff; background: rgba(255,255,255,.1); }

    /* Messages area */
    .chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 20px 16px 12px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      scroll-behavior: smooth;
    }
    .chat-messages::-webkit-scrollbar { width: 4px; }
    .chat-messages::-webkit-scrollbar-track { background: transparent; }
    .chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

    /* Message bubbles */
    .msg {
      display: flex;
      gap: 8px;
      align-items: flex-end;
      animation: msg-in .25s ease both;
    }
    @keyframes msg-in {
      from { opacity: 0; transform: translateY(10px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .msg--bot { align-self: flex-start; }
    .msg--user { align-self: flex-end; flex-direction: row-reverse; }

    .msg-avatar {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--green-pale);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 0.8rem;
    }

    .msg-bubble {
      max-width: 82%;
      padding: 11px 14px;
      border-radius: 16px;
      font-size: 0.9rem;
      line-height: 1.55;
      word-break: break-word;
    }
    .msg--bot .msg-bubble {
      background: var(--bg);
      border: 1px solid var(--border);
      border-bottom-left-radius: 4px;
      color: var(--text);
      box-shadow: 0 2px 8px rgba(15,39,68,.06);
    }
    .msg--user .msg-bubble {
      background: var(--navy);
      color: #fff;
      border-bottom-right-radius: 4px;
      box-shadow: 0 4px 14px rgba(15,39,68,.25);
    }

    /* Typing indicator */
    .typing-indicator {
      display: flex;
      gap: 5px;
      padding: 12px 16px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 16px;
      border-bottom-left-radius: 4px;
      width: fit-content;
      box-shadow: 0 2px 8px rgba(15,39,68,.06);
    }
    .typing-indicator span {
      width: 7px;
      height: 7px;
      background: var(--text-muted);
      border-radius: 50%;
      animation: bounce-dot .9s ease-in-out infinite;
    }
    .typing-indicator span:nth-child(2) { animation-delay: .15s; }
    .typing-indicator span:nth-child(3) { animation-delay: .3s; }
    @keyframes bounce-dot {
      0%, 60%, 100% { transform: translateY(0); }
      30%            { transform: translateY(-5px); }
    }

    /* Quick replies */
    .quick-replies {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      padding: 4px 0 2px;
    }
    .qr-btn {
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: 20px;
      padding: 6px 13px;
      font-family: var(--font-body);
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--navy);
      cursor: pointer;
      transition: background .18s, border-color .18s, transform .15s;
      white-space: nowrap;
    }
    .qr-btn:hover {
      background: var(--green-pale);
      border-color: var(--green);
      color: var(--green);
      transform: translateY(-1px);
    }

    /* Input area */
    .chat-footer {
      padding: 12px 14px 14px;
      border-top: 1px solid var(--border);
      background: var(--surface);
      flex-shrink: 0;
    }
    .chat-input-row {
      display: flex;
      gap: 10px;
      align-items: flex-end;
    }
    #ud-input {
      flex: 1;
      background: var(--bg);
      border: 1.5px solid var(--border);
      border-radius: 10px;
      padding: 10px 14px;
      font-family: var(--font-body);
      font-size: 0.9rem;
      color: var(--text);
      resize: none;
      min-height: 40px;
      max-height: 120px;
      overflow-y: auto;
      transition: border-color .2s, box-shadow .2s;
      outline: none;
      line-height: 1.5;
    }
    #ud-input:focus {
      border-color: var(--navy-light);
      box-shadow: 0 0 0 3px rgba(15,39,68,.1);
    }
    #ud-input::placeholder { color: var(--text-muted); }

    #ud-send {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      background: var(--navy);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: background .2s, transform .15s, box-shadow .2s;
      box-shadow: 0 3px 10px rgba(15,39,68,.25);
    }
    #ud-send:hover:not(:disabled) {
      background: var(--navy-light);
      transform: scale(1.05);
      box-shadow: 0 5px 16px rgba(15,39,68,.32);
    }
    #ud-send:disabled { background: var(--border); cursor: not-allowed; box-shadow: none; }

    .chat-footer-note {
      text-align: center;
      font-size: 0.7rem;
      color: var(--text-muted);
      margin-top: 9px;
    }
    .chat-footer-note a {
      color: var(--green);
      text-decoration: none;
      font-weight: 600;
    }
    .chat-footer-note a:hover { text-decoration: underline; }

    /* === Error state === */
    .msg-error .msg-bubble {
      background: #fff5f5;
      border-color: #fecaca;
      color: #b91c1c;
    }

    /* === Mobile === */
    @media (max-width: 480px) {
      #ud-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 85dvh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        transform-origin: bottom center;
      }
      #ud-fab { bottom: 20px; right: 20px; }
    }