/* config.css - 配置页面样式 */

/* ===== 配置弹窗 ===== */
.config-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(44, 44, 44, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: configFadeIn 0.2s ease;
}

@keyframes configFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.config-modal-content {
  background: var(--bg-secondary);
  border-radius: 16px;
  width: 90%;
  max-width: 820px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow:
    4px 6px 0px rgba(60, 50, 30, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.12);
  border: 1.5px solid var(--border-sketch);
  animation: configSlideUp 0.25s ease;
}

@keyframes configSlideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===== 头部 ===== */
.config-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  flex-shrink: 0;
}

.config-modal-header h3 {
  font-family: var(--font-hand);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
}

.config-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--text-tertiary);
  transition: all var(--transition);
}

.config-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.config-modal-close svg {
  width: 20px;
  height: 20px;
}

/* ===== Tab 导航 ===== */
.config-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 24px 0;
  border-bottom: 1.5px dashed var(--border-color);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
}

.config-tab-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}

.config-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.config-tab-btn.active {
  color: var(--accent-primary);
  font-weight: 600;
}

.config-tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1.5px;
  left: 20%;
  right: 20%;
  height: 2.5px;
  background: var(--accent-primary);
  border-radius: 2px;
}

/* ===== Tab 面板 ===== */
.config-panels {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  min-height: 0;
}

.config-panel {
  display: none;
}

.config-panel.active {
  display: block;
}

/* ===== 表单元素 ===== */
.config-section {
  margin-bottom: 24px;
}

.config-section-title {
  font-family: var(--font-hand);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-color);
}

.config-field {
  margin-bottom: 14px;
}

.config-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.config-input {
  width: 100%;
  padding: 8px 12px;
  height: 36px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.config-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.config-input::placeholder {
  color: var(--text-tertiary);
}

.config-input.small {
  width: 120px;
}

.config-input-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.config-input-group .config-input {
  flex: 1;
}

.config-fetch-models-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    border-color var(--transition),
    color var(--transition);
}

.config-fetch-models-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.config-fetch-models-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.config-fetch-models-btn.loading svg {
  animation: spin 0.8s linear infinite;
}

.config-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.config-row .config-field {
  flex: 1;
}

.config-select {
  width: 100%;
  padding: 8px 12px;
  height: 36px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
}

.config-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ===== 自定义下拉选择器 ===== */
.fk-select {
  position: relative;
  width: 100%;
}

.fk-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  user-select: none;
  height: 36px;
}

.fk-select-trigger:hover {
  border-color: var(--accent-secondary);
}

.fk-select.open .fk-select-trigger,
.fk-select-trigger:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.fk-select-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fk-select-arrow {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--accent-primary);
  transition: transform 0.2s ease;
  margin-left: 8px;
  opacity: 0.8;
}

.fk-select-arrow svg {
  width: 16px;
  height: 16px;
}

.fk-select.open .fk-select-arrow {
  transform: rotate(180deg);
}

.fk-select-dropdown {
  position: fixed;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-sketch);
  border-radius: var(--radius);
  box-shadow:
    2px 4px 0px rgba(60, 50, 30, 0.1),
    0 8px 20px rgba(0, 0, 0, 0.08);
  z-index: 10000;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  animation: fkSelectFadeIn 0.15s ease;
}

@keyframes fkSelectFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fk-select-option {
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
}

.fk-select-option:hover {
  background: var(--bg-tertiary);
}

.fk-select-option.active {
  background: var(--accent-light);
  color: var(--accent-primary);
  font-weight: 500;
}

.fk-select-option.disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.5;
}

.fk-select-dropdown::-webkit-scrollbar {
  width: 4px;
}

.fk-select-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.fk-select-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* ===== Toggle 开关 ===== */
.config-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-tertiary);
}

.config-toggle-row:last-child {
  border-bottom: none;
}

.config-toggle-label {
  font-size: 13px;
  color: var(--text-primary);
}

