
    /* ============================================================
   CHATBOT — All styles scoped to chat elements
   ============================================================ */

    /* ── Toggle Button ── */
    #chat-toggle {
      position: fixed;
      bottom: 28px;
      right: 28px;
      z-index: 8000;
      width: 60px;
      height: 60px;
      border-radius: 50%;
      background: var(--grad);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.4rem;
      color: #fff;
      box-shadow: 0 8px 30px var(--glows), 0 0 0 0 var(--glow);
      transition: transform 0.3s cubic-bezier(.34, 1.56, .64, 1), box-shadow 0.3s;
      animation: chat-pulse 3s ease-in-out infinite 2s;
    }

    #chat-toggle:hover {
      transform: scale(1.12);
      box-shadow: 0 12px 40px var(--glows), 0 0 0 8px var(--glow);
      animation: none;
    }

    #chat-toggle.open {
      transform: scale(1.08) rotate(10deg);
      animation: none;
    }

    /* Pulse animation to grab attention */
    @keyframes chat-pulse {

      0%,
      100% {
        box-shadow: 0 8px 30px var(--glows), 0 0 0 0 var(--glow);
      }

      50% {
        box-shadow: 0 8px 30px var(--glows), 0 0 0 12px rgba(56, 130, 255, 0);
      }
    }

    /* Notification badge */
    .chat-notif {
      position: absolute;
      top: -2px;
      right: -2px;
      width: 20px;
      height: 20px;
      background: #ef4444;
      border-radius: 50%;
      font-size: 0.65rem;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 2px solid var(--bg);
      animation: notif-bounce 1.5s ease-in-out infinite;
    }

    @keyframes notif-bounce {

      0%,
      100% {
        transform: scale(1);
      }

      50% {
        transform: scale(1.25);
      }
    }

    .chat-notif.hidden {
      display: none;
    }

    /* ── Chat Window ── */
    #chat-window {
      position: fixed;
      bottom: 102px;
      right: 28px;
      z-index: 7999;
      width: 380px;
      max-height: 585px;
      background: var(--bg2);
      border: 1px solid var(--bdr);
      border-radius: 24px;
      box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--bdr), 0 0 60px var(--glow);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      /* Hidden state */
      opacity: 0;
      transform: translateY(20px) scale(0.95);
      pointer-events: none;
      transition: opacity 0.35s cubic-bezier(.4, 0, .2, 1),
        transform 0.35s cubic-bezier(.34, 1.56, .64, 1);
      transform-origin: bottom right;
    }

    #chat-window.open {
      opacity: 1;
      transform: translateY(0) scale(1);
      pointer-events: all;
    }

    /* ── Header ── */
    .chat-header {
      background: var(--grad);
      padding: 16px 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-shrink: 0;
      position: relative;
      overflow: hidden;
    }

    /* Subtle grid overlay on header */
    .chat-header::before {
      content: '';
      position: absolute;
      inset: 0;
      background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
      background-size: 20px 20px;
      pointer-events: none;
    }

    .chat-header-left {
      display: flex;
      align-items: center;
      gap: 12px;
      position: relative;
    }

    .bot-avatar {
      width: 42px;
      height: 42px;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 2px solid rgba(255, 255, 255, 0.3);
      flex-shrink: 0;
    }

    .bot-name {
      font-family: var(--display);
      font-weight: 700;
      font-size: 0.95rem;
      color: #fff;
      line-height: 1;
      margin-bottom: 4px;
    }

    .bot-status {
      font-size: 0.7rem;
      color: rgba(255, 255, 255, 0.8);
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .status-dot {
      width: 7px;
      height: 7px;
      background: #4ade80;
      border-radius: 50%;
      animation: online-blink 2s ease-in-out infinite;
    }

    @keyframes online-blink {
      50% {
        opacity: 0.4;
        transform: scale(1.5);
      }
    }

    .chat-header-right {
      display: flex;
      gap: 6px;
      position: relative;
    }

    .chat-hbtn {
      width: 30px;
      height: 30px;
      background: rgba(255, 255, 255, 0.15);
      border: none;
      border-radius: 8px;
      color: #fff;
      font-size: 0.8rem;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s;
    }

    .chat-hbtn:hover {
      background: rgba(255, 255, 255, 0.3);
    }

    /* ── Quick Suggestions ── */
    .chat-suggestions {
      padding: 12px 14px 8px;
      flex-shrink: 0;
      border-bottom: 1px solid var(--bdr);
      background: var(--sur);
    }

    .sugg-label {
      font-size: 0.7rem;
      color: var(--tx3);
      font-family: var(--mono);
      display: block;
      margin-bottom: 7px;
    }

    .sugg-pills {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
    }

    .pill {
      padding: 4px 11px;
      background: var(--tag);
      border: 1px solid var(--bdr);
      border-radius: 20px;
      font-size: 0.72rem;
      color: var(--ac2);
      cursor: pointer;
      transition: all 0.2s;
      font-family: var(--body);
      font-weight: 500;
      white-space: nowrap;
    }

    .pill:hover {
      background: var(--ac);
      color: #fff;
      border-color: var(--ac);
      transform: translateY(-1px);
    }

    /* ── Messages Area ── */
    .chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 16px 14px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      scroll-behavior: smooth;
    }

    /* Custom scrollbar for messages */
    .chat-messages::-webkit-scrollbar {
      width: 3px;
    }

    .chat-messages::-webkit-scrollbar-track {
      background: transparent;
    }

    .chat-messages::-webkit-scrollbar-thumb {
      background: var(--bdr);
      border-radius: 4px;
    }

    /* ── Message Bubbles ── */
    /* Wrapper for avatar + bubble alignment */
    .bot-bubble-wrap {
      display: flex;
      align-items: flex-end;
      gap: 8px;
    }

    .user-bubble-wrap {
      display: flex;
      align-items: flex-end;
      gap: 8px;
      flex-direction: row-reverse;
    }

    /* Avatars inside chat */
    .msg-avatar {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.75rem;
      flex-shrink: 0;
    }

    .bot-av {
      background: var(--grad);
      color: #fff;
    }

    .user-av {
      background: var(--sur2);
      color: var(--ac);
      border: 1px solid var(--bdr);
      font-size: 0.65rem;
      font-weight: 700;
      font-family: var(--display);
    }

    /* The bubble itself */
    .bot-bubble {
      background: var(--sur);
      border: 1px solid var(--bdr);
      border-radius: 18px 18px 18px 4px;
      padding: 11px 14px;
      font-size: 0.85rem;
      line-height: 1.6;
      color: var(--tx);
      max-width: 78%;
      word-break: break-word;
      animation: bubble-in-left 0.35s cubic-bezier(.34, 1.56, .64, 1) both;
    }

    .user-bubble {
      background: var(--grad);
      border-radius: 18px 18px 4px 18px;
      padding: 11px 14px;
      font-size: 0.85rem;
      line-height: 1.6;
      color: #fff;
      max-width: 78%;
      word-break: break-word;
      animation: bubble-in-right 0.3s cubic-bezier(.34, 1.56, .64, 1) both;
      box-shadow: 0 4px 14px var(--glow);
    }

    /* Bubble entrance animations */
    @keyframes bubble-in-left {
      from {
        opacity: 0;
        transform: translateX(-12px) scale(0.9);
      }

      to {
        opacity: 1;
        transform: translateX(0) scale(1);
      }
    }

    @keyframes bubble-in-right {
      from {
        opacity: 0;
        transform: translateX(12px) scale(0.9);
      }

      to {
        opacity: 1;
        transform: translateX(0) scale(1);
      }
    }

    /* Timestamps */
    .msg-time {
      font-size: 0.62rem;
      color: var(--tx3);
      margin-top: 4px;
      padding: 0 4px;
      font-family: var(--mono);
    }

    .time-bot {
      text-align: left;
      padding-left: 38px;
    }

    .time-user {
      text-align: right;
      padding-right: 38px;
    }

    /* Bot response can include links, bold, lists */
    .bot-bubble a {
      color: var(--ac2);
      text-decoration: underline;
    }

    .bot-bubble strong {
      color: var(--ac);
      font-weight: 600;
    }

    .bot-bubble ul {
      margin: 6px 0 0 14px;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .bot-bubble ul li::marker {
      color: var(--ac);
    }

    /* ── Typing Indicator ── */
    .typing-indicator {
      padding: 0 14px 10px;
      display: none;
      flex-shrink: 0;
    }

    .typing-indicator.show {
      display: block;
    }

    .typing-dots {
      background: var(--sur);
      border: 1px solid var(--bdr);
      border-radius: 18px 18px 18px 4px;
      padding: 12px 16px;
      display: inline-flex;
      gap: 5px;
      align-items: center;
    }

    .typing-dots span {
      width: 7px;
      height: 7px;
      background: var(--ac);
      border-radius: 50%;
      animation: dot-bounce 1.4s ease-in-out infinite;
      opacity: 0.6;
    }

    .typing-dots span:nth-child(1) {
      animation-delay: 0s;
    }

    .typing-dots span:nth-child(2) {
      animation-delay: 0.2s;
    }

    .typing-dots span:nth-child(3) {
      animation-delay: 0.4s;
    }

    @keyframes dot-bounce {

      0%,
      80%,
      100% {
        transform: scale(1);
        opacity: 0.4;
      }

      40% {
        transform: scale(1.5);
        opacity: 1;
      }
    }

    /* ── Input Area ── */
    .chat-input-wrap {
      padding: 12px 14px;
      border-top: 1px solid var(--bdr);
      display: flex;
      gap: 9px;
      align-items: center;
      flex-shrink: 0;
      background: var(--sur);
    }

    .chat-input {
      flex: 1;
      background: var(--bg2);
      border: 1.5px solid var(--bdr);
      border-radius: 22px;
      padding: 10px 16px;
      font-size: 0.875rem;
      color: var(--tx);
      outline: none;
      font-family: var(--body);
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .chat-input:focus {
      border-color: var(--ac);
      box-shadow: 0 0 0 3px var(--glow);
    }

    .chat-input::placeholder {
      color: var(--tx3);
    }

    /* Send button */
    .chat-send {
      width: 40px;
      height: 40px;
      background: var(--grad);
      border: none;
      border-radius: 50%;
      color: #fff;
      font-size: 0.9rem;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
      box-shadow: 0 4px 14px var(--glow);
      flex-shrink: 0;
    }

    .chat-send:hover {
      transform: scale(1.1);
      box-shadow: 0 6px 20px var(--glows);
    }

    .chat-send:active {
      transform: scale(0.95);
    }

    .chat-send:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
    }

    /* Footer note */
    .chat-footer-note {
      text-align: center;
      font-size: 0.62rem;
      color: var(--tx3);
      padding: 4px 0 8px;
      font-family: var(--mono);
      background: var(--sur);
      flex-shrink: 0;
    }

    /* ── Responsive ── */
    @media (max-width: 440px) {
      #chat-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 88px;
      }

      #chat-toggle {
        right: 16px;
        bottom: 16px;
      }
    }

    /* Empty state */
    .chat-empty {
      text-align: center;
      padding: 20px;
      color: var(--tx3);
      font-size: 0.82rem;
    }

    .chat-empty i {
      font-size: 2rem;
      color: var(--bdr);
      display: block;
      margin-bottom: 8px;
    }
  