/* M24 图片精修 + M25-B 对齐达笔：四段式版式（左操作 / 中画布 / 右本次结果）、
 * 精修幅度、可拖动对比（左右 / 叠加）、本地调色。
 * 复用：tools_cutout(.tc-*) / tools_scene(.ts-*) / tools_buyer(.tb-thumbs) /
 *       tools_main_detail(.md-boards/.md-form/.md-estimate) / tools_queue。
 * 共用件一个字不动（.md-boards 本体在 tools_main_detail.css）。 */

/* ===== 版式：左 ≈22% / 中 ≈61% / 右 ≈14%，gap 12 ===== */
.md-boards.rf-layout {
  grid-template-columns: 300px minmax(0, 1fr) 190px;
  gap: 12px;
  align-items: start;
}

.rf-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

@media (max-width: 1200px) {
  .md-boards.rf-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .md-boards.rf-layout .rf-side { grid-column: 1 / -1; }
  .md-boards.rf-layout .rf-side-list { flex-direction: row; overflow-x: auto; }
}

@media (max-width: 900px) {
  .md-boards.rf-layout { grid-template-columns: 1fr; }
}

/* ===== 左栏：上传区压扁 ===== */
.rf-drop {
  min-height: 96px;
  padding: 10px;
  gap: 2px;
}
.rf-drop .tc-drop-icon { font-size: 22px; }
.rf-drop .tc-drop-title { font-size: 13px; }
.rf-drop .tc-drop-hint { font-size: 11px; }

