.cesipc-ai-widget,
.cesipc-ai-widget * {
  box-sizing: border-box;
}

.cesipc-ai-widget {
  position: fixed;
  right: 20px;
  top: 42%;
  z-index: 9998;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  text-indent: 0;
}

.cesipc-ai-launcher {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #16a34a;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(22, 163, 74, .28), 0 2px 4px rgba(22, 163, 74, .14);
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}

.cesipc-ai-launcher:hover {
  background: #12813b;
  transform: scale(1.08);
  box-shadow: 0 10px 26px rgba(22, 163, 74, .36), 0 4px 8px rgba(22, 163, 74, .18);
}

.cesipc-ai-panel {
  position: absolute;
  right: 76px;
  top: 50%;
  transform: translateY(-50%);
  width: min(390px, calc(100vw - 120px));
  height: min(620px, calc(100vh - 120px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(22, 32, 51, .18);
}

.cesipc-ai-panel[hidden] {
  display: none;
}

.cesipc-ai-header {
  min-height: 62px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #dbe3ee;
  background: #fff;
}

.cesipc-ai-title {
  color: #162033;
  font-size: 16px;
  font-weight: 780;
  line-height: 1.35;
}

.cesipc-ai-subtitle {
  margin-top: 2px;
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.cesipc-ai-close {
  width: 34px;
  height: 34px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #667085;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.cesipc-ai-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  background: #f7f9fc;
}

.cesipc-ai-welcome {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #162033;
  line-height: 1.55;
}

.cesipc-ai-welcome span {
  color: #667085;
  font-size: 13px;
}

.cesipc-ai-quick {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.cesipc-ai-quick button {
  min-height: 36px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #304057;
  font-size: 13px;
  text-align: left;
  padding: 0 10px;
  cursor: pointer;
}

.cesipc-ai-quick button:hover {
  border-color: #16a34a;
  color: #12813b;
  background: #eefdf3;
}

.cesipc-ai-msg {
  display: flex;
  margin: 0 0 12px;
  text-indent: 0;
}

.cesipc-ai-msg--user {
  justify-content: flex-end;
}

.cesipc-ai-bubble {
  max-width: 88%;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: #162033;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  text-indent: 0;
}

.cesipc-ai-msg--user .cesipc-ai-bubble {
  border-color: #16a34a;
  background: #16a34a;
  color: #fff;
}

.cesipc-ai-bubble p {
  margin: 0 0 8px;
  padding: 0;
  text-indent: 0;
}

.cesipc-ai-bubble p:last-child {
  margin-bottom: 0;
}

.cesipc-ai-bubble strong {
  color: #12813b;
  font-weight: 760;
}

.cesipc-ai-msg--user .cesipc-ai-bubble strong {
  color: #fff;
}

.cesipc-ai-bubble a {
  color: #12813b;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cesipc-ai-products {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
}

.cesipc-ai-product {
  max-width: 88%;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  padding: 9px 11px;
  text-indent: 0;
}

.cesipc-ai-product strong {
  display: block;
  color: #162033;
  font-size: 13px;
  line-height: 1.45;
}

.cesipc-ai-product span {
  display: block;
  margin-top: 2px;
  color: #667085;
  font-size: 12px;
}

.cesipc-ai-product a {
  display: inline-flex;
  margin-top: 7px;
  color: #12813b;
  font-size: 13px;
  font-weight: 700;
}

.cesipc-ai-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #dbe3ee;
  background: #fff;
}

.cesipc-ai-composer textarea {
  width: 100%;
  min-height: 40px;
  max-height: 112px;
  height: auto;
  resize: none;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  outline: none;
  padding: 9px 10px;
  color: #162033;
  font-size: 14px;
  line-height: 1.5;
  text-indent: 0;
}

.cesipc-ai-composer textarea:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .1);
}

.cesipc-ai-composer button {
  min-width: 68px;
  border: 1px solid #16a34a;
  border-radius: 8px;
  background: #16a34a;
  color: #fff;
  cursor: pointer;
}

.cesipc-ai-composer button:disabled {
  opacity: .65;
  cursor: wait;
}

.cesipc-ai-foot {
  padding: 0 12px 10px;
  color: #667085;
  background: #fff;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

@media (max-width: 768px) {
  .cesipc-ai-widget {
    display: none;
  }
}
