:root #tool-body {
  --bg-color: #f5f7fa;
  --card-bg: #ffffff;
  --primary: #16baaa;
  --danger: #ff5722;
  --dark-item: #2b2d36;
  --border-color: #eee;
  --text-muted: #999;
  --text-color: #333;
  --code-bg: #1e1e2e;
  --log-text: #a6e3a1;
}
.theme-dark-mode #tool-body {
  --bg-color: #1a1a2e;
  --card-bg: #2b2b2b;
  --border-color: #444;
  --text-muted: #777;
  --text-color: #ddd;
  --code-bg: #141420;
}

#tool-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-color);
}

/* === 上传区 === */
#tool-body .upload-area {
  padding: 36px 20px;
  text-align: center;
  border-radius: 10px;
  border: 2px dashed #d0d5dd;
  cursor: pointer;
  transition: .3s;
  display: block;
  color: inherit;
  background: var(--card-bg);
}
#tool-body .upload-area:hover { border-color: var(--primary); }
.theme-dark-mode #tool-body .upload-area { border-color: #555; }
#tool-body .upload-icon { font-size: 44px; color: var(--primary); margin-bottom: 8px; }
#tool-body .upload-area h3 { margin: 0 0 6px; font-size: 16px; }
#tool-body .upload-area p { color: var(--text-muted); font-size: 13px; margin: 0; }

/* === 文件列表 === */
#tool-body .file-list-wrap { margin-top: 16px; }
#tool-body .section-title {
  margin: 20px 0 12px;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-color);
}
#tool-body .clear-btn { font-size: 13px; color: var(--danger); cursor: pointer; font-weight: normal; }

#tool-body .file-item {
  background: var(--dark-item);
  color: #fff;
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
#tool-body .file-item-icon { font-size: 24px; color: var(--primary); flex-shrink: 0; }
#tool-body .file-item-info { flex: 1; min-width: 0; }
#tool-body .file-item-name { font-size: 13px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tool-body .file-item-meta { font-size: 11px; color: #bbb; margin-top: 2px; }
#tool-body .file-alias-badge {
  background: rgba(22, 186, 170, 0.2);
  border: 1px solid rgba(22, 186, 170, 0.5);
  color: #16baaa;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 3px;
  font-family: monospace;
  flex-shrink: 0;
  cursor: pointer;
}
#tool-body .file-alias-badge:hover { background: rgba(22,186,170,0.35); }
#tool-body .file-del-btn {
  color: #ff5722;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.6;
  transition: 0.2s;
  padding: 5px;
  flex-shrink: 0;
}
#tool-body .file-del-btn:hover { opacity: 1; transform: scale(1.1); }

/* === 命令区 === */
#tool-body .cmd-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  margin-top: 20px;
}
.theme-dark-mode #tool-body .cmd-section { border-color: #444; }
#tool-body .cmd-label { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
#tool-body .cmd-label b { color: var(--text-color); }
#tool-body .cmd-input-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg);
  transition: border-color 0.2s;
}
#tool-body .cmd-input-row:focus-within { border-color: var(--primary); }
.theme-dark-mode #tool-body .cmd-input-row { border-color: #555; background: #222; }
#tool-body .cmd-prefix {
  padding: 0 14px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  color: var(--primary);
  background: rgba(22,186,170,0.08);
  height: 44px;
  display: flex;
  align-items: center;
  border-right: 1.5px solid var(--border-color);
  flex-shrink: 0;
  user-select: none;
}
.theme-dark-mode #tool-body .cmd-prefix { border-right-color: #555; background: rgba(22,186,170,0.12); }
#tool-body #cmdInput {
  flex: 1;
  height: 44px;
  border: none;
  outline: none;
  padding: 0 14px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: transparent;
  color: var(--text-color);
}

#tool-body .template-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
#tool-body .template-label { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
#tool-body .tpl-chip {
  padding: 4px 12px;
  background: #f0f4f8;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.2s;
  color: #555;
  border: 1px solid #e0e0e0;
}
#tool-body .tpl-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.theme-dark-mode #tool-body .tpl-chip { background: #333; color: #aaa; border-color: #555; }
.theme-dark-mode #tool-body .tpl-chip:hover { background: var(--primary); color: #fff; }

#tool-body .action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
#tool-body #runBtn {
  background: var(--primary);
  border: none;
  min-width: 140px;
  height: 40px;
  transition: 0.3s;
}
#tool-body #runBtn:not(.layui-btn-disabled):hover { opacity: 0.88; }
#tool-body .output-hint-row { margin-top: 10px; font-size: 12px; color: var(--text-muted); }
#tool-body .output-hint-row input {
  display: inline-block;
  width: 200px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0 8px;
  font-size: 13px;
  margin-left: 6px;
  color: var(--text-color);
  background: var(--card-bg);
  vertical-align: middle;
  font-family: monospace;
}
.theme-dark-mode #tool-body .output-hint-row input { border-color: #555; background: #222; }

/* === 进度 & 日志 === */
#tool-body .progress-section {
  margin-top: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  display: none;
}
.theme-dark-mode #tool-body .progress-section { border-color: #444; }
#tool-body .progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
#tool-body .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}
#tool-body .status-badge.running { background: #fff3e0; color: #e65100; }
#tool-body .status-badge.done { background: #e8f5e9; color: #2e7d32; }
#tool-body .status-badge.error { background: #fce4ec; color: #c62828; }
.theme-dark-mode #tool-body .status-badge.running { background: #3d2800; color: #ffb74d; }
.theme-dark-mode #tool-body .status-badge.done { background: #1b3a1f; color: #81c784; }
.theme-dark-mode #tool-body .status-badge.error { background: #3d0a0a; color: #ef9a9a; }

#tool-body .progress-stage { font-size: 13px; color: var(--text-muted); }
#tool-body .progress-bar-wrap { margin-bottom: 14px; }

#tool-body .log-toggle {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
#tool-body .log-box {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 12px 14px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--log-text);
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.7;
  display: none;
}
#tool-body .log-box .log-line-err { color: #f38ba8; }
#tool-body .log-box .log-line-warn { color: #fab387; }

/* === 输出区 === */
#tool-body .output-section {
  margin-top: 20px;
  display: none;
}
#tool-body .output-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.theme-dark-mode #tool-body .output-item { border-color: #444; }
#tool-body .output-preview-wrap { flex: 1; min-width: 0; }
#tool-body .output-name {
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tool-body .output-size { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
#tool-body .output-media { margin-top: 10px; width: 100vw; max-width: 480px; border-radius: 6px; outline: none; }
#tool-body .output-media-img { margin-top: 10px; max-width: 100%; max-height: 200px; border-radius: 6px; cursor: zoom-in; }
#tool-body .output-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* === 响应式 === */
@media (max-width: 768px) {
  #tool-body .output-item { flex-direction: column; align-items: flex-start; }
  #tool-body .output-actions { width: 100%; justify-content: flex-end; }
  #tool-body .output-media { max-width: 100%; }
}