.config-toggle-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.config-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.config-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.config-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border-color);
  border-radius: 24px;
  transition: all 0.3s ease;
  border: 1.5px solid var(--border-sketch);
}

.config-toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 1.5px;
  background: var(--bg-secondary);
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.config-toggle input:checked+.config-toggle-slider {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.config-toggle input:checked+.config-toggle-slider::before {
  transform: translateX(20px);
}

/* ===== 模型卡片（折叠面板） ===== */
.config-model-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-model-card {
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: all var(--transition);
}

.config-model-card:hover {
  border-color: var(--accent-secondary);
}

.config-model-card.open {
  box-shadow: var(--shadow-sketch);
}

.config-model-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.config-model-header:hover {
  background: var(--bg-tertiary);
}

.config-model-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.config-model-title {
  font-family: var(--font-hand);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.config-model-info {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.config-model-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.config-model-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.config-model-card.open .config-model-arrow {
  transform: rotate(180deg);
}

.config-model-body {
  display: none;
  padding: 4px 16px 16px;
}

.config-model-card.open .config-model-body {
  display: block;
}

.config-model-card .config-row {
  flex-wrap: wrap;
}

.config-model-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.config-model-remove:hover {
  color: var(--error);
  background: var(--error-light);
}

.config-model-remove svg {
  width: 16px;
  height: 16px;
}

.config-model-default-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  background: var(--accent-light);
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.config-model-set-default {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.config-model-set-default:hover:not(:disabled) {
  color: var(--accent-primary);
  background: var(--accent-light);
}

.config-model-set-default:disabled {
  cursor: default;
  opacity: 1;
}

.config-model-set-default svg {
  width: 16px;
  height: 16px;
}

.config-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.config-add-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
}

.config-add-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== 自定义智能体卡片 ===== */
.agent-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.agent-card {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  position: relative;
  cursor: pointer;
  transition: all 0.25s ease;
  overflow: hidden;
}

.agent-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-primary);
  border-radius: 14px 0 0 14px;
}

.agent-card:hover {
  transform: translateY(-3px);
  box-shadow:
    3px 5px 0px rgba(60, 50, 30, 0.1),
    0 8px 20px rgba(0, 0, 0, 0.06);
  border-color: var(--accent-secondary);
}

.agent-card-name {
  font-family: var(--font-hand);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  padding-left: 8px;
}

.agent-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-left: 8px;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agent-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-left: 8px;
}

.agent-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
}

.agent-card-tag.model-tag {
  background: var(--accent-light);
  color: var(--accent-primary);
}

.agent-card-tag.tool-tag {
  background: var(--success-light);
  color: var(--success);
}

.agent-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.agent-card:hover .agent-card-actions {
  opacity: 1;
}

.agent-card-action-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-tertiary);
  transition: all var(--transition);
}

.agent-card-action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.agent-card-action-btn.delete:hover {
  color: var(--error);
  background: var(--error-light);
}

.agent-card-action-btn svg {
  width: 14px;
  height: 14px;
}

/* 新增卡片 */
.agent-card-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 2px dashed var(--border-color);
  border-radius: 14px;
  background: none;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-tertiary);
}

.agent-card-add:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
  transform: translateY(-2px);
}

.agent-card-add svg {
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
}

.agent-card-add span {
  font-size: 12px;
  font-weight: 500;
}

/* ===== 智能体编辑弹窗 ===== */
.agent-edit-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(44, 44, 44, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-edit-panel {
  background: var(--bg-secondary);
  border-radius: 14px;
  width: 90%;
  max-width: 540px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 4px 6px 0px rgba(60, 50, 30, 0.1);
  border: 1.5px solid var(--border-sketch);
}

.agent-edit-title {
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.config-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.config-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* 工具多选 */
.config-tools-select {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  min-height: 40px;
}

.config-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  user-select: none;
}

.config-tool-chip:hover {
  border-color: var(--accent-secondary);
}

.config-tool-chip.selected {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* ===== 底部按钮 ===== */
.config-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1.5px dashed var(--border-color);
  flex-shrink: 0;
}

.config-btn {
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border-color);
}