.rf-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rf-picker-note { font-size: 12px; color: #9ca3af; }
.rf-picker-row .tc-btn { padding: 5px 10px; font-size: 12px; }

/* 大幅图时左栏的缩略图行矮一点，别把主按钮顶下去 */
.rf-left .tb-thumbs { max-height: 132px; overflow-y: auto; }

/* ===== 精修幅度 ===== */
.rf-sec {
  border-top: 1px solid #f1f2f4;
  padding-top: 10px;
}
.rf-sec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.rf-info { color: #9ca3af; cursor: help; font-weight: 400; }
.rf-strength {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rf-strength input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 4px;
  accent-color: var(--brand, #71DC68);
  cursor: pointer;
}
.rf-strength input[type="number"] {
  width: 62px;
  flex: 0 0 62px;
  padding: 4px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  color: #111827;
  background: #fff;
}
.rf-strength input[type="number"]:focus {
  outline: none;
  border-color: var(--brand-strong, #5BC85A);
  box-shadow: 0 0 0 3px rgba(113, 220, 104, 0.25);
}

/* ===== 小贴士 ===== */
.rf-tips {
  background: #f9fafb;
  border: 1px solid #f1f2f4;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: #6b7280;
}
.rf-tips-title { font-weight: 600; color: #4b5563; margin-bottom: 4px; }
.rf-tips-list { margin: 0; padding-left: 18px; line-height: 1.7; }

/* ===== 模式二选一 ===== */
.rf-modes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.rf-mode {
  flex: 1 1 120px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.rf-mode.is-active {
  border-color: var(--brand-strong, #5BC85A);
  background: var(--brand-soft, rgba(113, 220, 104, 0.14));
  color: var(--brand-ink, #14331B);
  font-weight: 600;
}

/* ===== 主按钮：整宽 + 绿底深字 + 带单价 ===== */
.rf-go {
  width: 100%;
  margin-top: 2px;
}

/* ===== 中列：画布 ===== */
.rf-stage {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.rf-stage-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #f1f2f4;
  background: #fafafa;
  font-size: 12px;
  color: #4b5563;
}
.rf-cmp-toggle { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.rf-cmp-toggle input { accent-color: var(--brand, #71DC68); }
.rf-cmp-modes { display: inline-flex; gap: 4px; }
.rf-cmp-modes button,
.rf-zoom button {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}
.rf-cmp-modes button:disabled { color: #c3c8d0; cursor: not-allowed; background: #f9fafb; }
.rf-cmp-modes button.is-active {
  border-color: var(--brand-strong, #5BC85A);
  background: var(--brand, #71DC68);
  color: var(--brand-ink, #14331B);
}
.rf-grow { flex: 1 1 auto; }
.rf-zoom { display: inline-flex; align-items: center; gap: 6px; }
.rf-zoom span { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }

.rf-canvas {
  position: relative;
  min-height: 520px;
  height: min(72vh, 760px);
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, #f3f4f6 25%, transparent 25%) 0 0 / 20px 20px,
    linear-gradient(-45deg, #f3f4f6 25%, transparent 25%) 0 10px / 20px 20px,
    linear-gradient(45deg, transparent 75%, #f3f4f6 75%) 10px -10px / 20px 20px,
    linear-gradient(-45deg, transparent 75%, #f3f4f6 75%) -10px 0 / 20px 20px,
    #fff;
  overflow: hidden;
}
.rf-canvas-inner {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  transition: transform 0.08s linear;
}
.rf-canvas-inner img {
  display: block;
  max-width: 100%;
  max-height: min(72vh, 760px);
  object-fit: contain;
  cursor: zoom-in;
}
.rf-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #9ca3af;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
.rf-empty span { font-size: 11px; color: #c3c8d0; }
.rf-empty.hidden { display: none; }

/* 叠加对比：结果层裁切 + 分割线（照达笔 drag 算法） */
.rf-cmp-drag {
  position: relative;
  max-width: 100%;
  max-height: min(72vh, 760px);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.rf-cmp-drag img {
  display: block;
  max-width: 100%;
  max-height: min(72vh, 760px);
  object-fit: contain;
  pointer-events: none;
}
.rf-cmp-clip {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  overflow: hidden;
}
.rf-cmp-clip img { max-width: none; }
.rf-cmp-handle {
  position: absolute;
  top: 0;
  width: 12px;
  height: 100%;
  margin-left: -6px;
  cursor: col-resize;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.15));
}
.rf-cmp-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* 左右并排对比：两张各带红色细边框 */
.rf-cmp-lr {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: center;
  max-width: 100%;
}
.rf-cmp-lr figure {
  margin: 0;
  border: 1px solid #ef4444;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.rf-cmp-lr img {
  display: block;
  max-width: 100%;
  max-height: min(70vh, 720px);
  object-fit: contain;
}
.rf-cmp-lr figcaption {
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  padding: 2px 0;
  background: #fafafa;
}

/* ===== 中右浮窗工具条（改图 / AI工具 / 调色） ===== */
.rf-floatbar {
  position: absolute;
  top: 96px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}
.rf-float {
  width: 54px;
  padding: 8px 0;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.rf-float.is-on { border-color: var(--brand-strong, #5BC85A); color: var(--brand-ink, #14331B); }
.rf-float.is-on.is-active { background: var(--brand, #71DC68); }
.rf-float.is-off { color: #c3c8d0; cursor: not-allowed; }

/* 调色 popover（锚在「调色」上，向左弹） */
.rf-color-pop {
  position: absolute;
  top: 0;
  right: 64px;
  width: 268px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  padding: 10px;
  z-index: 9;
}
.rf-color-pop[hidden] { display: none; }
.rf-color-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}
.rf-color-note { font-size: 11px; font-weight: 400; color: #9ca3af; }
/* M26-A：调色预设 chips（复古 / 胶片 / 鲜艳 / 重置），选中态用 --brand 系。 */
.rf-color-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.rf-color-preset {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.rf-color-preset:hover { border-color: var(--brand-strong, #5BC85A); color: var(--brand-ink, #14331B); }
.rf-color-preset.is-active {
  border-color: var(--brand-strong, #5BC85A);
  background: var(--brand, #71DC68);
  color: var(--brand-ink, #14331B);
}
.rf-color-preset-reset { margin-left: auto; color: #6b7280; }
.rf-color-preset-grow { flex: 1 1 auto; min-width: 4px; }
.rf-color-rows { display: flex; flex-direction: column; gap: 7px; }
.rf-color-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #4b5563;
}
.rf-color-row input[type="range"] {
  width: 100%;
  height: 4px;
  accent-color: var(--brand, #71DC68);
}
.rf-color-row .rf-color-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #9ca3af;
}
.rf-color-foot { display: flex; gap: 8px; margin-top: 10px; }
.rf-color-foot button {
  flex: 1 1 auto;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #4b5563;
}
#rfColorSave {
  border-color: var(--brand-strong, #5BC85A);
  background: var(--brand, #71DC68);
  color: var(--brand-ink, #14331B);
  font-weight: 600;
}

/* 画布上的色温叠加层（纯预览，保存时才烧进像素） */
.rf-temp-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* ===== 右列：本次结果 ===== */
.rf-side {
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  max-height: min(72vh, 760px);
}
.rf-side-head {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  border-bottom: 1px solid #f1f2f4;
  background: #fafafa;
}
.rf-side-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rf-side-empty { font-size: 12px; color: #c3c8d0; padding: 6px 2px; }
.rf-thumb {
  position: relative;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #fafafa;
}
.rf-thumb img { display: block; width: 100%; max-height: 130px; object-fit: contain; background: #fff; }
.rf-thumb.is-active { border-color: var(--brand, #71DC68); }
.rf-thumb-no {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 10px;
}
.rf-thumb-edited {
  position: absolute;
  right: 4px;
  top: 4px;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--brand, #71DC68);
  color: var(--brand-ink, #14331B);
  font-size: 10px;
}
.rf-side-foot {
  border-top: 1px solid #f1f2f4;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rf-export {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--brand, #71DC68);
  color: var(--brand-ink, #14331B);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.rf-export:hover { background: var(--brand-strong, #5BC85A); }
.rf-side-sub { display: flex; gap: 6px; }
.rf-side-sub .tc-btn { flex: 1 1 auto; justify-content: center; padding: 5px 6px; font-size: 11px; }

/* 任务卡里的结果图：照 M22-B/M23-A 那套限高，别让 2K 原图把卡片撑爆 */
#rfTasks .ts-task-grid .tc-img-box img {
  max-height: 220px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
#rfTasks .ts-task-grid .tc-img-box { min-height: 0; }

/* 结果卡（任务卡里的 ✕ / 下载）沿用旧类，保留兼容 */
.rf-ops { display: flex; gap: 8px; padding: 6px 0 0; }
.rf-ops button,
.rf-ops a {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  padding: 3px 8px;
  cursor: pointer;
  text-decoration: none;
}
