/* ===== 主题变量 ===== */
/*
  四色融合：BRICK RED & PINK + ZAMBEZI & PEAR + POLO BLUE & SNOW + EAST BAY & HAWKES BLUE
  主基调：粉色玫瑰，辅以蓝、绿、黄点缀
*/
:root,
[data-theme='light'] {
  --bg-page: #FAF7F5;                /* SNOW 暖白 */
  --bg-surface: #FFFFFF;             /* 纯白 */
  --bg-surface-2: #F0EDF5;           /* HAWKES BLUE 淡蓝紫 */
  --bg-elevated: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.72);
  --border: rgba(80, 88, 108, 0.08);  /* EAST BAY 淡灰蓝 */
  --border-strong: rgba(80, 88, 108, 0.14);
  --text-1: #50586C;                  /* EAST BAY 深灰蓝 */
  --text-2: #7B9ACC;                  /* POLO BLUE 蓝 */
  --text-3: #A0A8B8;                  /* 浅灰蓝 */

  /* 主色：粉色玫瑰系 */
  --accent: #D17B91;                  /* 柔粉玫瑰 */
  --accent-2: #E89BAE;                /* 浅粉 */
  --accent-deep: #CC313D;             /* BRICK RED 砖红 */
  --accent-soft: rgba(209, 123, 145, 0.10);
  --accent-soft-2: rgba(232, 155, 174, 0.12);

  /* 点缀色：四种配色各取代表色 */
  --pear: #D6E017;                    /* ZAMBEZI & PEAR 亮黄绿 */
  --pear-soft: rgba(214, 224, 23, 0.12);
  --brick: #CC313D;                   /* BRICK RED 砖红 */
  --brick-soft: rgba(204, 49, 61, 0.10);
  --polo: #7B9ACC;                    /* POLO BLUE */
  --polo-soft: rgba(123, 154, 204, 0.12);
  --east: #50586C;                    /* EAST BAY */
  --east-soft: rgba(80, 88, 108, 0.08);

  --tag-1-bg: rgba(209, 123, 145, 0.12);
  --tag-1-fg: #B85C75;
  --tag-2-bg: rgba(214, 224, 23, 0.12);
  --tag-2-fg: #A8B000;
  --tag-3-bg: rgba(123, 154, 204, 0.12);
  --tag-3-fg: #5A7AAD;

  --status-queued: #7B9ACC;
  --status-processing: #D6E017;       /* PEAR 亮黄绿 */
  --status-completed: #4A7C59;        /* 绿 */
  --status-failed: #CC313D;           /* BRICK RED 砖红 */
  --shadow-sm: 0 1px 2px rgba(80, 88, 108, 0.04);
  --shadow-md: 0 4px 16px rgba(80, 88, 108, 0.06);
  --shadow-lg: 0 12px 40px rgba(80, 88, 108, 0.10);
  --ring: rgba(209, 123, 145, 0.30);
}

[data-theme='dark'] {
  --bg-page: #1A1822;                 /* 暗紫蓝 */
  --bg-surface: #252230;              /* 深紫蓝 */
  --bg-surface-2: #2E2A3E;           /* 稍亮 */
  --bg-elevated: #383450;
  --bg-glass: rgba(37, 34, 48, 0.78);
  --border: rgba(220, 226, 240, 0.08);
  --border-strong: rgba(220, 226, 240, 0.14);
  --text-1: #F5F7FA;                  /* SNOW 雪白 */
  --text-2: #DCE2F0;                  /* HAWKES BLUE */
  --text-3: #7B9ACC;                  /* POLO BLUE */

  --accent: #E89BAE;                  /* 柔粉 */
  --accent-2: #F7C5CC;              /* PINK 淡粉 */
  --accent-deep: #D17B91;
  --accent-soft: rgba(232, 155, 174, 0.14);
  --accent-soft-2: rgba(247, 197, 204, 0.12);

  --pear: #D6E017;
  --pear-soft: rgba(214, 224, 23, 0.14);
  --brick: #E07A5F;
  --brick-soft: rgba(224, 122, 95, 0.12);
  --polo: #8BAFE0;
  --polo-soft: rgba(139, 175, 224, 0.14);
  --east: #DCE2F0;
  --east-soft: rgba(220, 226, 240, 0.10);

  --tag-1-bg: rgba(232, 155, 174, 0.16);
  --tag-1-fg: #E89BAE;
  --tag-2-bg: rgba(214, 224, 23, 0.14);
  --tag-2-fg: #D6E017;
  --tag-3-bg: rgba(139, 175, 224, 0.14);
  --tag-3-fg: #8BAFE0;

  --status-queued: #7B9ACC;
  --status-processing: #D6E017;
  --status-completed: #6FA888;
  --status-failed: #E07A5F;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
  --ring: rgba(232, 155, 174, 0.35);
}