.config-btn-cancel {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.config-btn-cancel:hover {
  background: var(--bg-hover);
}

.config-btn-save {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.config-btn-save:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.config-btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.agent-edit-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ===== 通道折叠面板 ===== */
.config-collapse {
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.config-collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  user-select: none;
  transition: background var(--transition);
}

.config-collapse-header:hover {
  background: var(--bg-hover);
}

.config-collapse-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  color: var(--text-tertiary);
}

.config-collapse.open .config-collapse-arrow {
  transform: rotate(180deg);
}

.config-collapse-body {
  display: none;
  padding: 14px;
}

.config-collapse.open .config-collapse-body {
  display: block;
}

/* ===== MCP Tab ===== */

.mcp-container { display: flex; flex-direction: column; gap: 14px; }

.mcp-toolbar {
  display: flex; align-items: center; justify-content: space-between;
}

.mcp-count { font-size: 13px; color: var(--text-secondary); font-family: var(--font-hand); }

.mcp-add-btn {
  padding: 6px 14px; font-size: 13px; font-family: var(--font-hand);
  background: var(--accent-primary); color: white;
  border: none; border-radius: 8px; cursor: pointer;
  transition: all var(--transition);
}
.mcp-add-btn:hover { opacity: 0.9; box-shadow: var(--shadow-sketch); }

.mcp-list { display: flex; flex-direction: column; gap: 8px; }

.mcp-card {
  padding: 12px 14px; background: var(--bg-tertiary);
  border: 2px solid var(--border-color); border-radius: 10px;
  display: flex; align-items: center; gap: 12px;
  transition: all var(--transition);
}
.mcp-card:hover { border-color: var(--accent-primary); }

.mcp-card-info { flex: 1; min-width: 0; }
.mcp-card-name { font-size: 14px; font-weight: 600; }
.mcp-card-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.mcp-card-meta {
  font-size: 11px; color: var(--text-tertiary); font-family: monospace; margin-top: 2px;
}

.mcp-card-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.mcp-toggle {
  width: 40px; height: 22px; border-radius: 11px;
  border: 2px solid var(--border-color); background: var(--bg-primary);
  cursor: pointer; position: relative; transition: all var(--transition);
}
.mcp-toggle.on { background: var(--success); border-color: var(--success); }
.mcp-toggle::after {
  content: ""; position: absolute;
  top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--border-color);
  transition: all var(--transition);
}
.mcp-toggle.on::after { left: 20px; background: white; }

.mcp-card-btn {
  padding: 4px 10px; font-size: 12px; font-family: var(--font-hand);
  background: transparent; border-radius: 6px; cursor: pointer;
  transition: all var(--transition);
}
.mcp-edit-btn { border: 1.5px solid var(--accent-primary); color: var(--accent-primary); }
.mcp-edit-btn:hover { background: var(--accent-primary); color: white; }

/* Editor panel */
.mcp-editor {
  padding: 16px; background: var(--bg-tertiary);
  border: 2px solid var(--border-sketch); border-radius: 12px;
  animation: fadeIn 0.2s ease;
}

.mcp-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; font-family: var(--font-hand); font-size: 16px;
}
.mcp-editor-close {
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1.5px solid var(--border-color);
  border-radius: 6px; cursor: pointer; font-size: 15px;
  color: var(--text-secondary); transition: all var(--transition);
}
.mcp-editor-close:hover { background: var(--bg-hover); }

.mcp-editor-body { display: flex; flex-direction: column; gap: 12px; }

.mcp-field { display: flex; flex-direction: column; gap: 4px; }
.mcp-field label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  font-family: var(--font-body);
}
.mcp-field-row { flex-direction: row; align-items: center; gap: 10px; }
.mcp-field-row label { min-width: 60px; }

