/* ═══════════════════════════════════════════
   工具页 (Tools panel)
   ═══════════════════════════════════════════ */

/* 滚动挂在整页 panel（贴主内容区右缘），勿在居中的 .tools-wrap 上滚动（滚轮常失效） */
#panel-tools {
  align-items: stretch;
  justify-content: flex-start;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: auto;
  scrollbar-gutter: stable;
}

#panel-tools .tools-wrap {
  width: min(1280px, calc(100% - 48px));
  max-width: none;
  margin: 0 auto;
  padding: 20px 24px 56px;
  box-sizing: border-box;
}

#panel-tools::-webkit-scrollbar {
  width: 10px;
}

#panel-tools::-webkit-scrollbar-track {
  background: transparent;
}

#panel-tools::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text3) 35%, var(--bg4));
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#panel-tools::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text3) 55%, var(--bg4));
  background-clip: padding-box;
}

.tools-header {
  margin-bottom: 24px;
}

.tools-header h1 {
  font-size: calc(22 * 1rem / 16);
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.tools-lead {
  margin: 0;
  font-size: calc(13 * 1rem / 16);
  color: var(--text2);
  line-height: 1.65;
}

.tools-lead strong {
  color: var(--text);
  font-weight: 500;
}

/* ── Tab ── */
.tools-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg3);
  border-radius: 10px;
  padding: 4px;
  max-width: 420px;
}

.tools-tab {
  flex: 1;
  padding: 9px 12px;
  text-align: center;
  border: none;
  background: none;
  color: var(--text2);
  font-size: calc(13 * 1rem / 16);
  cursor: pointer;
  border-radius: 7px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.tools-tab:hover:not(.active) {
  background: var(--bg4);
  color: var(--text);
}

.tools-tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ── 来源切换（本地 / 视频创作成片） ── */
.tools-source-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg3);
  border-radius: 8px;
  padding: 3px;
  max-width: 420px;
}

.tools-source-tab {
  flex: 1;
  padding: 8px 10px;
  text-align: center;
  border: none;
  background: none;
  color: var(--text2);
  font-size: calc(12 * 1rem / 16);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}

.tools-source-tab:hover:not(.active) {
  background: var(--bg4);
  color: var(--text);
}

.tools-source-tab.active {
  background: var(--bg2);
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 3px color-mix(in srgb, #000 12%, transparent);
}

.tools-source-block {
  margin-bottom: 4px;
}

.tools-feed-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tools-feed-toolbar-hint {
  font-size: calc(12 * 1rem / 16);
  color: var(--text3);
  line-height: 1.45;
}

.tools-queue,
.tools-feed-pick-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding: 2px 0;
  list-style: none;
}

.tools-source-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg3);
}

.tools-source-row-media {
  flex: 1 1 180px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tools-source-row--feed,
.tools-source-row--local {
  align-items: center;
  gap: 0 20px;
}

.tools-local-size {
  flex-shrink: 0;
  font-size: calc(12 * 1rem / 16);
  color: var(--text3);
  white-space: nowrap;
}

.tools-local-filename {
  font-weight: 500;
}

/* 左：任务信息（提示词 + 详情 + 查看原视频 同一行） */
.tools-source-row-info {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 20px;
  margin-right: 4px;
  border-right: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
}

.tools-feed-pick-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.tools-feed-pick-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
  margin-top: 0;
}

/* 右：参数下拉 + 提交 */
.tools-source-row-ops {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  flex: 0 1 auto;
}

.tools-source-row-ops .tools-source-row-params {
  flex: 0 1 auto;
}

.tools-feed-detail {
  flex-shrink: 0;
  position: static;
  right: auto;
  bottom: auto;
  width: auto;
  height: auto;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: calc(12 * 1rem / 16);
  line-height: inherit;
  text-align: left;
  color: var(--accent2);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tools-feed-detail:hover {
  color: var(--accent);
}

/* 勿复用 .rc-prompt-detail（video.css 为结果卡绝对定位），工具页内联展示 */
#panel-tools .rc-prompt-detail {
  position: static;
  right: auto;
  bottom: auto;
  width: auto;
  height: auto;
  background: none;
  text-align: left;
}

.tools-feed-view-video {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: calc(12 * 1rem / 16);
  color: var(--accent2);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.tools-feed-view-video:hover {
  color: var(--accent);
}

.tools-feed-view-video--muted {
  color: var(--text3);
  text-decoration: none;
  cursor: default;
}

/* 成片预览浮层：页内播放，避免直链触发下载 */
body.tools-video-preview-open {
  overflow: hidden;
}

.tools-video-preview {
  position: fixed;
  inset: 0;
  z-index: 940;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 16px;
  box-sizing: border-box;
}

.tools-video-preview.is-open {
  display: flex;
}

.tools-video-preview-dim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, #0a0c10 78%, transparent);
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  cursor: zoom-out;
}

