.clx-chat {
  --clx-bg: #102034;
  --clx-line: #375775;
  --clx-text: #eff7ff;
  --clx-muted: #bed0df;
  --clx-link: #9ee6ff;
  --clx-state: #9fb1c5;
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(5.75rem + env(safe-area-inset-bottom));
  z-index: 9990;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: .65rem;
  color: var(--clx-text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.clx-chat, .clx-chat * { box-sizing: border-box; }
.clx-chat [hidden] { display: none !important; }
.clx-chat button { font: inherit; cursor: pointer; }
.clx-chat :focus-visible { outline: 2px solid #8bd3ff; outline-offset: 3px; }
.clx-chat a { color: var(--clx-link); text-underline-offset: 3px; }
.clx-chat .clx-launcher {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 46px;
  padding: .48rem .85rem .48rem .55rem;
  border: 1px solid #5b8eb6;
  border-radius: 999px;
  background: var(--clx-bg);
  color: var(--clx-text);
  font-weight: 650;
  box-shadow: 0 6px 24px #030b19a0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.clx-chat[data-dragging] .clx-launcher { cursor: grabbing; }
.clx-chat[data-positioned] {
  inset: var(--clx-launcher-top) auto auto var(--clx-launcher-left);
}
.clx-chat[data-positioned] .clx-panel {
  position: absolute;
  left: var(--clx-panel-left);
  bottom: calc(100% + .65rem);
  max-height: min(37rem, var(--clx-panel-room));
}
.clx-chat[data-panel-side=below] .clx-panel {
  top: calc(100% + .65rem);
  bottom: auto;
}
.clx-chat .clx-launcher img { width: 28px; height: 28px; object-fit: contain; }
.clx-launcher-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clx-state);
}
.clx-panel {
  width: min(23.5rem, calc(100vw - 2rem));
  max-height: min(37rem, calc(100dvh - 10rem));
  overflow: auto;
  overscroll-behavior: contain;
  padding: .8rem;
  border: 1px solid var(--clx-line);
  border-radius: 1rem;
  background: var(--clx-bg);
  color: var(--clx-text);
  box-shadow: 0 16px 40px #020917a0;
  text-align: start;
}
.clx-header { display: flex; align-items: flex-start; justify-content: space-between; gap: .65rem; margin-bottom: .35rem; }
.clx-header-actions { display:flex; align-items:center; gap:.35rem; flex:none; }
.clx-chat .clx-header button:is(.clx-share-toggle,.clx-close,.clx-export-icon),
.clx-chat #clx-profile-dialog .clx-profile-header button.clx-profile-close {
  display: inline-grid !important;
  place-items: center;
  flex: 0 0 32px;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border: 1px solid var(--clx-line) !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: #c7cbd1 !important;
  font: 22px/1 system-ui, sans-serif !important;
}
.clx-chat .clx-header button:is(.clx-share-toggle,.clx-close,.clx-export-icon):hover,
.clx-chat #clx-profile-dialog .clx-profile-header button.clx-profile-close:hover {
  background: #203348 !important;
}
.clx-chat .clx-header button:is(.clx-share-toggle,.clx-close,.clx-export-icon):focus-visible,
.clx-chat #clx-profile-dialog .clx-profile-header button.clx-profile-close:focus-visible {
  outline: 2px solid #9de7ff;
  outline-offset: 2px;
}
#clx-panel .clx-header .clx-header-actions button:is(.clx-share-toggle,.clx-close,.clx-export-icon):is(:hover,:focus,:active) {
  border-color:var(--clx-line) !important;
  color:#c7cbd1 !important;
  background:#203348 !important;
}
.clx-share { position:relative; }
.clx-chat .clx-header button:is(.clx-share-toggle,.clx-export-icon) > svg {
  display:block !important; width:22px !important; height:22px !important; min-width:22px; min-height:22px;
  overflow:visible; fill:none !important; stroke:currentColor !important; stroke-width:1.9px;
  stroke-linecap:round; stroke-linejoin:round; pointer-events:none;
}
.clx-chat .clx-header button:is(.clx-share-toggle,.clx-export-icon) > svg :is(path,circle) {
  fill:none !important; stroke:currentColor !important;
}
.clx-export-actions { display:flex; justify-content:space-between; gap:.38rem; }
.clx-share-card {
  position:absolute; z-index:4; inset-inline-end:0; top:calc(100% + .35rem);
  width:min(10rem, 58vw); padding:.35rem; border:1px solid #3c546a; border-radius:.7rem;
  background:#132335; color:#eef6fb; box-shadow:0 8px 24px #020913c4;
}
.clx-chat .clx-share-card[hidden], .clx-chat .clx-share-options[hidden] { display:none!important; }
.clx-chat .clx-share-options button {
  display:block; width:100%; padding:.4rem .6rem; border:0; border-radius:.35rem; margin:0;
  background:transparent; color:inherit; text-align:start; font:600 .8rem/1.35 system-ui,sans-serif;
}
.clx-chat .clx-share-options button:hover,.clx-chat .clx-share-options button:focus-visible { background:#294058; color:#fff; }
.clx-share-options { padding:.2rem 0 .2rem .3rem; margin:.1rem .25rem; border-inline-start:1px solid #7393ae; }
.clx-share-feedback:not(:empty) { display:block; padding:.3rem .55rem; font-size:.72rem; color:#bbddf5; }
.clx-welcome { margin:.2rem 0 .45rem; padding:.2rem 0; border-block:1px solid var(--clx-line); }
.clx-welcome summary {
  display:flex; align-items:center; justify-content:space-between; gap:.55rem; padding:.22rem 0;
  color:var(--clx-text); font:650 .79rem/1.35 system-ui,sans-serif; cursor:pointer; list-style:none;
}
.clx-welcome summary::-webkit-details-marker { display:none; }
.clx-welcome summary:hover { color:#b5e5ff; }
.clx-welcome summary span { font-size:1.05rem; line-height:1; color:#aed8f3; }
.clx-welcome summary span::before { content:"+"; }
.clx-welcome[open] summary span::before { content:"−"; }
.clx-welcome[open] .clx-bio { margin:.32rem 0 .4rem; }
.clx-chat .clx-request-progress { margin:.35rem 0 0; font-size:.76rem; color:var(--clx-muted); }
.clx-chat .clx-request-progress[hidden] { display:none!important; }
.clx-intro { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.clx-intro .clx-avatar { width: 42px; height: 42px; object-fit: contain; }
.clx-intro h2 { margin: 0; color: var(--clx-text); font: 700 1.18rem/1.18 system-ui, sans-serif; }
.clx-chat #clx-panel .clx-intro button.clx-profile-trigger {
  appearance: none;
  min-width: 0;
  min-height: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--clx-text) !important;
  box-shadow: none !important;
  cursor: pointer;
}
.clx-avatar-trigger {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
}
.clx-chat #clx-panel button.clx-name-trigger {
  font: inherit !important;
  text-align: start;
}
.clx-profile-trigger:hover { filter: brightness(1.18); }
.clx-profile-trigger:focus-visible { outline: 2px solid #8bd3ff; outline-offset: 3px; }
.clx-intro .clx-site { color: var(--clx-muted); font-size: .78rem; }
.clx-profile-dialog:not([open]) { display: none !important; }
.clx-profile-dialog::backdrop {
  background: rgb(3 10 20 / 68%);
  backdrop-filter: blur(3px);
}
.clx-profile-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(29rem, calc(100vw - 2rem));
  max-height: min(34rem, calc(100dvh - 2rem));
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid var(--clx-line);
  border-radius: 1rem;
  background: var(--clx-bg);
  color: var(--clx-text);
  box-shadow: 0 20px 60px #020917c9;
}
.clx-profile-dialog[open] { display: flex; flex-direction: column; }
.clx-profile-header { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.clx-profile-identity { display: flex; align-items: center; gap: .75rem; }
.clx-profile-identity img { width: 48px; height: 48px; object-fit: contain; }
.clx-profile-identity h2 { margin: 0; color: var(--clx-text); font: 700 1.25rem/1.2 system-ui, sans-serif; }
.clx-profile-identity p { margin: .15rem 0 0; color: var(--clx-muted); font-size: .82rem; }
.clx-profile-content {
  min-height: 0;
  overflow-y: auto;
  margin-top: .9rem;
  padding-inline-end: .35rem;
  color: var(--clx-muted);
  scrollbar-width: thin;
  scrollbar-color: #58718d var(--clx-bg);
}
.clx-panel .clx-bio { margin: .35rem 0 .65rem; color: var(--clx-muted); }
.clx-panel .clx-compose-meta .clx-status {
  display: inline-flex;
  align-items: center;
  gap: .27rem;
  padding: .1rem .36rem;
  margin: 0;
  border: 1px solid var(--clx-line);
  border-radius: 99px;
  color: var(--clx-text);
  font-size: .71rem;
  line-height: 1.25;
  flex: none;
}
.clx-status-symbol {
  display: inline-grid;
  place-items: center;
  width: .88rem;
  height: .88rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--clx-state);
  font-weight: 750;
  line-height: 1;
}
.clx-chat [data-state=working] { --clx-state: #77db9f; }
.clx-chat [data-state=disconnected] { --clx-state: #a8bacc; }
.clx-chat [data-state=error] { --clx-state: #ff9b9f; }
.clx-chat [data-state=maintenance] { --clx-state: #ffcf80; }
.clx-messages { max-height: 11rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.clx-messages p { margin: .45rem 0; }
.clx-compose { margin-top: .26rem; }
.clx-compose label { display: block; margin: 0; font-size: .8rem; }
.clx-compose-controls { display: grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:.28rem .45rem; }
.clx-compose-meta { grid-column:1; display:flex; align-items:center; justify-content:space-between; gap:.28rem; min-width:0; }
.clx-chat .clx-panel .clx-compose textarea {
  grid-column: 1;
  grid-row: 2;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  padding: .48rem;
  border: 1px solid #cbd5df;
  border-radius: .5rem;
  background: #fff;
  color: #142537;
  caret-color: currentColor;
  resize: vertical;
  font: inherit;
}
.clx-chat .clx-panel .clx-compose textarea::placeholder { color: #576576; opacity: 1; }
.clx-compose button {
  grid-column: 2;
  grid-row: 2;
  min-height: 36px;
  padding: .45rem .7rem;
  border: 0;
  border-radius: .5rem;
  background: #9de7ff;
  color: #0b263a;
  font-weight: 700;
}
.clx-compose button:disabled { opacity: .55; cursor: default; }
.clx-options {
  display: flex;
  gap: .38rem .75rem;
  flex-wrap: wrap;
  margin-top: .53rem;
  padding-top: .48rem;
  border-top: 1px solid var(--clx-line);
  font-size: .82rem;
}
.clx-chat.clx-search { position: static; display: block; max-width: 57rem; margin: 1.5rem auto; padding: 0 1rem; }
.clx-search .clx-panel { width: 100%; max-height: none; }
.clx-search .clx-messages { max-height: 26rem; }
@media (max-height: 520px) {
  .clx-chat:not(.clx-search, [data-positioned]) { bottom: calc(4.85rem + env(safe-area-inset-bottom)); }
  .clx-chat:not(.clx-search, [data-positioned]) .clx-panel { max-height: calc(100dvh - 8.5rem); }
}