/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-page);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
  overflow: hidden;
}

::selection { background: var(--accent-soft); }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ===== 顶部导航 ===== */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 0.5px solid var(--border);
  position: relative;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
}
.brand-text h1 {
  font-size: 16px; font-weight: 600; letter-spacing: 0.2px;
  color: var(--text-1);
}
.brand-sub { font-size: 11.5px; color: var(--text-3); letter-spacing: 0.5px; }

.topbar-actions { display: flex; align-items: center; gap: 14px; }
.engine-status {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-2);
  padding: 6px 12px;
  background: var(--bg-surface-2);
  border: 0.5px solid var(--border);
  border-radius: 20px;
}
.engine-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--status-completed);
  box-shadow: 0 0 0 0 var(--status-completed);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(62, 122, 82, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(62, 122, 82, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 122, 82, 0); }
}

.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  border: 0.5px solid var(--border);
  background: var(--bg-surface-2);
  transition: all 0.25s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--border-strong); transform: translateY(-1px); }
.theme-toggle .icon-moon { display: none; }
[data-theme='dark'] .theme-toggle .icon-sun { display: none; }
[data-theme='dark'] .theme-toggle .icon-moon { display: block; }

/* ===== 工作区布局 ===== */
.workspace {
  display: grid;
  grid-template-columns: 384px 1fr;
  height: calc(100vh - 60px);
  gap: 0;
}

.panel { height: 100%; overflow: hidden; display: flex; flex-direction: column; }

.create-panel {
  border-right: 0.5px solid var(--border);
  background: var(--bg-surface);
}
.panel-scroll { overflow-y: auto; padding: 22px 20px 28px; }
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.section-title {
  font-size: 13px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1.2px;
  margin-bottom: 16px;
}

/* ===== 表单字段 ===== */
.field { margin-bottom: 18px; }
.field-row { display: flex; gap: 12px; }
.field-half { flex: 1; }