.tools-video-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  cursor: pointer;
}

.tools-video-preview-stage {
  position: relative;
  z-index: 2;
  max-width: min(96vw, 1280px);
  max-height: calc(100vh - 96px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tools-video-preview-stage video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 96px);
  width: auto;
  height: auto;
  border-radius: var(--radius-lg, 12px);
  background: #000;
  box-shadow: 0 20px 60px color-mix(in srgb, #000 55%, transparent),
    0 0 0 1px color-mix(in srgb, var(--border) 40%, transparent);
}

.tools-source-row-params {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  flex: 2 1 280px;
}

.tools-param-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
}

.tools-param-inline label {
  flex-shrink: 0;
  margin: 0;
  font-size: calc(12 * 1rem / 16);
  color: var(--text2);
  white-space: nowrap;
  line-height: 1.2;
}

.tools-param-inline .tb-select {
  min-width: 72px;
  max-width: 108px;
  min-height: 34px;
  height: 34px;
  padding: 0 28px 0 10px;
  box-sizing: border-box;
}

.tools-param-inline .tb-cs {
  min-width: 72px;
  max-width: 108px;
}

#panel-tools .tools-param-inline .tb-cs-trigger {
  min-height: 34px;
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
}

.tools-source-row .tools-row-submit {
  flex-shrink: 0;
  align-self: center;
  min-width: 72px;
  height: 34px;
  min-height: 34px;
  padding: 0 16px;
  font-size: calc(13 * 1rem / 16);
  line-height: 34px;
  box-sizing: border-box;
}

.tools-row-status {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  flex-shrink: 0;
  min-height: 34px;
}

.tools-row-status-text {
  font-size: calc(12 * 1rem / 16);
  color: var(--text2);
  white-space: nowrap;
}

.tools-row-status-text.is-ok {
  color: var(--accent2);
}

.tools-row-status-text.is-err {
  color: var(--err, #e85d5d);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tools-row-status .btn {
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  line-height: 32px;
  box-sizing: border-box;
}

.tools-row-result-download {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--accent2);
  text-decoration: none;
}

.tools-row-result-download:hover {
  color: var(--accent);
}

.tools-row-msg {
  flex: 1 1 100%;
  font-size: calc(12 * 1rem / 16);
  color: var(--text2);
  min-height: 1.2em;
}

.tools-source-row--file-missing .tools-local-filename {
  color: var(--text3);
}

.tools-row-msg.is-ok {
  color: var(--green);
}

.tools-row-msg.is-err {
  color: var(--red);
}

.tools-row-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 2px;
}

.tools-row-status[hidden] {
  display: none;
}

.tools-row-status-text {
  font-size: calc(12 * 1rem / 16);
  color: var(--text2);
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tools-row-status-text.is-ok {
  color: var(--green);
}

.tools-row-status-text.is-err {
  color: var(--red);
}

.tools-source-row-ops .tools-row-status .btn {
  min-height: 34px;
  height: 34px;
  padding: 0 12px;
  font-size: calc(12 * 1rem / 16);
  line-height: 34px;
}

.tools-feed-pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg3);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tools-feed-pick-item:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
  background: var(--bg4);
}

.tools-feed-pick-item input[type='checkbox'] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.tools-feed-thumb {
  width: min(200px, 36vw);
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--bg4);
}

.tools-feed-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(11 * 1rem / 16);
  color: var(--text3);
}

.tools-feed-pick-id {
  font-size: calc(11 * 1rem / 16);
  color: var(--text3);
  font-family: ui-monospace, monospace;
}

.tools-feed-pick-main .tools-feed-pick-prompt {
  flex: 1 1 auto;
  min-width: 0;
  font-size: calc(13 * 1rem / 16);
  color: var(--text);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tools-feed-empty {
  margin: 0;
  padding: 16px 12px;
  text-align: center;
  font-size: calc(13 * 1rem / 16);
  color: var(--text3);
  line-height: 1.55;
}

.tools-feed-empty--err {
  color: var(--red, #e55);
}

.tools-batch-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tools-batch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  font-size: calc(12 * 1rem / 16);
}

.tools-batch-idx {
  flex-shrink: 0;
  width: 1.4em;
  color: var(--text3);
  text-align: right;
}

.tools-batch-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.tools-batch-size {
  flex-shrink: 0;
  color: var(--text3);
}

/* ── 卡片 ── */
.tools-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: 22px 22px 20px;
  margin-bottom: 0;
}