.mcp-input, .mcp-select, .mcp-textarea {
  padding: 7px 10px; border: 2px solid var(--border-color);
  border-radius: 8px; background: var(--bg-primary);
  font-size: 13px; font-family: var(--font-body); color: var(--text-primary);
  outline: none; transition: all var(--transition);
}
.mcp-input:focus, .mcp-select:focus, .mcp-textarea:focus { border-color: var(--accent-primary); }
.mcp-input-sm { max-width: 100px; }
.mcp-select { cursor: pointer; }
.mcp-textarea { resize: vertical; font-family: monospace; font-size: 12px; }

.mcp-editor-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; margin-top: 8px; padding-top: 14px;
  border-top: 1.5px dashed var(--border-color);
}

.mcp-editor-delete {
  padding: 6px 14px; font-size: 12px; font-family: var(--font-hand);
  background: transparent; border: 1.5px solid var(--error);
  border-radius: 8px; color: var(--error); cursor: pointer;
  margin-right: auto; transition: all var(--transition);
}
.mcp-editor-delete:hover { background: var(--error); color: white; }

.mcp-editor-save {
  padding: 6px 18px; font-size: 13px; font-family: var(--font-hand);
  background: var(--accent-primary); color: white;
  border: none; border-radius: 8px; cursor: pointer;
  transition: all var(--transition);
}
.mcp-editor-save:hover { opacity: 0.9; }

.mcp-empty {
  padding: 32px 16px; text-align: center;
  color: var(--text-tertiary); font-family: var(--font-hand); font-size: 15px;
}

/* ===== Skills Tab ===== */

.skills-container {
  display: flex; flex-direction: column; gap: 16px;
}

.skills-tabs {
  display: flex; gap: 4px;
  border-bottom: 1.5px dashed var(--border-color); padding-bottom: 0;
}

.skills-tab-btn {
  background: none; border: none; padding: 6px 14px; font-size: 13px;
  color: var(--text-secondary); cursor: pointer;
  border-radius: 6px 6px 0 0; font-family: var(--font-hand);
  transition: all var(--transition);
}
.skills-tab-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.skills-tab-btn.active {
  color: var(--accent-primary); font-weight: 600;
  border-bottom: 2px solid var(--accent-primary);
}

.skills-panel { display: none; }
.skills-panel.active { display: block; }

.skills-search-bar {
  display: flex; gap: 8px; margin-bottom: 16px;
}

.skills-search-input {
  flex: 1; padding: 8px 12px;
  border: 2px solid var(--border-color); border-radius: 8px;
  background: var(--bg-primary); font-size: 13px;
  font-family: var(--font-body); color: var(--text-primary);
  outline: none; transition: all var(--transition);
}
.skills-search-input:focus { border-color: var(--accent-primary); }

.skills-search-btn {
  padding: 8px 16px; font-size: 13px; font-family: var(--font-hand);
  background: var(--accent-primary); color: white;
  border: none; border-radius: 8px; cursor: pointer;
  transition: all var(--transition);
}
.skills-search-btn:hover { opacity: 0.9; box-shadow: var(--shadow-sketch); }

.skills-sort-select {
  padding: 8px 10px; border: 2px solid var(--border-color);
  border-radius: 8px; background: var(--bg-primary);
  font-size: 12px; font-family: var(--font-hand); color: var(--text-secondary);
  outline: none; cursor: pointer;
}
.skills-sort-select:focus { border-color: var(--accent-primary); }

/* Pagination */
.skills-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-top: 16px; padding-top: 12px;
  border-top: 1.5px dashed var(--border-color);
}

.skills-page-info {
  font-size: 12px; color: var(--text-tertiary); font-family: var(--font-hand);
}

.skills-page-btn {
  padding: 4px 14px; font-size: 12px; font-family: var(--font-hand);
  background: var(--bg-tertiary); border: 1.5px solid var(--border-color);
  border-radius: 6px; cursor: pointer;
  color: var(--text-secondary); transition: all var(--transition);
}
.skills-page-btn:hover {
  border-color: var(--accent-primary); color: var(--accent-primary);
}