.field-label {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.field-tag {
  font-size: 11px; font-weight: 600; padding: 2px 9px;
  border-radius: 5px; letter-spacing: 0.3px;
}
.tag-1 { background: var(--tag-1-bg); color: var(--tag-1-fg); }
.tag-2 { background: var(--tag-2-bg); color: var(--tag-2-fg); }
.tag-3 { background: rgba(185, 119, 119, 0.12); color: #8a5a5a; }
.tag-4 { background: rgba(119, 137, 185, 0.12); color: #5a5a8a; }
.tag-5 { background: rgba(137, 185, 119, 0.12); color: #5a8a5a; }
[data-theme='dark'] .tag-3 { background: rgba(200, 140, 140, 0.16); color: #d9a0a0; }
[data-theme='dark'] .tag-4 { background: rgba(140, 160, 200, 0.16); color: #a0b0d9; }
[data-theme='dark'] .tag-5 { background: rgba(140, 200, 140, 0.16); color: #a0d9a0; }
.field-hint { font-size: 12.5px; color: var(--text-2); }

/* ===== 拖拽上传区 ===== */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--bg-surface-2);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  min-height: 118px;
  display: flex; align-items: center; justify-content: center;
}
.dropzone-sm { min-height: 84px; padding: 16px; }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dragover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
  transform: scale(1.01);
}
.dz-icon { color: var(--text-3); margin-bottom: 8px; transition: color 0.25s; }
.dropzone:hover .dz-icon { color: var(--accent); }
.dz-text { font-size: 13px; color: var(--text-1); font-weight: 500; margin-bottom: 3px; }
.dz-sub { font-size: 11.5px; color: var(--text-3); }

.dropzone-thumbs {
  display: flex; flex-wrap: wrap; gap: 8px;
  width: 100%;
}
.dropzone-thumbs:not(:empty) + .dropzone-empty,
.dropzone-empty:has(~ .dropzone-thumbs:not(:empty)) { display: none; }
.dropzone-thumbs:not(:empty) { justify-content: flex-start; }

.thumb {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 9px;
  overflow: hidden;
  border: 0.5px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-remove {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1;
  opacity: 0; transition: opacity 0.2s;
}
.thumb:hover .thumb-remove { opacity: 1; }

.thumb-edit {
  position: absolute; bottom: 3px; right: 3px;
  width: 20px; height: 20px; border-radius: 5px;
  background: rgba(0,0,0,0.6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1;
  opacity: 0; transition: opacity 0.2s;
  padding: 2px;
}
.thumb:hover .thumb-edit { opacity: 1; }
.thumb-edit svg { width: 12px; height: 12px; }

/* ===== 提示词输入 ===== */
.prompt-input {
  width: 100%;
  resize: vertical;
  min-height: 76px;
  padding: 12px 14px;
  border: 0.5px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-surface-2);
  color: var(--text-1);
  font-size: 13.5px;
  line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.prompt-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.prompt-input::placeholder { color: var(--text-3); }

.templates { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.tpl-chip {
  font-size: 12px; padding: 5px 11px;
  border-radius: 7px;
  background: var(--bg-surface-2);
  border: 0.5px solid var(--border);
  color: var(--text-2);
  transition: all 0.2s;
}
.tpl-chip:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ===== Select / Pills ===== */
.select {
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-surface-2);
  color: var(--text-1);
  font-size: 13px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 L6 7.5 L9 4.5' fill='none' stroke='%236b6258' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
  cursor: pointer;
}
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }

.count-pills { display: flex; gap: 8px; }
.pill {
  flex: 1;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  color: var(--text-2);
  font-size: 13px;
  transition: all 0.2s;
}
.pill:hover { border-color: var(--border-strong); }
.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}

.batch-hint {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px;
  background: var(--accent-soft);
  border: 0.5px solid var(--accent);
  border-radius: 10px;
  font-size: 12.5px; color: var(--text-2);
  margin-bottom: 16px;
}
.batch-icon { color: var(--accent); font-weight: 700; font-size: 15px; }
.batch-hint b { color: var(--accent); }

/* ===== 主按钮 ===== */
.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 14.5px; font-weight: 600;
  letter-spacing: 0.3px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== 任务面板 ===== */
.tasks-panel { background: var(--bg-page); }
.tasks-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 0.5px solid var(--border);
  flex-wrap: wrap;
}
.filters { display: flex; gap: 4px; background: var(--bg-surface-2); padding: 3px; border-radius: 9px; border: 0.5px solid var(--border); }
.filter {
  padding: 6px 13px; border-radius: 7px;
  font-size: 12.5px; color: var(--text-2);
  transition: all 0.2s;
}
.filter:hover { color: var(--text-1); }
.filter.active { background: var(--bg-surface); color: var(--text-1); font-weight: 500; box-shadow: var(--shadow-sm); }

.search-wrap { position: relative; flex: 1; max-width: 280px; min-width: 140px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-input {
  width: 100%; padding: 8px 12px 8px 32px;
  border: 0.5px solid var(--border); border-radius: 9px;
  background: var(--bg-surface-2); color: var(--text-1);
  font-size: 13px;
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }

.stats { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.stats b { color: var(--text-1); font-weight: 600; }

/* ===== 任务列表 ===== */
.tasks-list {
  flex: 1; overflow-y: auto;
  padding: 18px 22px 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.tasks-list::-webkit-scrollbar { width: 8px; }
.tasks-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* 任务卡片 */
.task-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: all 0.28s ease;
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.task-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.task-head { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; letter-spacing: 0.3px;
}
.badge-queued { background: rgba(165,156,144,0.16); color: var(--status-queued); }
.badge-processing { background: rgba(201,138,58,0.14); color: var(--status-processing); }
.badge-completed { background: rgba(62,122,82,0.14); color: var(--status-completed); }
.badge-failed { background: rgba(196,83,58,0.14); color: var(--status-failed); }
.badge-processing .badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

.task-id { font-size: 11.5px; color: var(--text-3); font-family: ui-monospace, 'SF Mono', monospace; }
.task-meta { margin-left: auto; display: flex; gap: 12px; font-size: 11.5px; color: var(--text-3); }
.task-meta span { display: inline-flex; align-items: center; gap: 3px; }
.task-timer { font-size: 11px; color: var(--status-processing); margin-left: 4px; font-weight: 500; }

.task-prompt {
  font-size: 13px; color: var(--text-1); line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-progress {
  height: 4px; background: var(--bg-surface-2); border-radius: 2px; overflow: hidden;
  margin-bottom: 12px;
}
.task-progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 2px; transition: width 0.5s ease; }

.task-body { display: flex; gap: 14px; align-items: flex-start; }
.task-inputs { display: flex; gap: 6px; flex-shrink: 0; }
.task-input-thumb {
  width: 52px; height: 52px; border-radius: 8px; overflow: hidden;
  border: 0.5px solid var(--border); background: var(--bg-surface-2);
}
.task-input-thumb img { width: 100%; height: 100%; object-fit: cover; }

.task-results { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.result-img {
  width: 92px; height: 122px; border-radius: 9px; overflow: hidden;
  border: 0.5px solid var(--border); background: var(--bg-surface-2);
  cursor: zoom-in; transition: all 0.25s;
  position: relative;
}
.result-img:hover { transform: scale(1.04); border-color: var(--accent); box-shadow: var(--shadow-md); }
.result-img img { width: 100%; height: 100%; object-fit: cover; }
.result-download {
  position: absolute; bottom: 4px; right: 4px;
  width: 26px; height: 26px; border-radius: 7px;
  background: rgba(0,0,0,0.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.result-img:hover .result-download { opacity: 1; }

.task-empty-results {
  font-size: 12px; color: var(--text-3);
  padding: 14px; flex: 1;
  display: flex; align-items: center; gap: 8px;
}

.task-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--border); }
.act-btn {
  font-size: 12px; padding: 6px 12px; border-radius: 7px;
  border: 0.5px solid var(--border); background: var(--bg-surface-2);
  color: var(--text-2);
  display: inline-flex; align-items: center; gap: 5px;
  transition: all 0.2s;
}
.act-btn:hover { color: var(--accent); border-color: var(--accent); }
.act-btn.danger:hover { color: var(--status-failed); border-color: var(--status-failed); }

/* ===== 空状态 ===== */
.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px; color: var(--text-3);
}
.empty-state[hidden] { display: none; }
.empty-illust { color: var(--text-3); margin-bottom: 18px; }
.empty-state h3 { font-size: 16px; color: var(--text-2); font-weight: 500; margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; line-height: 1.7; }

/* ===== Lightbox ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  animation: fadeIn 0.25s ease;
}
.lightbox[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.lightbox-close {
  position: absolute; top: 24px; right: 32px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.12); color: #fff;
  font-size: 26px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text-1); color: var(--bg-page);
  padding: 11px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200; opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast[hidden] { display: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 图片编辑器 ===== */
.editor-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.editor-modal[hidden] { display: none; }
.editor-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
}
.editor-panel {
  position: relative;
  width: 90vw; height: 90vh;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.editor-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg-surface-2);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.editor-title {
  font-size: 14px; font-weight: 600; color: var(--text-1);
  margin-right: 8px;
}

.editor-tools {
  display: flex; gap: 3px;
  flex: 1;
}
.tool-btn {
  padding: 5px 10px; border-radius: 6px;
  font-size: 12px; color: var(--text-2);
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  transition: all 0.2s;
}
.tool-btn:hover { color: var(--text-1); border-color: var(--border-strong); }
.tool-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff; font-weight: 500;
}

.editor-options {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-2);
}
.editor-options label { font-size: 11px; }
.editor-options input[type="color"] {
  width: 28px; height: 24px; border: none; border-radius: 4px;
  background: none; cursor: pointer;
}
.editor-options input[type="range"] { width: 80px; }
.editor-options #brushSizeVal { font-size: 11px; color: var(--text-3); min-width: 16px; }

.editor-close {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--bg-surface); color: var(--text-2);
  font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border: 0.5px solid var(--border);
  margin-left: auto;
}
.editor-close:hover { color: var(--status-failed); border-color: var(--status-failed); }

.editor-body {
  flex: 1; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-page);
  position: relative;
}
#editorCanvas {
  background: #fff;
  cursor: crosshair;
  box-shadow: var(--shadow-md);
  max-width: 100%; max-height: 100%;
}

