.tool-list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.tool-add-wrap {
  position: relative;
}
.tool-add-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 10;
}
.tool-add-menu .add-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f3f5;
}
.tool-add-menu .add-item:last-child { border-bottom: none; }
.tool-add-menu .add-item:hover { background: #f8f9fa; }
.tool-add-menu .add-item .add-item-name {
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: 13px;
  font-weight: 600;
}
.tool-add-menu .add-item .add-item-desc {
  font-size: 12px;
  color: #6c757d;
  margin-top: 2px;
}

.instance-list {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
}
.instance-list .instance-row {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f3f5;
  cursor: pointer;
  gap: 10px;
}
.instance-list .instance-row:last-child { border-bottom: none; }
.instance-list .instance-row:hover { background: #fafbfc; }
.instance-list .instance-row.selected { background: #ede7ff; }
.instance-list .instance-name {
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.instance-list .instance-base {
  font-size: 11px;
  color: #6c757d;
}
.instance-list .instance-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e9ecef;
  color: #6c757d;
}
.instance-list .instance-status.on {
  background: #d4edda;
  color: #155724;
}
.empty-state {
  padding: 30px;
  text-align: center;
  color: #6c757d;
  font-size: 14px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e9ecef;
}
.detail-header-actions {
  display: flex;
  gap: 6px;
}
.form-row-inline {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.form-row-inline .form-group {
  flex: 0 0 auto;
}
.code-area {
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: 12px;
}
.code-preview {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  max-height: 220px;
  overflow: auto;
  margin: 0;
}
.form-btn-group {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid #e9ecef;
}

.custom-admin-mount {
  margin-top: 20px;
}
.custom-admin-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: #6c757d;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.custom-admin-divider::before,
.custom-admin-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e9ecef;
}
.custom-admin-placeholder {
  padding: 20px;
  text-align: center;
  background: #f8f9fa;
  border: 1px dashed #dee2e6;
  border-radius: 8px;
  color: #6c757d;
  font-size: 13px;
}
.gallery-section {
  margin-top: 20px;
}
.preview-wrap {
  margin-top: 8px;
  padding: 6px;
  border: 1px dashed #dee2e6;
  border-radius: 6px;
  background: #fafbfc;
}
#g-preview-img {
  max-width: 100%;
  max-height: 200px;
  display: block;
  margin: 0 auto;
}
.gallery-search-test {
  margin-top: 20px;
}
.gallery-search-result {
  margin-top: 10px;
}
.gallery-search-result .sr-card {
  display: flex;
  gap: 10px;
  padding: 8px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #fafbfc;
}
.gallery-search-result .sr-card img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
}
.gallery-search-result .sr-body {
  flex: 1;
  min-width: 0;
}
.gallery-search-result .sr-score {
  font-weight: 600;
  color: #6f42c1;
}
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  margin-bottom: 10px;
}
.gallery-count {
  font-size: 12px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.gallery-item {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.gallery-item .gi-img-wrap {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f8f9fa;
}
.gallery-item .gi-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-item .gi-body {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.gallery-item textarea.gi-desc {
  width: 100%;
  font-size: 11px;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 3px 5px;
  resize: vertical;
  min-height: 40px;
  font-family: inherit;
}
.gallery-item textarea.gi-desc:focus {
  outline: none;
  border-color: #6f42c1;
}
.gallery-item .gi-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  margin-top: auto;
}
.gallery-item .gi-actions button {
  padding: 2px 6px;
  font-size: 10px;
}
.gallery-item.extended {
  grid-column: span 2;
}
.gallery-item .gi-field {
  width: 100%;
  font-size: 11px;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 3px 5px;
  font-family: inherit;
}
.gallery-item .gi-field:focus {
  outline: none;
  border-color: #6f42c1;
}
.gallery-item .gi-title { font-weight: 600; }
.gallery-grid {
  grid-auto-rows: minmax(min-content, auto);
}
