* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f4f5f7;
  color: #1f2329;
  font-size: 15px;
}

#app { min-height: 100vh; }

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #eef3f8 0%, #e3ecf6 100%);
}
.login-card {
  width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 12px 40px rgba(31, 45, 61, 0.1);
}
.login-title { font-size: 22px; font-weight: 600; text-align: center; }
.login-sub { text-align: center; color: #8a8f99; font-size: 13px; margin: 8px 0 28px; }
.login-card .el-input { margin-bottom: 16px; }

/* 顶栏 */
.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e6e8eb;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-item {
  border: none;
  background: transparent;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 15px;
  color: #5a616b;
  cursor: pointer;
}
.nav-item:hover { background: #f2f4f7; }
.nav-item.active { background: #eaf3ff; color: #1668dc; font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.uname { color: #1f2329; font-weight: 500; }

.main { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* 面板 */
.panel { background: #fff; border-radius: 12px; padding: 24px; border: 1px solid #e9ebee; }
.panel + .panel { margin-top: 20px; }
.panel-head { margin-bottom: 20px; }
.panel-head h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.hint { margin: 0; color: #8a8f99; font-size: 13px; }

/* 上传块 */
.block { background: #fafbfc; border: 1px solid #eceef1; border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.block-title { font-weight: 600; margin-bottom: 12px; font-size: 15px; }

/* 补充要求快捷标签 */
.quick-tags {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center;
}
.quick-tag {
  display: inline-block; padding: 3px 10px; font-size: 12px; line-height: 1.4;
  border-radius: 12px; border: 1px solid #dfe3e8; color: #5a6473;
  background: #fff; cursor: pointer; user-select: none;
  transition: all .15s;
}
.quick-tag:hover { border-color: #1668dc; color: #1668dc; }
.quick-tag.on {
  background: #e7f0ff; border-color: #1668dc; color: #1668dc; font-weight: 500;
}
.quick-clear {
  font-size: 12px; color: #c0c7d0; cursor: pointer; margin-left: auto;
  padding: 3px 8px; border-radius: 12px;
}
.quick-clear:hover { color: #c43d3d; background: #fff0f0; }
.uploader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 74px;
  border: 1.5px dashed #c9d0d8;
  border-radius: 10px;
  color: #5a616b;
  cursor: pointer;
  font-size: 14px;
  background: #fff;
}
.uploader:hover { border-color: #1668dc; color: #1668dc; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb { position: relative; width: 86px; height: 110px; border-radius: 8px; overflow: hidden; border: 1px solid #e6e8eb; background: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .del {
  position: absolute; right: 3px; top: 3px; width: 20px; height: 20px;
  background: rgba(0,0,0,.55); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer;
}

.field { margin-bottom: 16px; }
.field-label { font-size: 13px; color: #5a616b; margin-bottom: 8px; }

/* 任务状态 */
.status-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.s-pending { background: #fff4e5; color: #a86500; }
.s-running { background: #e8f1ff; color: #1668dc; }
.s-success { background: #e6f8ef; color: #10824a; }
.s-failed { background: #fdeceb; color: #c0392b; }

/* 结果网格 */
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.result-card { border: 1px solid #e6e8eb; border-radius: 10px; overflow: hidden; background: #fff; }
.result-card img { width: 100%; display: block; cursor: zoom-in; aspect-ratio: 2 / 3; object-fit: cover; }
.result-ops { display: flex; gap: 8px; padding: 8px; }
.result-card.selected { border-color: #1668dc; box-shadow: 0 0 0 2px rgba(22,104,220,.15); }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.asset-card { border: 1px solid #e6e8eb; border-radius: 10px; overflow: hidden; background: #fff; position: relative; }
.asset-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.asset-meta { padding: 6px 8px; font-size: 12px; color: #8a8f99; display: flex; justify-content: space-between; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card { background: #fff; border: 1px solid #e9ebee; border-radius: 12px; padding: 18px 20px; }
.stat-label { font-size: 13px; color: #8a8f99; }
.stat-value { font-size: 26px; font-weight: 600; margin-top: 6px; }

.big-view img { width: 100%; display: block; border-radius: 8px; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.flex1 { flex: 1; }

/* 上传行 + 素材库按钮 */
.up-row { display: flex; gap: 12px; align-items: stretch; }
.up-row .uploader { flex: 1; }
.btn-lib {
  min-width: 92px;
  padding: 0 18px;
  border: 1px solid #c9d0d8;
  border-radius: 10px;
  background: #fff;
  color: #1668dc;
  font-size: 14px;
  cursor: pointer;
}
.btn-lib:hover { border-color: #1668dc; background: #f3f8ff; }

/* 素材选择器 */
.pick-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pick-grid .asset-card img { aspect-ratio: 3 / 4; }
.asset-card.pickable { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.asset-card.pickable:hover { border-color: #9dc2f0; }
.asset-card.picked { border-color: #1668dc; box-shadow: 0 0 0 2px rgba(22, 104, 220, .18); }
.tick {
  position: absolute; right: 6px; top: 6px; width: 24px; height: 24px;
  background: #1668dc; color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}

/* 任务详情：左侧结果 + 右侧素材与参数 */
.task-detail-body { display: flex; gap: 20px; align-items: flex-start; }
.task-detail-left { flex: 1; min-width: 0; }
.task-detail-right { width: 360px; flex: none; }
.section-title { font-size: 13px; color: #6b7785; margin: 2px 0 10px; }
.input-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.input-card {
  position: relative; width: 74px; height: 98px; border-radius: 8px;
  overflow: hidden; border: 1px solid #e3e7ec; cursor: zoom-in; background: #f6f8fa;
}
.input-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.input-card .badge {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, .58); color: #fff;
  font-size: 11px; line-height: 17px; text-align: center;
}
.prompt-text { white-space: pre-wrap; line-height: 1.65; font-size: 12px; max-height: 190px; overflow: auto; }

/* 预设参考图 */
.preset-image-row { display: flex; gap: 12px; align-items: flex-start; }
.preset-uploader { width: 150px; height: 96px; flex: none; }
.preset-thumb { position: relative; width: 74px; height: 96px; border-radius: 8px; overflow: hidden; border: 1px solid #e3e7ec; flex: none; }
.preset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preset-thumb-del {
  position: absolute; right: 0; top: 0; width: 20px; height: 20px;
  background: rgba(0, 0, 0, .55); color: #fff; text-align: center;
  line-height: 20px; cursor: pointer; font-size: 14px; border-bottom-left-radius: 8px;
}

/* 文件夹上传 */
.btn-folder {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 16px;
  border: 1px solid #1668dc; border-radius: 8px;
  background: #1668dc; color: #fff; font-size: 14px;
  cursor: pointer; white-space: nowrap;
}
.btn-folder:hover { background: #1259bd; border-color: #1259bd; }

.folder-badge {
  position: absolute; left: 6px; top: 6px; max-width: calc(100% - 12px);
  padding: 2px 8px; border-radius: 10px;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 11px; line-height: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 微调弹窗 */
.refine-body { display: flex; gap: 20px; align-items: flex-start; }
.refine-img { width: 260px; flex: none; border-radius: 10px; border: 1px solid #e6e8eb; display: block; }
.refine-form { flex: 1; min-width: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.chip {
  padding: 6px 14px; border: 1px solid #d6dbe2; border-radius: 16px;
  font-size: 13px; color: #4a5563; cursor: pointer; user-select: none;
  transition: all .12s;
}
.chip:hover { border-color: #1668dc; color: #1668dc; }
.chip.on { background: #1668dc; border-color: #1668dc; color: #fff; }

/* 左右对比 + 滑杆 */
.compare-row { display: flex; gap: 16px; }
.compare-pane { flex: 1; min-width: 0; }
.compare-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4a5563; margin-bottom: 8px; }

/* 框内 zoom/pan 图片查看器 */
.compare-body {
  background: #f5f6f8; border: 1px solid #e6e8eb; border-radius: 10px;
  height: 340px; overflow: hidden; position: relative;
}
.compare-body .viewer-stage {
  width: 100%; height: 100%;
  position: relative; overflow: hidden;
  user-select: none;
}
.compare-body .viewer-stage.panning { cursor: grabbing; }
.compare-body .viewer-stage { cursor: zoom-in; }
.compare-body .viewer-stage.zoomed { cursor: grab; }
.compare-body .viewer-img {
  position: absolute; top: 50%; left: 50%;
  transform-origin: center center;
  pointer-events: none;   /* 事件由 stage 统一处理 */
}
.compare-body .viewer-img.native { image-rendering: auto; }
.compare-body .preview-src { display: none; }

/* 右下角缩放工具栏 */
.viewer-toolbar {
  position: absolute; right: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 4px;
  background: rgba(30,35,45,0.85); border-radius: 20px; padding: 2px 4px;
  backdrop-filter: blur(4px); z-index: 5;
}
.viewer-toolbar button {
  width: 28px; height: 28px; border: none; background: transparent; color: #fff;
  cursor: pointer; border-radius: 50%; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.viewer-toolbar button:hover { background: rgba(255,255,255,0.2); }
.viewer-toolbar .zoom-label {
  font-size: 11px; color: rgba(255,255,255,0.85); min-width: 42px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.compare-empty { text-align: center; color: #8a94a3; font-size: 13px; line-height: 2; }
.adjust-panel { margin-top: 16px; padding: 10px 18px 12px; background: #fafbfc; border: 1px solid #eef0f3; border-radius: 10px; }
.slider-row { display: flex; align-items: center; gap: 14px; height: 40px; }
.slider-label { width: 56px; font-size: 13px; color: #4a5563; flex: none; }
.slider { flex: 1; }
.slider-value { width: 54px; text-align: right; font-size: 13px; color: #1668dc; flex: none; }
.adjust-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.color-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

/* 精准调色 */
.exact-panel { margin-top: 14px; padding: 10px 18px 12px; border: 1px solid #cfe2ff; background: #f4f9ff; border-radius: 10px; }
.exact-head { display: flex; align-items: center; font-size: 13px; font-weight: 600; color: #1668dc; height: 32px; }
.exact-delta { font-weight: 400; color: #4a5563; }
.exact-delta b { color: #0f9d58; }
.exact-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }

/* 衍生动作 */
.variation-body { display: flex; gap: 20px; align-items: flex-start; }
.variation-left { width: 240px; flex: none; }
.variation-left img { width: 100%; border-radius: 10px; border: 1px solid #e6e8eb; display: block; }
.variation-right { flex: 1; min-width: 0; }
.result-ops { flex-wrap: wrap; }

/* 纹理贴图：双控制点编辑器 + 预览 */
.warp-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.warp-help { margin-bottom: 14px; line-height: 1.6; }
.warp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.warp-panel { min-width: 0; }
.warp-panel-title { height: 30px; font-size: 13px; font-weight: 600; color: #445064; display: flex; justify-content: space-between; }
.warp-panel-title span { font-weight: 400; color: #8a94a3; }
.warp-editor, .warp-preview {
  position: relative; width: 100%; max-height: 570px; overflow: hidden;
  background: #f1f3f5; border: 1px solid #e1e5ea; border-radius: 8px;
  touch-action: none; user-select: none;
}
.warp-editor > img, .warp-preview > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.warp-editor > svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.warp-line { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; opacity: .85; }
.warp-line.outer { stroke: #1677ff; }
.warp-line.inner { stroke: #fa8c16; }
.warp-point {
  position: absolute; z-index: 3; width: 14px; height: 14px; padding: 0;
  border: 2px solid #fff; border-radius: 50%; transform: translate(-50%, -50%);
  cursor: grab; touch-action: none; box-shadow: 0 1px 5px rgba(0,0,0,.65);
}
.warp-point:active { cursor: grabbing; width: 18px; height: 18px; }
.warp-point.outer { background: #1677ff; }
.warp-point.inner { background: #fa8c16; }
.warp-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; background: rgba(20,28,40,.58); backdrop-filter: blur(2px);
}
.warp-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin: 18px 0 10px; padding: 10px 16px; background: #f7f9fb; border-radius: 8px; }
.warp-settings > div > span { display: block; font-size: 12px; color: #586579; margin-bottom: 2px; }
@media (max-width: 1100px) {
  .warp-grid { grid-template-columns: 1fr 1fr; }
  .warp-panel:last-child { grid-column: 1 / -1; max-width: 480px; margin: 0 auto; width: 100%; }
}