.editor-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-top: 0.5px solid var(--border);
  background: var(--bg-surface-2);
  flex-shrink: 0;
}
.editor-hint { font-size: 11.5px; color: var(--text-3); }
.editor-footer-actions { display: flex; gap: 10px; }
.btn-secondary {
  padding: 9px 18px; border-radius: 10px;
  background: var(--bg-surface); color: var(--text-2);
  font-size: 13px; border: 1px solid var(--border);
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--border-strong); color: var(--text-1); background: var(--bg-surface-2); }
.btn-primary { /* already defined */ }

/* ===== 编排弹窗 ===== */
.orch-modal { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; }
.orch-modal[hidden] { display: none; }
.orch-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(6px); }
.orch-panel { position: relative; width: 95vw; height: 90vh; background: var(--bg-surface); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.orch-header-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 0.5px solid var(--border); background: var(--bg-surface-2); }
.orch-header-bar h2 { font-size: 16px; }
.orch-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.orch-close-btn { padding: 6px 14px; border-radius: 8px; background: var(--bg-surface); border: 0.5px solid var(--border); color: var(--text-2); font-size: 13px; }
.orch-body { flex: 1; display: flex; overflow: hidden; }
.orch-left { flex: 1; overflow-y: auto; padding: 16px; }
.orch-right { width: 240px; border-left: 0.5px solid var(--border); overflow-y: auto; padding: 16px; background: var(--bg-surface-2); }
.orch-pipeline-title, .orch-pool-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }
.orch-row { display: flex; align-items: center; gap: 8px; padding: 8px; border: 0.5px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--bg-surface-2); }
.orch-row .row-num { font-size: 12px; font-weight: 600; color: var(--text-3); width: 24px; text-align: center; }
.orch-slot { width: 60px; height: 60px; border-radius: 8px; border: 1px dashed var(--border); position: relative; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.orch-slot.main { border: 2px solid var(--accent); }
.orch-slot.drop.dragover { border-color: var(--accent); background: var(--accent-soft); }
.orch-slot img { width: 100%; height: 100%; object-fit: cover; }
.orch-slot .slot-label { font-size: 10px; color: var(--text-3); }
.orch-slot .slot-remove { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; line-height: 1; display: flex; align-items: center; justify-content: center; border: none; }
.orch-row .arrow { color: var(--text-3); font-size: 14px; }
.orch-row .row-clear { font-size: 11px; padding: 4px 8px; border-radius: 5px; background: var(--bg-surface); border: 0.5px solid var(--border); color: var(--text-3); margin-left: auto; }
.orch-row .row-clear:hover { color: var(--status-failed); border-color: var(--status-failed); }
.pool-item { width: 100%; height: 70px; border-radius: 8px; overflow: hidden; position: relative; margin-bottom: 8px; cursor: grab; border: 0.5px solid var(--border); }
.pool-item img { width: 100%; height: 100%; object-fit: cover; }
.pool-item .pool-tag { position: absolute; bottom: 2px; left: 2px; font-size: 10px; background: rgba(0,0,0,0.6); color: #fff; padding: 1px 5px; border-radius: 3px; }
.orch-footer-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 0.5px solid var(--border); background: var(--bg-surface-2); }
.orch-hint { font-size: 11.5px; color: var(--text-3); }
.orch-footer-actions { display: flex; gap: 10px; }

/* ===== 对比查看弹窗 ===== */
.compare-modal { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; }
.compare-modal[hidden] { display: none; }
.compare-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.9); }
.compare-panel { position: relative; width: 95vw; height: 90vh; display: flex; align-items: center; justify-content: center; }
.compare-close { position: absolute; top: 20px; right: 30px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.12); color: #fff; font-size: 26px; z-index: 10; }
.compare-body { display: flex; gap: 20px; max-width: 100%; max-height: 100%; overflow: auto; }
.compare-body img { max-width: 45vw; max-height: 85vh; border-radius: 8px; object-fit: contain; }
.compare-label { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; background: rgba(0,0,0,0.5); padding: 4px 12px; border-radius: 6px; }