.skills-list {
  display: flex; flex-direction: column; gap: 8px;
}

.skills-placeholder {
  padding: 32px 16px; text-align: center;
  color: var(--text-tertiary); font-family: var(--font-hand); font-size: 15px;
}

.skill-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color); border-radius: 10px;
  transition: all var(--transition);
}
.skill-card:hover {
  background: var(--bg-secondary); border-color: var(--accent-primary);
}

.skill-card-info { flex: 1; min-width: 0; }
.skill-card-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.skill-card-desc {
  font-size: 12px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.skill-card-actions { display: flex; gap: 6px; margin-left: 12px; flex-shrink: 0; }

.skill-card-btn {
  padding: 4px 12px; font-size: 12px; font-family: var(--font-hand);
  background: transparent; border-radius: 6px; cursor: pointer;
  transition: all var(--transition);
}

.skill-install-btn {
  border: 1.5px solid var(--success); color: var(--success);
}
.skill-install-btn:hover { background: var(--success); color: white; }
.skill-install-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.skill-remove-btn {
  border: 1.5px solid var(--error); color: var(--error);
}
.skill-remove-btn:hover { background: var(--error); color: white; }

.skill-installed-tag {
  padding: 4px 12px; font-size: 12px; font-family: var(--font-hand);
  color: var(--success); background: var(--success-light);
  border-radius: 6px;
}

/* File tree */
.skill-file-entry {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; border-radius: 6px; margin: 0 8px;
  font-size: 13px; transition: all var(--transition);
}
.skill-file-entry.skill-file-file,
.skill-file-entry.skill-file-dir,
.skill-file-entry.skill-file-up {
  cursor: pointer;
}
.skill-file-entry:hover { background: var(--bg-tertiary); }
.skill-file-entry.skill-file-file:hover { color: var(--accent-primary); }
.skill-file-entry.skill-file-dir:hover { color: var(--accent-primary); }
.skill-file-entry.skill-file-up { color: var(--text-secondary); }

.skill-file-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.skill-file-entry.skill-file-dir .skill-file-name::before {
  content: "> "; color: var(--accent-primary); font-weight: 600;
}
.skill-file-entry.skill-file-file .skill-file-name::before {
  content: "- "; color: var(--text-tertiary);
}
.skill-file-entry.skill-file-up .skill-file-name::before {
  content: "";  /* ".." doesn"t need prefix */
}

.skill-file-size {
  font-size: 11px; color: var(--text-tertiary); font-family: monospace;
  flex-shrink: 0; margin-left: 12px;
}

.skill-file-content {
  background: var(--bg-secondary);
  border: 2px solid var(--border-sketch);
  border-radius: 8px; padding: 14px 16px;
  font-size: 12px; line-height: 1.6;
  max-height: none; overflow: auto;
  margin: 0; white-space: pre-wrap; word-break: break-all;
}
.skill-file-content code { font-family: monospace; font-size: 12px; }

/* Skill file browser modal */
.skill-preview-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(40, 35, 25, 0.35); backdrop-filter: blur(4px);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}

.skill-preview-modal {
  background: var(--bg-secondary);
  border: 2px solid var(--border-sketch);
  border-radius: 16px; width: 90%; max-width: 640px; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 4px 6px 0px rgba(60, 50, 30, 0.12);
  animation: sketchSlideUp 0.25s ease;
}

.skill-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 2px dashed var(--border-color);
  flex-shrink: 0;
}
.skill-preview-title {
  font-family: var(--font-hand); font-size: 18px; color: var(--text-primary);
}

.skill-preview-close {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1.5px solid var(--border-color);
  border-radius: 6px; cursor: pointer; color: var(--text-secondary);
  font-size: 16px; transition: all var(--transition);
}
.skill-preview-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* Breadcrumb */
.skill-preview-paths {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0;
  padding: 10px 20px; border-bottom: 1px solid var(--border-color);
  font-family: monospace; font-size: 13px; flex-shrink: 0;
}
.skill-bc-item {
  color: var(--accent-primary); cursor: pointer; padding: 2px 4px;
  border-radius: 4px; transition: all var(--transition);
}
.skill-bc-item:hover { background: var(--accent-light); }
.skill-bc-sep { color: var(--text-tertiary); margin: 0 2px; }

