.cpcs-chat {
  --cpcs-accent: #146c5b;
  --cpcs-ink: #172321;
  --cpcs-sidebar-w: 84px;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  font-family: inherit;
  color: var(--cpcs-ink);
}

.cpcs-chat__toggle {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--cpcs-accent);
  color: #fff;
  font-size: 25px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}

.cpcs-chat__panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(474px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 120px));
  background: #fff;
  border: 1px solid #d8e1df;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 18px 55px rgba(20, 39, 35, .24);
  display: flex;
  flex-direction: column;
}

.cpcs-chat__panel[hidden] { display: none; }

/* 整个顶部绿色通栏（横跨左侧竖条和右侧对话区） */
.cpcs-chat__header {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 17px;
  color: #fff;
  background: var(--cpcs-accent);
}

.cpcs-chat__identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.cpcs-chat__logo {
  display: block;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.cpcs-chat__title { min-width: 0; }
.cpcs-chat__title strong,
.cpcs-chat__title span { display: block; }
.cpcs-chat__title span { margin-top: 2px; font-size: 12px; opacity: .85; }
.cpcs-chat__actions { display: flex; align-items: center; gap: 6px; }
.cpcs-chat__close { border: 0; background: transparent; color: #fff; font-size: 27px; line-height: 1; cursor: pointer; }
.cpcs-chat__new { display: none !important; }

/* 绿条下方的左右分栏容器 */
.cpcs-chat__body {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-width: 0;
  min-height: 0;
}

.cpcs-chat__sidebar {
  flex: 0 0 var(--cpcs-sidebar-w);
  width: var(--cpcs-sidebar-w);
  background: #f5f7f6;
  border-right: 1px solid #dde5e3;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 12px;
  gap: 18px;
}

.cpcs-chat__channel,
.cpcs-chat button.cpcs-chat__channel {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  text-decoration: none;
  color: #333 !important;
  font: inherit;
  font-size: 11px;
  line-height: 1.2;
  box-shadow: none !important;
  cursor: pointer;
}

.cpcs-chat__channel:hover,
.cpcs-chat button.cpcs-chat__channel:hover,
.cpcs-chat button.cpcs-chat__channel:focus-visible {
  opacity: .75;
  background: transparent !important;
  color: #333 !important;
  outline: none;
}

.cpcs-chat__channel-icon svg { display: block; width: 24px; height: 24px; }
.cpcs-chat__channel-label { line-height: 1.2; text-align: center; }

.cpcs-chat__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.cpcs-chat__main .cpcs-chat__messages { flex: 1; }

.cpcs-chat__messages {
  overflow-y: auto;
  padding: 18px;
  background: #f6f9f8;
}

.cpcs-chat__message {
  max-width: 88%;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 7px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cpcs-chat__message--assistant { background: #fff; border: 1px solid #dde5e3; }
.cpcs-chat__message--user { margin-left: auto; background: #dcefe9; }
.cpcs-chat__message a { color: #075ed1; font-weight: 700; text-decoration: underline; }
.cpcs-chat__message--markdown { white-space: normal; }
.cpcs-chat__message--markdown p { margin: 0 0 8px; }
.cpcs-chat__message--markdown p:last-child { margin-bottom: 0; }
.cpcs-chat__message--markdown a {
  display: block;
  margin: 3px 0;
  padding: 5px 12px;
  background: #f0f7f4;
  border: 1px solid #b8dcc9;
  border-radius: 4px;
  text-align: center;
  text-decoration: none;
  color: #075ed1;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  transition: background 0.2s;
}
.cpcs-chat__message--markdown a:hover {
  background: #dcefe9;
}

.cpcs-chat__suggestions {
  display: grid;
  gap: 8px;
  margin: 2px 0 12px;
}

.cpcs-chat .cpcs-chat__suggestions button {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 42px;
  height: auto;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--cpcs-accent);
  border-radius: 6px;
  background: #fff;
  color: var(--cpcs-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  text-transform: none;
  text-decoration: none;
  white-space: normal;
  box-shadow: none;
  cursor: pointer;
}

.cpcs-chat .cpcs-chat__suggestions button:hover,
.cpcs-chat .cpcs-chat__suggestions button:focus-visible {
  background: #e9f5f1;
  color: var(--cpcs-accent);
  border-color: var(--cpcs-accent);
  box-shadow: none;
  transform: none;
  outline: 2px solid transparent;
}

.cpcs-chat__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #dde5e3;
  background: #fff;
}

.cpcs-chat__form textarea {
  width: 100%;
  min-height: 44px;
  max-height: 110px;
  resize: vertical;
  border: 1px solid #b8c7c3;
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
}

.cpcs-chat__form button {
  min-width: 66px;
  border: 0;
  border-radius: 6px;
  background: var(--cpcs-accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.cpcs-chat__form button:disabled { opacity: .55; cursor: wait; }
.cpcs-chat__notice { margin: 0; padding: 0 12px 11px; font-size: 11px; line-height: 1.35; color: #61706c; background: #fff; }

/* 复制成功悬浮提示条 */
.cpcs-chat__toast {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translate(-50%, -6px);
  z-index: 10;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(23, 35, 33, .92);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
}

.cpcs-chat__toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 520px) {
  html.cpcs-chat-open,
  html.cpcs-chat-open body { overscroll-behavior: none; }

  .cpcs-chat {
    right: 0;
    bottom: clamp(150px, 24vh, 230px);
  }

  .cpcs-chat__toggle {
    width: 50px;
    height: 58px;
    border-radius: 29px 0 0 29px;
    transform: translateX(9px);
    transition: transform .2s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  }

  .cpcs-chat__toggle:focus,
  .cpcs-chat__toggle:hover { transform: translateX(0); }
  .cpcs-chat[data-open="true"] .cpcs-chat__toggle { display: none; }

  .cpcs-chat__panel {
    position: fixed;
    top: calc(var(--cpcs-viewport-top, 0px) + 8px);
    right: 8px;
    bottom: auto;
    left: 8px;
    width: auto;
    height: calc(var(--cpcs-viewport-height, 100dvh) - 16px);
    max-height: none;
    flex-direction: column;
  }

  .cpcs-chat__body {
    flex-direction: column-reverse;
  }

  .cpcs-chat__sidebar {
    flex: 0 0 auto;
    width: auto;
    min-height: 56px;
    background: #f5f7f6;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    border-right: 0;
    border-top: 1px solid #dde5e3;
    padding: 15px 8px max(15px, env(safe-area-inset-bottom));
    gap: 14px;
  }

  .cpcs-chat__channel,
  .cpcs-chat button.cpcs-chat__channel {
    flex-direction: row;
    gap: 5px;
    font-size: 12px;
  }

  .cpcs-chat__header { padding: 12px 15px; }
  .cpcs-chat__messages { min-height: 0; padding: 14px; }
  .cpcs-chat__form { position: relative; padding: 10px; }
  .cpcs-chat__form textarea { font-size: 16px; resize: none; }
  .cpcs-chat__notice {
    font-size: 10px;
    line-height: 1.3;
    padding: 0 10px 9px;
  }
}
.cpcs-chat__new {
  display: none;
}

