.site-tools-launcher { position: fixed; right: 22px; bottom: 22px; z-index: 70; }
.tool-trigger { min-height: 50px; padding: 0 19px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(188,165,255,.32); border-radius: 999px; color: #f8fafc; background: rgba(24,20,35,.94); backdrop-filter: blur(18px); box-shadow: 0 14px 40px rgba(0,0,0,.3); font: 600 .79rem var(--body,Inter,sans-serif); cursor: pointer; transition: transform .2s,border-color .2s,background .2s; }
.tool-trigger:hover,.tool-trigger:focus-visible { transform: translateY(-2px); border-color: #bca5ff; background: #211a34; }
.tool-chat i { position: relative; width: 9px; height: 9px; flex: none; border-radius: 50%; background: #bca5ff; box-shadow: 0 0 14px rgba(188,165,255,.7); }
.tool-chat i::after { content: ''; position: absolute; inset: -5px; border: 1px solid rgba(188,165,255,.65); border-radius: 50%; animation: access-ai-breathe 4.4s ease-out infinite; }
.tool-chat b { display: none; font: 700 .72rem var(--body,Inter,sans-serif); letter-spacing: -.03em; }
@keyframes access-ai-breathe { 0%,16% { opacity: 0; transform: scale(.62); } 36% { opacity: .72; } 72%,100% { opacity: 0; transform: scale(1.65); } }
.site-overlay { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; padding: 24px; background: rgba(4,4,8,.78); backdrop-filter: blur(12px); }
.site-overlay.open { display: grid; }
.chat-panel { width: min(1120px,100%); height: min(820px,calc(100dvh - 48px)); min-height: 400px; display: grid; grid-template-rows: auto auto minmax(0,1fr); overflow: hidden; border: 1px solid rgba(188,165,255,.3); border-radius: 20px; color: #f8fafc; background: #111019; box-shadow: 0 36px 120px rgba(0,0,0,.62); }
.chat-head { min-height: 78px; padding: 14px 24px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid rgba(248,250,252,.1); }
.assistant-mark { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(140deg,#8b5cf6,#f97316); font: 700 .72rem var(--mono,monospace); }
.chat-heading { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.chat-heading strong { font: 600 1rem var(--display,sans-serif); }
.chat-heading span { color: #a39cab; font-size: .72rem; }
.chat-status { padding: 5px 9px; border: 1px solid rgba(188,165,255,.2); border-radius: 999px; color: #c6a9ff; background: rgba(139,92,246,.08); font: 600 .59rem var(--mono,monospace); text-transform: uppercase; letter-spacing: .07em; }
.dialog-close { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 8px; color: #aaa6b2; background: transparent; font-size: 1.55rem; line-height: 1; cursor: pointer; }
.dialog-close:hover,.dialog-close:focus-visible { color: #f8fafc; background: rgba(255,255,255,.07); }
.chat-disclosure { padding: 9px 24px; color: #b0a7bd; background: rgba(139,92,246,.075); font-size: .69rem; }
.chat-workspace { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 300px; }
.chat-main { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0,1fr) auto; }
.chat-messages { min-height: 0; padding: 32px clamp(22px,4vw,54px); display: flex; flex-direction: column; align-items: flex-start; gap: 16px; overflow-y: auto; scroll-behavior: smooth; }
.chat-welcome { max-width: 580px; padding: 22px 0 5px; }
.chat-welcome-mark { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(188,165,255,.24); border-radius: 13px; color: #c6a9ff; background: rgba(139,92,246,.09); font-size: 1.35rem; }
.chat-kicker,.chat-guide-label { display: block; color: #bca5ff; font: 600 .62rem var(--mono,monospace); letter-spacing: .1em; text-transform: uppercase; }
.chat-welcome .chat-kicker { margin: 22px 0 10px; }
.chat-welcome h2 { margin: 0; font: 600 clamp(1.65rem,3vw,2.4rem)/1.1 var(--display,sans-serif); letter-spacing: -.04em; }
.chat-welcome > p:last-child { max-width: 520px; margin: 14px 0 0; color: #aaa6b2; font-size: .85rem; line-height: 1.65; }
.chat-suggestions { max-width: 640px; display: flex; flex-wrap: wrap; gap: 9px; }
.chat-suggestions button { padding: 10px 13px; border: 1px solid rgba(188,165,255,.22); border-radius: 9px; color: #cbbaff; background: rgba(139,92,246,.06); font: 500 .72rem var(--body,Inter,sans-serif); cursor: pointer; text-align: left; }
.chat-suggestions button:hover,.chat-suggestions button:focus-visible { border-color: #8b5cf6; background: rgba(139,92,246,.14); }
.chat-message { max-width: min(85%,620px); padding: 14px 17px; border-radius: 14px; font-size: .84rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.bot { align-self: flex-start; color: #e0dce7; background: #1b1925; border: 1px solid rgba(248,250,252,.08); border-top-left-radius: 4px; }
.chat-message.user { align-self: flex-end; color: #fff; background: #7049d3; border-bottom-right-radius: 4px; }
.chat-message.typing { padding: 0; color: #aaa6b2; font-size: .75rem; font-style: italic; }
.chat-resources { width: min(85%,620px); padding: 15px; display: grid; gap: 6px; border: 1px solid rgba(188,165,255,.18); border-radius: 13px; background: rgba(139,92,246,.045); }
.chat-resources > strong { margin-bottom: 5px; color: #bca5ff; font: 600 .66rem var(--mono,monospace); text-transform: uppercase; letter-spacing: .06em; }
.chat-resources a { padding: 10px 11px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid rgba(248,250,252,.08); border-radius: 8px; color: #eae4f4; background: #1d1929; text-decoration: none; font-size: .76rem; line-height: 1.35; }
.chat-resources a:hover,.chat-resources a:focus-visible { border-color: #8b5cf6; }
.chat-resources a small { flex: 0 0 auto; color: #bca5ff; font: 600 .58rem var(--mono,monospace); text-transform: capitalize; }
.chat-composer { padding: 17px 24px 13px; display: grid; grid-template-columns: minmax(0,1fr) 46px; gap: 9px; border-top: 1px solid rgba(248,250,252,.1); background: #0d0c13; }
.chat-composer textarea { min-height: 48px; max-height: 130px; padding: 13px 14px; resize: vertical; border: 1px solid rgba(248,250,252,.15); border-radius: 10px; outline: 0; color: #f8fafc; background: #191622; font: 400 .83rem var(--body,Inter,sans-serif); line-height: 1.5; }
.chat-composer textarea:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139,92,246,.12); }
.chat-composer button { min-height: 48px; border: 0; border-radius: 10px; color: #fff; background: #8b5cf6; font-size: 1.1rem; cursor: pointer; }
.chat-composer button:hover { background: #9b70fa; }
.chat-composer button:disabled { opacity: .55; cursor: wait; }
.chat-composer-hint { grid-column: 1 / -1; color: #827b8e; font-size: .65rem; }
.chat-guide { min-height: 0; padding: 28px 23px; overflow-y: auto; border-left: 1px solid rgba(248,250,252,.09); background: radial-gradient(circle at 100% 0%,rgba(139,92,246,.13),transparent 48%),#15121f; }
.chat-guide-intro h2 { margin: 12px 0 9px; font: 600 1.4rem/1.12 var(--display,sans-serif); letter-spacing: -.03em; }
.chat-guide-intro p,.chat-guide-section p { margin: 0; color: #aaa3b0; font-size: .74rem; line-height: 1.6; }
.chat-page-context { margin-top: 28px; padding: 16px; display: grid; gap: 8px; border: 1px solid rgba(188,165,255,.23); border-radius: 12px; background: rgba(139,92,246,.07); }
.chat-page-context strong { font: 600 .85rem/1.35 var(--display,sans-serif); overflow-wrap: anywhere; }
.chat-page-context button { padding: 0; border: 0; color: #cbbaff; background: transparent; font: 600 .7rem var(--body,Inter,sans-serif); text-align: left; cursor: pointer; }
.chat-guide-section { margin-top: 28px; display: grid; gap: 2px; }
.chat-guide-section .chat-guide-label { margin-bottom: 8px; }
.chat-guide-section a { padding: 10px 0; display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(248,250,252,.08); color: #e4dfeb; text-decoration: none; font-size: .77rem; }
.chat-guide-section a:hover,.chat-guide-section a:focus-visible { color: #cbbaff; }
.chat-guide-section a span { color: #bca5ff; }
.chat-guide-section p { margin: 2px 0 8px; }
.chat-mobile-guide { display: none; }
body.site-modal-open { overflow: hidden; }
@media (max-width: 800px) {
  .chat-workspace { grid-template-columns: 1fr; }
  .chat-guide { display: none; }
  .chat-main { grid-template-rows: auto minmax(0,1fr) auto; }
  .chat-mobile-guide { display: block; border-bottom: 1px solid rgba(248,250,252,.09); color: #cbbaff; font-size: .73rem; }
  .chat-mobile-guide summary { padding: 10px 20px; cursor: pointer; }
  .chat-mobile-links { padding: 0 20px 12px; display: flex; flex-wrap: wrap; gap: 7px; }
  .chat-mobile-links a { padding: 7px 9px; border: 1px solid rgba(188,165,255,.22); border-radius: 7px; color: #e4dfeb; text-decoration: none; font-size: .69rem; }
}
@media (max-width: 600px) {
  .site-tools-launcher { right: 14px; bottom: 14px; }
  .tool-trigger { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .tool-chat span { display: none; }
  .tool-chat b { display: block; }
  .tool-chat { gap: 6px; }
  .tool-chat i { width: 13px; height: 13px; }
  .site-overlay { padding: 0; }
  .chat-panel { width: 100%; height: 100dvh; min-height: 0; border: 0; border-radius: 0; }
  .chat-head { min-height: 70px; padding: 10px 16px; }
  .chat-heading span { display: none; }
  .chat-status { margin-left: auto; }
  .chat-disclosure { padding: 8px 16px; font-size: .63rem; }
  .chat-messages { padding: 20px 16px; }
  .chat-welcome { padding-top: 4px; }
  .chat-message,.chat-resources { max-width: 94%; width: auto; }
  .chat-composer { padding: 12px 12px max(10px,env(safe-area-inset-bottom)); }
  .chat-composer-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-trigger,.chat-messages { transition: none; scroll-behavior: auto; }
  .tool-chat i::after { animation: none; opacity: .45; }
}

/* Conversation history and formatted answers */
.chat-workspace { position: relative; grid-template-columns: 220px minmax(0,1fr) 260px; }
.chat-history { min-width: 0; min-height: 0; padding: 20px 12px 14px; display: flex; flex-direction: column; border-right: 1px solid rgba(248,250,252,.09); background: #14111d; }
.chat-history-head { padding: 0 6px 14px; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.chat-history-head strong { color: #ddd5eb; font: 600 .75rem var(--display,sans-serif); }
.chat-history-head button { padding: 6px 8px; border: 1px solid rgba(188,165,255,.25); border-radius: 7px; color: #cbbaff; background: rgba(139,92,246,.08); font: 600 .65rem var(--body,Inter,sans-serif); cursor: pointer; }
.chat-history-head button:hover { border-color: #8b5cf6; }
.chat-history-head button:disabled { opacity: .5; cursor: wait; }
.chat-history-list { min-height: 0; display: grid; align-content: start; gap: 4px; overflow-y: auto; }
.chat-history-item { display: flex; align-items: center; border: 1px solid transparent; border-radius: 8px; }
.chat-history-item:has([aria-current="true"]) { border-color: rgba(188,165,255,.22); background: rgba(139,92,246,.1); }
.chat-history-select { min-width: 0; min-height: 39px; padding: 7px 9px; flex: 1; overflow: hidden; border: 0; color: #aea6ba; background: transparent; font: 500 .69rem var(--body,Inter,sans-serif); text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.chat-history-select[aria-current="true"] { color: #e7dcff; }
.chat-history-select:hover { color: #fff; }
.chat-history-delete { width: 28px; height: 28px; padding: 0; flex: none; border: 0; border-radius: 6px; color: #817989; background: transparent; font-size: 1rem; cursor: pointer; }
.chat-history-delete:hover { color: #ffb48b; background: rgba(249,115,22,.1); }
.chat-history-select:focus-visible,.chat-history-delete:focus-visible,.chat-history-toggle:focus-visible { outline: 2px solid #bca5ff; outline-offset: 1px; }
.chat-history-empty,.chat-history-note { margin: 8px 7px; color: #817989; font-size: .65rem; line-height: 1.5; }
.chat-history-note { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(248,250,252,.08); }
.chat-history-toggle { display: none; padding: 7px 9px; border: 1px solid rgba(188,165,255,.28); border-radius: 7px; color: #cbbaff; background: rgba(139,92,246,.07); font: 600 .65rem var(--body,Inter,sans-serif); cursor: pointer; }
.chat-message.bot { max-width: min(90%,720px); white-space: normal; }
.chat-message.user { white-space: pre-wrap; }
.chat-message.chat-error { border-color: rgba(249,115,22,.28); color: #ffc4a0; background: rgba(249,115,22,.08); }
.chat-markdown { overflow-wrap: anywhere; }
.chat-markdown > :first-child { margin-top: 0; }
.chat-markdown > :last-child { margin-bottom: 0; }
.chat-markdown p,.chat-markdown ul,.chat-markdown ol,.chat-markdown blockquote,.chat-markdown pre,.chat-markdown table { margin: .7rem 0; }
.chat-markdown h1,.chat-markdown h2,.chat-markdown h3,.chat-markdown h4 { margin: 1rem 0 .4rem; color: #f4ecff; font: 600 1rem/1.35 var(--display,sans-serif); }
.chat-markdown h1 { font-size: 1.2rem; }
.chat-markdown h3,.chat-markdown h4 { font-size: .9rem; }
.chat-markdown ul,.chat-markdown ol { padding-left: 1.3rem; }
.chat-markdown li { margin: .25rem 0; }
.chat-markdown a { color: #d5c5ff; text-underline-offset: 2px; }
.chat-markdown blockquote { padding: .1rem .8rem; border-left: 3px solid #8b5cf6; color: #bcb5c7; }
.chat-markdown :not(pre) > code { padding: .1rem .28rem; border: 1px solid rgba(188,165,255,.18); border-radius: 4px; color: #e2d4ff; background: rgba(139,92,246,.12); font: .78em var(--mono,monospace); }
.chat-markdown table { width: 100%; border-collapse: collapse; font-size: .75rem; }
.chat-markdown th,.chat-markdown td { padding: .45rem .5rem; border: 1px solid rgba(248,250,252,.15); text-align: left; }
.chat-markdown th { color: #e8dcff; background: rgba(139,92,246,.12); }
.chat-code { max-width: 100%; margin: .8rem 0; overflow: hidden; border: 1px solid rgba(188,165,255,.19); border-radius: 9px; background: #0e0c16; }
.chat-code-toolbar { padding: .4rem .6rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(248,250,252,.09); color: #9b90ac; font: 600 .6rem var(--mono,monospace); text-transform: uppercase; }
.chat-code-toolbar button { padding: .2rem .4rem; border: 1px solid rgba(188,165,255,.2); border-radius: 4px; color: #cbbaff; background: rgba(139,92,246,.08); font: 600 .6rem var(--body,Inter,sans-serif); text-transform: none; cursor: pointer; }
.chat-code-toolbar button:hover { border-color: #8b5cf6; }
.chat-code pre { max-width: 100%; margin: 0; padding: .8rem 1rem; overflow-x: auto; color: #ded9e8; background: transparent; font: .72rem/1.6 var(--mono,monospace); tab-size: 2; }
.chat-code code { font: inherit; white-space: pre; }
.chat-code .token.comment,.chat-code .token.prolog { color: #8b819b; }
.chat-code .token.string,.chat-code .token.attr-value { color: #9bd8b6; }
.chat-code .token.keyword,.chat-code .token.boolean,.chat-code .token.constant { color: #c7a7ff; }
.chat-code .token.number,.chat-code .token.property { color: #ffc08c; }
.chat-code .token.function,.chat-code .token.class-name { color: #9ccaff; }
.chat-code .token.operator,.chat-code .token.punctuation { color: #bcb5c7; }
@media (max-width: 1000px) {
  .chat-workspace { grid-template-columns: 220px minmax(0,1fr); }
  .chat-guide { display: none; }
}
@media (max-width: 700px) {
  .chat-workspace { grid-template-columns: 1fr; }
  .chat-history { width: min(300px,88vw); position: absolute; z-index: 4; inset: 0 auto 0 0; visibility: hidden; transform: translateX(-105%); box-shadow: 16px 0 45px rgba(0,0,0,.25); transition: transform .2s, visibility .2s; }
  .chat-history.open { visibility: visible; transform: translateX(0); }
  .chat-history-toggle { display: inline-block; }
  .chat-status { display: none; }
  .chat-message.bot { max-width: 96%; }
}
:root[data-theme="light"] .chat-history { background: #f5f2fa; border-color: var(--line); }
:root[data-theme="light"] .chat-history-head strong,:root[data-theme="light"] .chat-history-select[aria-current="true"] { color: #392967; }
:root[data-theme="light"] .chat-history-select { color: #5c5668; }
:root[data-theme="light"] .chat-history-item:has([aria-current="true"]) { background: #ebe4f8; }
:root[data-theme="light"] .chat-history-note { border-color: var(--line); }
:root[data-theme="light"] .chat-markdown h1,:root[data-theme="light"] .chat-markdown h2,:root[data-theme="light"] .chat-markdown h3,:root[data-theme="light"] .chat-markdown h4 { color: #392967; }
:root[data-theme="light"] .chat-markdown a,:root[data-theme="light"] .chat-markdown :not(pre) > code { color: #5931b7; }
:root[data-theme="light"] .chat-markdown th { color: #392967; }
:root[data-theme="light"] .chat-code { background: #161321; }
:root[data-theme="light"] .chat-message.chat-error { color: #a13f0c; }
