.panel {
  width: 100%;
  height: 100%;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  box-shadow: -1px 0 0 0 var(--border-light);
}

.header {
  height: var(--topbar-height);
  padding: 0 var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.close {
  border: none;
  background: transparent;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.close:hover {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
}

.content {
  padding: var(--space-lg);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.sectionTitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: var(--space-lg) 0 var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
}

.sectionTitle:first-child {
  margin-top: 0;
}

.section {
  margin-bottom: var(--space-lg);
}

.label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.value {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  word-break: break-all;
  overflow-wrap: anywhere;
  background: var(--bg-surface-hover);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  white-space: pre-wrap;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.value * {
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
  white-space: pre-wrap;
}

.value pre,
.value code {
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  overflow-x: auto;
  max-width: 100%;
}

.value p {
  margin: 1em 0;
}

.value p:first-child {
  margin-top: 0;
}

.value p:last-child {
  margin-bottom: 0;
}

.toolCalls {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toolCall {
  background: var(--bg-node-goal);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
}

.toolName {
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
  font-size: 13px;
}

.toolArgs {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.5);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-all;
  overflow-x: auto;
  max-width: 100%;
  color: var(--text-secondary);
}

.toolResult {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  overflow: hidden;
}

.resultContent {
  overflow-x: auto;
  max-width: 100%;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.messageItem {
  border-left: 2px solid var(--border-medium);
  padding-left: var(--space-md);
}

.knowledgeList {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.knowledgeItem {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  transition: all var(--transition-fast);
}

.knowledgeItem:hover {
  border-color: var(--color-primary-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.knowledgeHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.knowledgeId {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.knowledgeMetrics {
  display: flex;
  gap: var(--space-md);
  font-size: 13px;
}

.metricScore {
  color: #f59e0b; /* Amber 500 */
  font-weight: 500;
}

.metricQuality {
  color: #8b5cf6; /* Purple 500 */
  font-weight: 500;
}

.metricHelpful {
  color: #10b981; /* Emerald 500 */
  font-weight: 500;
}

.metricHarmful {
  color: #ef4444; /* Red 500 */
  font-weight: 500;
}

.knowledgeTags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.knowledgeScenario {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px dashed var(--border-light);
}

.knowledgeContent {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
}

.knowledgeContent p {
  margin: 0;
}

.reasoningBlock {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  overflow: hidden;
}

.reasoningToggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-hover);
  transition: background var(--transition-fast);
}

.reasoningToggle:hover {
  background: var(--bg-surface);
}

.reasoningIcon {
  font-size: 10px;
  color: var(--text-tertiary);
}

.reasoningLen {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
}

.reasoningContent {
  padding: var(--space-md);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.3);
}

.reasoningContent p {
  margin: 0.5em 0;
}

.reasoningContent p:first-child {
  margin-top: 0;
}

.reasoningContent p:last-child {
  margin-bottom: 0;
}

.createKnowledgeBar {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-panel);
  flex-shrink: 0;
}

.createKnowledgeBtn {
  width: 100%;
  height: 34px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.createKnowledgeBtn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}