/* ===== 登录弹窗 ===== */
.login-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.login-modal[hidden] { display: none; }
.login-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}
.login-panel {
  position: relative;
  width: 360px;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.login-panel h2 { font-size: 18px; font-weight: 600; margin-bottom: 20px; text-align: center; }
.login-panel input {
  width: 100%; padding: 11px 14px; margin-bottom: 12px;
  border: 0.5px solid var(--border-strong); border-radius: 10px;
  background: var(--bg-surface-2); color: var(--text-1);
  font-size: 14px;
}
.login-panel input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.login-hint { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 12px; }

/* ===== 积分 / 导航 ===== */
.credits {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--accent);
  padding: 5px 11px;
  background: var(--accent-soft);
  border: 0.5px solid var(--accent);
  border-radius: 20px; font-weight: 600;
}
.credits-icon { font-size: 10px; }
.nav-link {
  font-size: 12.5px; color: var(--text-2);
  padding: 6px 12px; border-radius: 8px;
  border: 0.5px solid var(--border);
  background: var(--bg-surface-2);
  text-decoration: none;
  transition: all 0.2s;
}
.nav-link:hover { color: var(--accent); border-color: var(--accent); }

/* ===== 图槽清空按钮 ===== */
.clear-slot {
  margin-left: auto;
  font-size: 11px; padding: 2px 8px;
  border-radius: 5px;
  background: var(--bg-surface-2);
  border: 0.5px solid var(--border);
  color: var(--text-3);
  transition: all 0.2s;
}
.clear-slot:hover { color: var(--status-failed); border-color: var(--status-failed); }