/* File list */
.skill-preview-list {
  flex: 1; overflow-y: auto; padding: 8px 0; min-height: 0;
}

/* File content panel (overlays file list) */
.skill-preview-content {
  flex: 1; overflow-y: auto; padding: 16px 20px; min-height: 0;
}

.skill-bc-last { color: var(--text-primary); font-weight: 600; cursor: default; }
.skill-bc-last:hover { background: transparent; }

@media (max-width: 768px) {
  .skill-preview-modal {
    width: 100%; max-width: 100%; height: 100vh; height: 100dvh;
    max-height: none; border-radius: 0; border: none;
  }
  .skill-preview-header { padding: 12px 16px; }
  .skill-preview-paths { padding: 8px 16px; }
  .skill-preview-content { padding: 12px 16px; }
}

.skill-market-meta {
  display: flex; gap: 12px; margin-top: 4px; font-size: 11px; color: var(--text-tertiary);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .config-modal {
    align-items: flex-end;
  }

  .config-modal-content {
    width: 100%;
    height: 92vh;
    height: 92dvh;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .config-modal-header {
    padding: 16px 16px 0;
  }

  .config-modal-header h3 {
    font-size: 22px;
  }

  .config-tabs {
    padding: 12px 16px 0;
    gap: 2px;
  }

  .config-tab-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .config-panels {
    padding: 14px 16px;
  }

  .config-section-title {
    font-size: 17px;
  }

  .agent-cards-grid {
    grid-template-columns: 1fr;
  }

  .config-row {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
  }

  .config-row .config-field {
    width: 100%;
  }

  .config-input,
  .config-select,
  .config-textarea {
    font-size: 16px;
  }

  .fk-select-trigger {
    font-size: 16px;
    padding: 10px 12px;
  }

  .fk-select-option {
    padding: 10px 12px;
    font-size: 14px;
  }

  .config-input.small {
    width: 100%;
  }

  .config-model-card {
    border-radius: 10px;
  }

  .config-model-header {
    padding: 10px 12px;
  }

  .config-model-body {
    padding: 4px 12px 14px;
  }

  .config-model-card .config-row {
    flex-direction: column;
    gap: 0;
  }

  .config-model-card .config-row .config-field {
    width: 100%;
  }

  .config-toggle-row {
    padding: 12px 0;
  }

  .config-toggle-label {
    font-size: 14px;
  }

  .config-toggle-desc {
    font-size: 12px;
  }

  .config-modal-footer {
    padding: 12px 16px;
  }

  .config-btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .config-add-btn {
    padding: 14px;
    font-size: 14px;
  }

  /* 智能体编辑弹窗移动端适配 */
  .agent-edit-panel {
    width: 96%;
    max-width: 100%;
    max-height: 85vh;
    padding: 20px 16px;
  }

  .agent-edit-title {
    font-size: 20px;
  }

  .agent-card {
    padding: 14px 12px;
  }

  .agent-card-name {
    font-size: 17px;
  }

  .agent-card-actions {
    opacity: 1;
  }

  .config-collapse-header {
    padding: 12px 14px;
    font-size: 14px;
  }

  .config-collapse-body {
    padding: 12px;
  }
}

/* ===== 模板变量补全下拉 ===== */
.template-var-dropdown {
  display: none;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-sketch);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  max-height: 180px;
  overflow-y: auto;
  padding: 4px 0;
}

.template-var-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.1s;
}

.template-var-item:hover,
.template-var-item.active {
  background: var(--accent-light);
}

.template-var-name {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  color: var(--accent-primary);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.template-var-desc {
  color: var(--text-secondary);
  font-size: 12px;
}