.tools-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tools-card-head h2 {
  font-size: calc(15 * 1rem / 16);
  font-weight: 600;
  margin: 0;
}

.tools-card-sub {
  font-size: calc(12 * 1rem / 16);
  color: var(--text3);
}

.tools-local-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.tools-local-queue {
  margin: 0 0 12px;
  padding: 0;
}

.tools-local-queue.is-dragover .tools-source-row--add {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg3));
}

.tools-source-row--add {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border: 1px dashed color-mix(in srgb, var(--border) 90%, var(--accent) 10%);
  border-radius: 12px;
  background: var(--bg2);
  cursor: pointer;
  list-style: none;
}

.tools-source-row--add:hover {
  border-color: color-mix(in srgb, var(--border) 50%, var(--accent) 50%);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg3));
}

.tools-add-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 20px;
  width: 100%;
}

.tools-add-local-btn,
.tools-add-feed-btn,
.tools-local-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: calc(13 * 1rem / 16);
  color: var(--accent2);
  cursor: pointer;
}

.tools-add-local-btn:hover,
.tools-add-feed-btn:hover,
.tools-local-add-btn:hover {
  color: var(--accent);
}

.tools-feed-picker {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.tools-feed-picker.is-open {
  pointer-events: auto;
  opacity: 1;
}

.tools-feed-picker-dim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  backdrop-filter: blur(4px);
}

.tools-feed-picker-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg2);
  box-shadow: 0 16px 48px color-mix(in srgb, var(--bg) 55%, transparent);
  overflow: hidden;
}

.tools-feed-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}

.tools-feed-picker-head h3 {
  margin: 0;
  font-size: calc(15 * 1rem / 16);
  font-weight: 600;
}

.tools-feed-picker-hint {
  margin: 0 16px 8px;
  font-size: calc(12 * 1rem / 16);
  color: var(--accent2);
  line-height: 1.45;
}

.tools-feed-picker-toolbar {
  padding: 0 16px 8px;
}

.tools-feed-picker-list {
  flex: 1;
  overflow: auto;
  padding: 0 12px 12px;
}

.tools-feed-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: var(--bg3);
}

.tools-feed-picker-item.is-added {
  opacity: 0.72;
}

.tools-feed-picker-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tools-feed-picker-item-id {
  font-size: calc(11 * 1rem / 16);
  color: var(--accent2);
  font-weight: 600;
}

.tools-feed-picker-item-prompt {
  font-size: calc(13 * 1rem / 16);
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}

.tools-feed-picker-added {
  flex-shrink: 0;
  font-size: calc(12 * 1rem / 16);
  color: var(--accent2);
}

body.tools-feed-picker-open {
  overflow: hidden;
}

.tools-local-add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  border-radius: 6px;
  font-size: calc(15 * 1rem / 16);
  font-weight: 600;
  line-height: 1;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.tools-source-row-ops .tools-row-remove {
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  box-sizing: border-box;
  line-height: 32px;
}

#panel-tools .tools-upload-zone {
  display: none;
}

.tools-upload-zone {
  margin-bottom: 18px;
}

.tools-upload-zone .tools-file-name {
  display: block;
  margin-top: 6px;
  font-size: calc(12 * 1rem / 16);
  color: var(--accent2);
  font-weight: 500;
  word-break: break-all;
}

.tools-upload-zone input[type='file'] {
  display: none;
}

/* ── 参数行（与视频创作工具条一致：单行三列 + tb-select） ── */
.tools-params-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin-bottom: 14px;
}

.tools-params-row .tools-field {
  flex: 1 1 0;
  min-width: 120px;
}

