* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f3f5f5;
}

.cw-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  background: #fff;
}

.cw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #16202b;
  color: #fff;
  flex-shrink: 0;
}

.cw-new-chat-btn {
  flex-shrink: 0;
  /* Panel bao ngoài (mu-plugin trên trang thật) có sẵn 1 nút đóng (✕) đặt
     absolute ở góc trên-phải của toàn panel (top:8px, right:8px, 28px) —
     đè lên phần header của iframe. Margin-right đủ lớn để nút "+" này
     không bị nút đóng bên ngoài che mất khi nhúng thật. */
  margin-right: 32px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.cw-new-chat-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.cw-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cw-avatar {
  font-size: 22px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #4175fc;
  border-radius: 50%;
  flex-shrink: 0;
}

.cw-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.cw-subtitle {
  margin: 0;
  font-size: 12px;
  color: #b7c0cb;
}

.cw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cw-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.cw-msg p {
  margin: 0;
}

.cw-msg-bot {
  align-self: flex-start;
  background: #f3f5f5;
  color: #16202b;
  border-bottom-left-radius: 4px;
}

.cw-msg-user {
  align-self: flex-end;
  background: #4175fc;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cw-msg-error {
  align-self: flex-start;
  background: #fdecea;
  color: #a4272c;
  border: 1px solid #f6c6c6;
}

.cw-card-wrap {
  align-self: flex-start;
  max-width: 88%;
}

.cw-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(20, 30, 40, 0.06);
}

.cw-card-title {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 700;
  color: #16202b;
}

.cw-card-desc {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #4b5563;
}

.cw-tech-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cw-tech-pill {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef1f5;
  color: #374151;
}

.cw-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cw-card-btn {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: #4175fc;
  color: #fff;
  text-decoration: none;
  transition: background 0.15s;
}

.cw-card-btn:hover {
  background: #2f5ce0;
}

.cw-status {
  min-height: 20px;
  padding: 0 16px;
  font-size: 12.5px;
  color: #8a97a3;
}

.cw-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.cw-input {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d7dbe0;
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
}

.cw-input:focus {
  border-color: #4175fc;
}

.cw-send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #4175fc;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.cw-send-btn:hover {
  background: #2f5ce0;
}

.cw-send-btn:disabled {
  background: #c7d3f8;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .cw-msg { max-width: 92%; font-size: 14px; }
  .cw-title { font-size: 14px; }
}