/* ===== 提示词标签 ===== */
.prompt-tags { display: flex; gap: 5px; margin-top: 8px; }
.prompt-tag {
  font-size: 11px; padding: 3px 9px;
  border-radius: 5px;
  background: var(--bg-surface-2);
  border: 0.5px solid var(--border);
  color: var(--text-2);
  transition: all 0.2s;
}
.prompt-tag:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ===== 图像编排 ===== */
.orchestrate-panel {
  margin-top: 20px; padding-top: 16px;
  border-top: 0.5px solid var(--border);
}
.orchestrate-panel[hidden] { display: none; }
.orchestrate-hint { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.orchestrate-cols {
  display: flex; gap: 8px;
  overflow-x: auto; padding-bottom: 4px;
}
.orch-col {
  min-width: 100px; flex: 1;
  background: var(--bg-surface-2);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}
.orch-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 600; color: var(--text-2);
  margin-bottom: 6px;
}
.orch-clear {
  font-size: 10px; padding: 1px 5px;
  border-radius: 3px; background: var(--bg-surface);
  border: 0.5px solid var(--border); color: var(--text-3);
}
.orch-clear:hover { color: var(--status-failed); border-color: var(--status-failed); }
.orch-drop {
  min-height: 60px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 4px;
}
.orch-drop .thumb { width: 48px; height: 48px; }
.orch-actions { margin-top: 10px; text-align: right; }

/* ===== 拖拽占位 ===== */
.drag-ghost { opacity: 0.5; }