/* 自定义下拉挂载后隐藏原生 select，避免与 .tb-cs-trigger 叠成两行 */
#panel-tools .tb-cs {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  z-index: 2;
}
#panel-tools .tb-cs.is-open {
  z-index: 90;
}
#panel-tools .tb-cs-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
#panel-tools .tb-cs-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  font-size: calc(13 * 1rem / 16);
  font-family: var(--font);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  outline: none;
  transition: border-color 0.15s, background 0.12s, box-shadow 0.15s;
  box-shadow: 0 1px 2px color-mix(in srgb, #000 14%, transparent);
}
#panel-tools .tb-cs-trigger:hover {
  border-color: color-mix(in srgb, var(--border) 70%, var(--text3) 30%);
  background: var(--bg4);
}
#panel-tools .tb-cs.is-open .tb-cs-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent),
    0 1px 2px color-mix(in srgb, #000 12%, transparent);
}
#panel-tools .tb-cs-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
#panel-tools .tb-cs-chev {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text3);
  flex-shrink: 0;
  opacity: 0.9;
  transition: transform 0.2s ease;
  margin-left: 4px;
}
#panel-tools .tb-cs.is-open .tb-cs-chev {
  transform: rotate(180deg);
}
#panel-tools .tb-cs-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  max-height: min(320px, 56vh);
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 95;
  padding: 8px;
  border-radius: 14px;
  background: var(--bg2);
  border: 1px solid color-mix(in srgb, var(--border) 78%, var(--text3) 22%);
  box-shadow: 0 16px 40px color-mix(in srgb, #000 42%, transparent),
    0 0 0 1px color-mix(in srgb, var(--border) 35%, transparent);
}
#panel-tools .tb-cs-option.tb-cs-option--tile {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  font: inherit;
  font-size: calc(13 * 1rem / 16);
  font-weight: 500;
  padding: 11px 14px;
  margin: 4px 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  line-height: 1.35;
}
#panel-tools .tb-cs-option.tb-cs-option--tile:hover,
#panel-tools .tb-cs-option.tb-cs-option--tile:focus-visible {
  background: var(--bg4);
  outline: none;
  border-color: color-mix(in srgb, var(--border) 80%, var(--accent) 20%);
}
#panel-tools .tb-cs-option.tb-cs-option--tile.is-selected {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg3));
  font-weight: 600;
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
}

#panel-tools .tools-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 14px;
}

.tools-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tools-field label,
.tools-field .tools-field-label {
  font-size: calc(12 * 1rem / 16);
  color: var(--text2);
  font-weight: 500;
}

.tools-fixed-value {
  padding: 9px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-size: calc(13 * 1rem / 16);
  line-height: 1.4;
}

.tools-field .tb-input {
  width: 100%;
  box-sizing: border-box;
}

.tools-hint {
  font-size: calc(12 * 1rem / 16);
  color: var(--text3);
  line-height: 1.55;
  margin: 0 0 16px;
}

.tools-profile-hint {
  font-size: calc(12 * 1rem / 16);
  color: var(--text2);
  line-height: 1.55;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: var(--bg3);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.tools-profile-hint:empty {
  display: none;
}

.tools-submit {
  width: 100%;
  margin-top: 4px;
  padding: 11px 20px;
  font-size: calc(14 * 1rem / 16);
}

.tools-msg {
  min-height: 1.25em;
  margin: 10px 0 0;
  font-size: calc(12 * 1rem / 16);
  color: var(--text2);
}

.tools-msg.is-ok {
  color: var(--green);
}

.tools-msg.is-err {
  color: var(--red);
}

/* ── 任务列表 ── */
.tools-tasks-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.tools-tasks-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tools-tasks-section-head h2 {
  font-size: calc(16 * 1rem / 16);
  font-weight: 600;
  margin: 0;
}

.tools-task-list {
  font-size: calc(13 * 1rem / 16);
}

.tools-task-list--horizontal {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}

.tools-task-list--horizontal .tools-task-item {
  flex: 0 0 min(440px, 88vw);
  max-width: min(440px, 88vw);
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg3);
  border-bottom: none;
}

.tools-task-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.tools-task-item:last-child {
  border-bottom: none;
}

.tools-task-list--horizontal .tools-task-item:last-child {
  border-bottom: none;
}

.tools-task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tools-task-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: calc(11 * 1rem / 16);
  font-weight: 500;
  background: var(--accent-bg);
  color: var(--accent);
}

.tools-task-id {
  font-weight: 600;
  color: var(--text);
}

.tools-task-status {
  color: var(--text2);
  font-size: calc(12 * 1rem / 16);
}

.tools-task-prompt {
  font-size: calc(11 * 1rem / 16);
  color: var(--text3);
  margin-top: 6px;
  line-height: 1.45;
}

.tools-task-video {
  margin-top: 12px;
}

.tools-task-video video {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(520px, 58vh);
  border-radius: var(--radius-lg, 12px);
  background: #000;
  border: 1px solid var(--border);
  object-fit: contain;
}

.tools-task-err {
  margin-top: 8px;
  font-size: calc(12 * 1rem / 16);
  color: var(--red);
  line-height: 1.45;
}

.tools-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--text3);
  font-size: calc(13 * 1rem / 16);
  background: var(--bg3);
  border-radius: 10px;
  border: 1px dashed var(--border);
}

.tools-link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent2);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tools-link-btn:hover {
  color: var(--accent);
}

@media (max-width: 560px) {
  #panel-tools .tools-wrap {
    padding: 16px 14px 48px;
  }

  .tools-params-row .tools-field {
    flex: 1 1 100%;
    min-width: 0;
  }

  .tools-form-grid {
    grid-template-columns: 1fr;
  }

  .tools-tabs {
    max-width: none;
  }
}
