#chem-plugin-chat{--cc-paper:var(--paper,#fff);--cc-ink:var(--ink,#183a3e);--cc-accent:var(--brand,#126e68);--cc-line:var(--line,#d9e5e4);--cc-bubble:#eef5f3;position:fixed;right:24px;bottom:24px;z-index:900;font:14px/1.55 system-ui,sans-serif;color:var(--cc-ink);text-align:left}
#chem-plugin-chat *{box-sizing:border-box}#chem-plugin-chat [hidden]{display:none!important}#chem-plugin-chat button,#chem-plugin-chat input{font:inherit}#chem-plugin-chat button{cursor:pointer;border:0;border-radius:8px;padding:9px 13px}#chem-plugin-chat button:focus-visible,#chem-plugin-chat a:focus-visible,#chem-plugin-chat input:focus-visible{outline:3px solid var(--cc-accent);outline-offset:3px}
#chem-plugin-chat .cc-toggle{width:54px;height:54px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--cc-accent);color:#fff;box-shadow:0 8px 28px #001b2330}#chem-plugin-chat .cc-toggle:hover{filter:brightness(1.1)}#chem-plugin-chat .cc-toggle svg{width:27px;height:27px;pointer-events:none}
#chem-plugin-chat .cc-panel{position:absolute;bottom:68px;right:0;width:390px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 120px);background:var(--cc-paper);border:1px solid var(--cc-line);border-radius:16px;box-shadow:0 16px 60px #071c3030;display:flex;flex-direction:column;overflow:hidden}
#chem-plugin-chat header{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:15px 18px;border-bottom:1px solid var(--cc-line);background:var(--cc-paper);color:var(--cc-ink)}#chem-plugin-chat header strong{font-size:16px;line-height:1.3;color:inherit}#chem-plugin-chat header button{background:transparent;font-size:26px;line-height:1;color:inherit}
#chem-plugin-chat .cc-messages{flex:1 1 300px;min-height:90px;overflow:auto;padding:18px;overscroll-behavior:contain}#chem-plugin-chat .cc-bubble{white-space:pre-wrap;overflow-wrap:anywhere;max-width:94%;padding:11px 13px;margin-bottom:12px;border-radius:10px;background:var(--cc-bubble);color:var(--cc-ink)}#chem-plugin-chat .cc-user{margin-left:auto;background:var(--cc-accent);color:#fff}#chem-plugin-chat .cc-notice{color:#8a3c16;background:#fff1e6}
#chem-plugin-chat .cc-controls{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;padding:10px 16px;font-size:12px;border-top:1px solid var(--cc-line)}#chem-plugin-chat .cc-controls button{font-size:12px;background:none;padding:0;color:var(--cc-ink)}#chem-plugin-chat a{color:var(--cc-accent);text-decoration:underline;text-underline-offset:3px}#chem-plugin-chat label{display:flex;align-items:center;gap:5px;margin:0;font-weight:400}#chem-plugin-chat input[type=checkbox]{display:inline-block!important;width:15px;height:15px;flex:0 0 15px;margin:0;padding:0;appearance:auto;accent-color:var(--cc-accent)}
#chem-plugin-chat form{display:flex;gap:8px;padding:12px 16px}#chem-plugin-chat form input{min-width:0;flex:1;width:auto;height:auto;padding:10px;border:1px solid var(--cc-line);border-radius:7px;color:var(--cc-ink);background:var(--cc-paper);box-shadow:none}#chem-plugin-chat input::placeholder{color:var(--cc-ink);opacity:.6}#chem-plugin-chat button[type=submit]{background:var(--cc-accent);color:#fff}#chem-plugin-chat small{display:block;padding:0 16px 14px;color:var(--cc-ink);opacity:.7;font-size:11px}#chem-plugin-chat button:disabled{opacity:.55;cursor:wait}
[data-theme=dark] #chem-plugin-chat{--cc-paper:var(--paper,#112b31);--cc-ink:var(--ink,#e0efed);--cc-bubble:#233f43;--cc-accent:#217d72;--cc-line:#3c5959}[data-theme=dark] #chem-plugin-chat a{color:#a1e4cd}[data-theme=dark] #chem-plugin-chat .cc-notice{background:#563e29;color:#ffe5c2}
@media(max-width:600px){#chem-plugin-chat{right:16px;bottom:16px}#chem-plugin-chat .cc-panel{bottom:64px;max-height:calc(100dvh - 105px)}#chem-plugin-chat .cc-toggle{width:50px;height:50px}#chem-plugin-chat .cc-messages{flex-basis:38dvh}}
@media print{#chem-plugin-chat{display:none!important}}@media(prefers-reduced-motion:reduce){#chem-plugin-chat *{scroll-behavior:auto!important}}

@media (max-width:600px), (pointer:coarse) {
  #chem-plugin-chat form input { font-size:16px; }
  #chem-plugin-chat .cc-messages { min-height:0; }
}

/* The keyboard can shrink the visual viewport without moving fixed elements. */
#chem-plugin-chat.cc-keyboard > #cc-panel {
  position:fixed;
  right:16px;
  bottom:calc(var(--cc-keyboard-inset) + 8px);
  max-height:calc(var(--cc-visible-height) - 16px);
}
#chem-plugin-chat.cc-keyboard > .cc-toggle { visibility:hidden; }
#chem-plugin-chat.cc-keyboard .cc-panel > :not(.cc-messages) { flex-shrink:0; }
#chem-plugin-chat.cc-keyboard .cc-messages { min-height:0; padding:8px 12px 0; }
#chem-plugin-chat.cc-keyboard header { padding:4px 12px; }
#chem-plugin-chat.cc-keyboard form { padding:8px 12px; }
#chem-plugin-chat.cc-keyboard-compact :is(.cc-controls,small) { display:none; }

/* Keep avatars beside the first line; wrapped text stays in its own column. */
#chem-plugin-chat .cc-bubble{display:grid;grid-template-columns:32px minmax(0,1fr);gap:9px;align-items:start;max-width:100%;white-space:normal}
#chem-plugin-chat .cc-message-body{min-width:0;white-space:pre-wrap;overflow-wrap:anywhere;padding-top:3px}
#chem-plugin-chat .cc-avatar{display:flex;align-items:center;justify-content:center;width:32px;height:32px;overflow:hidden;border:1px solid var(--cc-line);border-radius:50%;background:var(--cc-paper);color:var(--cc-accent);flex-shrink:0}
#chem-plugin-chat .cc-avatar svg{display:block;width:20px;height:20px;flex-shrink:0}
#chem-plugin-chat .cc-avatar img{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}
#chem-plugin-chat .cc-user .cc-avatar{color:inherit;background:transparent;border-color:currentColor}
#chem-plugin-chat .cc-avatar-notice{background:transparent;border-color:currentColor;color:inherit}
[data-theme=dark] #chem-plugin-chat .cc-avatar-bot{color:#a1e4cd;background:var(--cc-bubble);border-color:#5d8981}
@media (prefers-reduced-motion: no-preference) {
  #chem-plugin-chat .cc-avatar-bot .cc-robot-eyes {
    transform-box: fill-box;
    transform-origin: center;
    animation: cc-robot-blink 5s ease-in-out infinite;
  }
  @keyframes cc-robot-blink {
    0%, 93%, 98%, 100% { transform: scaleY(1); }
    95%, 96% { transform: scaleY(.18); }
  }
}
#chem-plugin-chat .cc-source{margin-top:10px;white-space:normal}
#chem-plugin-chat .cc-thinking{font-style:italic}
#chem-plugin-chat .cc-thinking-dots{display:inline-block}
#chem-plugin-chat .cc-typing::after{
  content:"";
  display:inline-block;
  width:2px;
  height:.9em;
  margin-inline-start:3px;
  vertical-align:-.08em;
  background:currentColor;
}
@media (prefers-reduced-motion: no-preference) {
  #chem-plugin-chat .cc-thinking-dots{animation:cc-thinking-dots 1.35s step-end infinite}
  @keyframes cc-thinking-dots{
    0%{clip-path:inset(0 66.6667% 0 0)}
    33.3333%{clip-path:inset(0 33.3333% 0 0)}
    66.6667%,100%{clip-path:inset(0)}
  }
}
@media(max-width:600px){#chem-plugin-chat .cc-bubble{grid-template-columns:28px minmax(0,1fr);gap:8px;padding:10px}#chem-plugin-chat .cc-avatar{width:28px;height:28px}#chem-plugin-chat .cc-avatar svg{width:18px;height:18px}#chem-plugin-chat .cc-message-body{padding-top:1px}}