/* ===== 编排弹窗 ===== */
.orch-modal {
  position: fixed; inset: 0; z-index: 1500;
  display: flex; align-items: center; justify-content: center;
}
.orch-modal[hidden] { display: none; }
.orch-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}
.orch-panel {
  position: relative;
  width: 92vw; height: 90vh;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.orch-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.orch-header-bar h2 { font-size: 16px; font-weight: 600; }
.orch-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.orch-close-btn {
  padding: 7px 14px; border-radius: 8px;
  background: var(--bg-surface-2); border: 0.5px solid var(--border);
  color: var(--text-2); font-size: 13px;
}
.orch-body {
  flex: 1; display: flex; overflow: hidden;
}
.orch-left {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  border-right: 0.5px solid var(--border);
}
.orch-right {
  width: 220px; overflow-y: auto; padding: 16px;
  background: var(--bg-surface-2);
  flex-shrink: 0;
}
.orch-pipeline-title {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  margin-bottom: 12px;
}
.orch-pipeline {
  display: flex; flex-direction: column; gap: 12px;
}
.orch-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface-2);
  border: 0.5px solid var(--border);
  border-radius: 10px;
}
.orch-row-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.orch-row-slots {
  display: flex; gap: 8px; flex: 1; overflow-x: auto;
}
.orch-row-slot {
  width: 60px; height: 60px; border-radius: 8px;
  border: 1.5px dashed var(--border-strong);
  background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-3);
  flex-shrink: 0; cursor: pointer;
  transition: all 0.2s; overflow: hidden; position: relative;
}
.orch-row-slot:hover { border-color: var(--accent); }
.orch-row-slot.active { border-color: var(--accent); background: var(--accent-soft); }
.orch-row-slot img { width: 100%; height: 100%; object-fit: cover; }
.orch-row-slot .slot-label {
  position: absolute; bottom: 2px; left: 2px; right: 2px;
  font-size: 9px; text-align: center; background: rgba(0,0,0,0.5);
  color: #fff; border-radius: 3px; padding: 1px 0;
}
.orch-row-clear {
  font-size: 11px; padding: 4px 8px; border-radius: 5px;
  background: var(--bg-surface); border: 0.5px solid var(--border);
  color: var(--text-3); flex-shrink: 0;
}
.orch-row-clear:hover { color: var(--status-failed); border-color: var(--status-failed); }
.orch-pool-title {
  font-size: 13px; font-weight: 600; margin-bottom: 10px;
}
.orch-pool-group {
  margin-bottom: 14px;
}
.orch-pool-group-label {
  font-size: 11px; color: var(--text-3); margin-bottom: 6px;
}
.orch-pool-items {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.orch-pool-item {
  width: 48px; height: 48px; border-radius: 6px;
  overflow: hidden; border: 0.5px solid var(--border);
  cursor: grab; flex-shrink: 0;
}
.orch-pool-item img { width: 100%; height: 100%; object-fit: cover; }
.orch-pool-empty {
  font-size: 11px; color: var(--text-3); padding: 8px 0;
}
.orch-footer-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-top: 0.5px solid var(--border);
  flex-shrink: 0;
}
.orch-hint { font-size: 12px; color: var(--text-3); }
.orch-footer-actions { display: flex; gap: 10px; }

/* ===== 对比查看弹窗 ===== */
.compare-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.compare-modal[hidden] { display: none; }
.compare-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
}
.compare-panel {
  position: relative; width: 90vw; height: 90vh;
  display: flex; flex-direction: column;
}
.compare-close {
  position: absolute; top: 10px; right: 20px; z-index: 10;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.15); color: #fff;
  font-size: 24px; display: flex; align-items: center; justify-content: center;
}
.compare-body {
  flex: 1; display: flex; gap: 20px; padding: 20px;
  overflow: auto; align-items: center; justify-content: center;
}
.compare-side {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  max-height: 100%;
}
.compare-side-label {
  font-size: 13px; color: #fff; margin-bottom: 8px; opacity: 0.8;
}
.compare-side img {
  max-width: 100%; max-height: calc(90vh - 60px);
  border-radius: 8px; object-fit: contain;
}

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .create-panel { border-right: none; border-bottom: 0.5px solid var(--border); max-height: 50vh; }
  .tasks-toolbar { padding: 12px 16px; }
  .tasks-list { padding: 14px 16px 22px; }
  .stats { display: none; }
  .topbar-actions .nav-link { display: none; }
  .orch-panel { width: 98vw; height: 95vh; }
  .orch-right { width: 160px; }
}
