#cc-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999998;
  background: #1e1e1e;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
#cc-toggle:hover {
  background: #333;
}

#cc-panel {
  position: fixed;
  bottom: 0;
  right: 20px;
  z-index: 999999;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 480px;
  max-height: calc(100vh - 24px);
  background: #1e1e1e;
  color: #eee;
  border-radius: 12px 12px 0 0;
  display: none;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13.5px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
#cc-panel.cc-open {
  display: flex;
}

#cc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #151515;
  font-weight: 600;
  flex-shrink: 0;
}
#cc-header button {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
}
#cc-header button:hover {
  background: #2a2a2a;
  color: #fff;
}

#cc-token-box {
  padding: 14px;
  background: #262626;
  flex-shrink: 0;
}
#cc-token-box p {
  margin: 0 0 8px;
  color: #ccc;
}
#cc-token-box input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #1a1a1a;
  color: #fff;
  margin-bottom: 8px;
}
#cc-token-box button {
  background: #2f80ed;
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
}

#cc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cc-bubble {
  position: relative;
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.cc-rewind-btn {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cc-bubble.cc-user:hover .cc-rewind-btn {
  display: flex;
}
.cc-rewind-btn:hover {
  background: #2f80ed;
  border-color: #2f80ed;
}
.cc-bubble-text {
  white-space: pre-wrap;
}
.cc-bubble-meta {
  margin-top: 4px;
  font-size: 10.5px;
  opacity: 0.55;
}
.cc-user {
  align-self: flex-end;
  background: #2f80ed;
  color: #fff;
  border-bottom-right-radius: 2px;
}
.cc-assistant {
  align-self: flex-start;
  background: #2f2f2f;
  border-bottom-left-radius: 2px;
}
.cc-thinking {
  opacity: 0.6;
  font-style: italic;
}
.cc-system {
  align-self: center;
  background: transparent;
  color: #888;
  font-size: 12px;
  font-style: italic;
}
.cc-error {
  align-self: flex-start;
  background: #4a1f1f;
  color: #ff9c9c;
  border-bottom-left-radius: 2px;
}

.cc-bubble-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.cc-bubble-images img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

#cc-attachments {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 10px 0;
  background: #151515;
  flex-shrink: 0;
}
.cc-attachment-chip {
  position: relative;
  width: 52px;
  height: 52px;
}
.cc-attachment-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.cc-attachment-chip button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d4403a;
  color: #fff;
  border: none;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

#cc-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  background: #151515;
  flex-shrink: 0;
}
#cc-attach {
  background: none;
  border: none;
  color: #ccc;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
#cc-attach:hover {
  background: #2a2a2a;
}
#cc-input {
  flex: 1;
  resize: none;
  border-radius: 8px;
  border: 1px solid #3a3a3a;
  background: #1a1a1a;
  color: #fff;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13.5px;
  max-height: 90px;
}
#cc-send {
  background: #2f80ed;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 13.5px;
}
#cc-send:hover {
  background: #1c66c9;
}
#cc-send:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 480px) {
  #cc-panel {
    right: 0;
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
  }
}
