:root {
  /* ══════════════════════════════════════════════════
     工美数字 · WDD 设计规范 v1.0
     风格: 大气 · 简约 · 工艺美术 · 高级定制
     暖金为骨 · 象牙为面 · 留白为韵 · 字体为魂
     ══════════════════════════════════════════════════ */

  /* ██ 色彩 — 暖金调色板 */
  --gold: #B8945C;
  --gold-dark: #9A7B4A;
  --champagne: #D4C5B2;
  --blush: #EDE0D4;
  --charcoal: #1A1817;
  --ink: #2D2A28;
  --mist: #8C8883;
  --border: #E8E3DB;
  --cream: #FAF8F5;
  --ivory: #F5F0EA;
  --surface: #FFFFFF;
  --surface-alt: #F9F7F4;

  /* ██ 语义色 */
  --success: #3A6B3A;
  --warning: #C9953D;
  --error: #C25450;
  /* 兼容旧变量名 */
  --success-bg: #EDF5EC;
  --success-text: #3A6B3A;
  --loading-bg: #FDF8ED;
  --loading-text: #8A7518;
  --error-bg: #FDF0EF;
  --error-text: #9B3D3A;
  --primary: var(--gold);
  --danger: var(--error);

  /* ██ 字体 */
  --font-display: 'Georgia', 'Noto Serif SC', 'Times New Roman', serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* ██ 字号层级 (modular scale 1.125) */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;

  /* ██ 字重 */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* ██ 间距 (4px 基准) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ██ 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  /* 兼容旧变量名 */
  --radius: var(--radius-md);

  /* ██ 阴影 — 使用暖灰 rgba(26,24,23,...) 而非冷灰 */
  --shadow-sm: 0 1px 2px rgba(26,24,23,0.04);
  --shadow-md: 0 2px 8px rgba(26,24,23,0.06), 0 1px 2px rgba(26,24,23,0.04);
  --shadow-lg: 0 4px 24px rgba(26,24,23,0.08), 0 1px 4px rgba(26,24,23,0.04);
  --shadow-xl: 0 8px 40px rgba(26,24,23,0.10), 0 2px 8px rgba(26,24,23,0.06);
  /* 兼容旧变量名（旧代码用的 --shadow 不带后缀） */
  --shadow: var(--shadow-md);

  /* ██ 动画 */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-instant: 100ms;
  --duration-fast: 200ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--charcoal);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
}

/* ===== HEADER ===== */
.header {
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.logo {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-sub { font-family: var(--font-body); font-size: 11px; color: var(--mist); letter-spacing: 0.06em; }
.header-right { display: flex; align-items: center; gap: 12px; }
.model-badge {
  font-size: 11px; color: var(--mist); padding: 5px 12px; height: 32px;
  background: var(--surface-alt); border-radius: 20px; border: 1px solid var(--border); cursor: pointer;
}
.model-select-wrap {
  display: flex; align-items: center; gap: var(--space-1);
  position: relative;
}
.model-capability-hint {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: var(--radius-full);
  background: var(--surface-alt); border: 1px solid var(--border);
  cursor: pointer; color: var(--champagne); transition: all var(--duration-fast);
  flex-shrink: 0;
}
.model-capability-hint:hover { border-color: var(--gold); color: var(--gold); background: rgba(184,148,92,0.06); }

.model-cap-popover {
  display: none;
  position: absolute; top: 52px; right: 60px; width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 500; overflow: hidden;
}
.model-cap-popover.show { display: block; }
.model-cap-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border);
  font-size: var(--text-md); font-weight: var(--weight-medium); color: var(--ink);
}
.model-cap-close {
  background: none; border: none; font-size: 20px; color: var(--mist);
  cursor: pointer; padding: 0; line-height: 1; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}
.model-cap-close:hover { background: var(--surface-alt); color: var(--ink); }
.model-cap-body {
  padding: var(--space-4); max-height: 420px; overflow-y: auto;
}
.model-cap-model {
  margin-bottom: var(--space-4); padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.model-cap-model:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.model-cap-model-title {
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.model-cap-model-name {
  font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--ink);
}
.model-cap-current-badge {
  font-size: var(--text-xs); padding: 2px 8px; border-radius: var(--radius-full);
  background: rgba(184,148,92,0.1); color: var(--gold-dark);
  font-weight: var(--weight-medium); letter-spacing: 0.02em;
}
.model-cap-rec-badge {
  font-size: var(--text-xs); padding: 2px 8px; border-radius: var(--radius-full);
  background: rgba(184,148,92,0.06); color: var(--gold);
  font-weight: var(--weight-medium); margin-top: var(--space-1);
  display: inline-block;
}
.model-cap-tags {
  display: flex; flex-wrap: wrap; gap: var(--space-1);
  margin-bottom: var(--space-2);
}
.model-cap-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--text-xs); padding: 2px 8px; border-radius: var(--radius-sm);
  font-weight: var(--weight-medium); letter-spacing: 0.02em;
}
.model-cap-tag-yes { background: rgba(58,107,58,0.08); color: var(--success); }
.model-cap-tag-no { background: rgba(194,84,80,0.06); color: var(--error); }
.model-cap-tag-partial { background: rgba(201,149,61,0.08); color: var(--warning); }
.model-cap-tag-icon { font-size: 10px; }
.model-cap-desc {
  font-size: var(--text-sm); color: var(--mist); line-height: 1.6;
  margin: 0;
}
.header-icon-btn {
  background: none; border: none; cursor: pointer; color: var(--mist); padding: 6px;
  border-radius: 6px; display: flex; align-items: center; transition: all 0.2s;
}
.header-icon-btn:hover { background: var(--surface-alt); color: var(--ink); }
.header-text-btn {
  background: none; border: 1px solid transparent; cursor: pointer;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  font-family: var(--font-body);
  height: 30px; padding: 0 10px; border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
  letter-spacing: 0.03em; display: flex; align-items: center;
}
.header-text-btn:hover { background: var(--surface-alt); border-color: var(--border); }

/* ██ 场景切换开关（分段控件） */
.scenario-switch {
  display: flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 10px;
  gap: 2px;
}
.scenario-switch-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--mist);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}
.scenario-switch-btn:hover {
  color: var(--ink);
  background: rgba(184, 148, 92, 0.06);
}
.scenario-switch-btn.active {
  color: var(--charcoal);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-weight: 600;
}
.scenario-switch-btn.active svg {
  stroke: var(--gold);
}

/* ██ 场景一：分析后双Tab */
.s1-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  gap: 0;
}
.s1-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--mist);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}
.s1-tab:hover {
  color: var(--ink);
}
.s1-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  font-weight: 600;
}
.s1-tab-content {
  min-height: 60px;
}

/* ===== SCENARIO BADGE ===== */
.scenario-badge {
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: 10px;
}
.scenario-icon {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: var(--radius-full);
  background: var(--gold); color: white;
  font-size: 12px; font-weight: var(--weight-bold); line-height: 1;
  flex-shrink: 0;
}
.scenario-label {
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--ink); letter-spacing: 0.04em;
}

/* ===== FILTER TOGGLE ===== */
.filter-toggle-label {
  font-size: 11px; font-weight: var(--weight-medium);
  color: var(--mist); letter-spacing: 0.03em;
  transition: color 0.2s;
}
.filter-toggle input:checked ~ .filter-toggle-label {
  color: var(--gold-dark);
}

/* ===== MAIN LAYOUT ===== */
.app-body {
  display: flex;
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* ===== LEFT PANEL ===== */
.left-panel {
  width: clamp(280px, 280px + (100vw - 1024px) * 0.14, 420px);
  min-width: 280px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.left-panel-header {
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.left-panel-title {
  font-family: var(--font-display);
  font-size: 18px; letter-spacing: 0.02em; color: var(--ink);
}
.left-panel-sub { font-size: 12px; color: var(--mist); margin-top: 2px; }

.form-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 20px;
  -ms-overflow-style: none;
  scrollbar-width: thin;
}
.form-scroll::-webkit-scrollbar { width: 4px; }
.form-scroll::-webkit-scrollbar-thumb { background: var(--champagne); border-radius: 4px; }

/* ===== FORM ===== */
.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--surface-alt);
  transition: box-shadow 0.2s;
}
.form-section:hover { box-shadow: var(--shadow-sm); }
.section-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--mist);
  padding: 10px 14px 0;
}
.form-body { padding: 10px 14px 12px; }
.form-group { margin-bottom: 10px; min-width: 0; }
.form-group:last-child { margin-bottom: 0; }
.form-label { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 4px; display: block; }
.form-label .optional { font-weight: 400; color: var(--mist); font-size: 10px; }

select.form-input, textarea.form-input, input.form-input {
  width: 100%; padding: 8px 30px 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--surface); color: var(--ink);
  font-family: var(--font-body); transition: all 0.2s;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  min-height: 36px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238C8883' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
select.form-input:focus, textarea.form-input:focus, input.form-input:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(184,148,92,0.1);
}
textarea.form-input { min-height: 56px; resize: vertical; background-image: none; overflow: hidden; }
input.form-input { background-image: none; padding-right: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.custom-input { display: none; margin-top: 4px; }
.custom-input-row { display: none; margin-top: 6px; flex-direction: column; gap: 6px; }
.custom-input-row.show { display: flex; }
.custom-input-row .form-input { width: 100%; }
.custom-input-row .mat-select-btn { width: 100%; justify-content: center; }
/* Auto-resize textareas for custom inputs & special field */
textarea.custom-input { min-height: 32px; overflow: hidden; resize: none; }
.custom-input-row textarea.form-input { min-height: 32px; overflow: hidden; resize: none; }

/* Material thumbnail preview in form field */
.mat-thumb-preview {
  display: none; margin-top: 4px; padding: 4px;
  border: 1px solid var(--gold); border-radius: var(--radius-sm);
  background: #FDF9F3; align-items: center; gap: 8px;
  position: relative;
  max-width: 100%;
  box-sizing: border-box;
}
.mat-thumb-preview.show { display: flex; }
.mat-thumb-preview img {
  width: 44px; height: 44px; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--border);
  flex-shrink: 0;
}
.mat-thumb-info { flex: 1; min-width: 0; }
.mat-thumb-info .mat-thumb-name {
  font-size: 12px; color: var(--ink); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mat-thumb-info .mat-thumb-tags {
  font-size: 10px; color: var(--mist); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mat-thumb-remove {
  position: absolute; top: 2px; right: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.08); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--mist); line-height: 1;
  transition: all 0.15s;
}
.mat-thumb-remove:hover { background: rgba(194,84,80,0.15); color: var(--error); }
.custom-input.show { display: block; }

/* ===== RECOGNITION RESULTS PANEL (已迁移至字段选择，保留badge调用) ===== */
.recog-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: #E8F5E9; color: #2E7D32;
  margin-left: auto;
}
.recog-badge.warn {
  background: #FFF3E0; color: #E65100;
}

/* ===== TOGGLE SWITCH (报告/编辑模式) ===== */
.toggle-switch {
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer; user-select: none; flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: relative; width: 32px; height: 18px;
  background: var(--border); border-radius: 10px;
  transition: background 0.2s;
}
.toggle-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--gold); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(14px); }
/* toggle-switch 已迁移，保留占位 */

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.main-content .right-panel {
  flex: 1;
  min-width: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--cream);
  position: relative;
}

/* 分组卡片 */
.report-groups { display: flex; flex-direction: column; gap: 8px; }

.report-group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.report-group-card:hover { box-shadow: 0 2px 12px rgba(26,24,23,0.04); }

.report-group-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 9px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}
.report-group-header::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; border-radius: 0 2px 2px 0;
}
.report-group-card[data-group="廓形结构"] .report-group-header { color: #6B7B8D; }
.report-group-card[data-group="廓形结构"] .report-group-header::before { background: #6B7B8D; }
.report-group-card[data-group="面料材质"] .report-group-header { color: #7B8F6E; }
.report-group-card[data-group="面料材质"] .report-group-header::before { background: #7B8F6E; }
.report-group-card[data-group="装饰细节"] .report-group-header { color: #B8847A; }
.report-group-card[data-group="装饰细节"] .report-group-header::before { background: #B8847A; }
.report-group-card[data-group="工艺结构"] .report-group-header { color: #8A7B9E; }
.report-group-card[data-group="工艺结构"] .report-group-header::before { background: #8A7B9E; }
.report-group-card[data-group="其他信息"] .report-group-header { color: var(--mist); }
.report-group-card[data-group="其他信息"] .report-group-header::before { background: var(--champagne); }

.report-group-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.report-group-header .group-count {
  margin-left: auto;
  font-size: 10px; font-weight: 500; color: var(--mist);
  background: var(--surface-alt); padding: 1px 8px;
  border-radius: 10px; letter-spacing: normal;
}

.report-group-body { padding: 6px 14px 8px; }

.report-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #F0EDE7;
  position: relative;
}
.report-item:last-child { border-bottom: none; }

.report-item-status {
  flex-shrink: 0; width: 16px; height: 16px;
  margin-top: 2px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.report-item-status.mapped { background: #EDF5EC; color: #3A6B3A; }
.report-item-status.unmapped { background: #FEF6EE; color: #B87A3A; }
.report-item-status svg { width: 10px; height: 10px; }

.report-item-label {
  flex-shrink: 0; font-size: 11px; color: var(--mist);
  min-width: 48px; padding-top: 1px;
}
.report-item-value {
  font-size: 12px; color: var(--ink); line-height: 1.5;
  word-break: break-word;
}
.report-item-value.mapped { color: var(--charcoal); font-weight: 500; }
.report-item-value.unmapped { color: var(--charcoal); }

/* ===== (已移除：概览表、摘要、标注、问题区 — 信息已合并到分组卡片+标签) ===== */



/* ===== (已移除：手写标注转录 + 问题与建议 — 信息已整合到分组卡片+标签) ===== */

/* ===== 三级状态标记（替换原来 mapped/unmapped） ===== */
.report-item-status.confirmed { background: #EDF5EC; color: #3A6B3A; }
.report-item-status.ambiguous { background: #FEF6EE; color: #B87A3A; }
.report-item-status.conflict { background: #FDEDED; color: #C0392B; }


/* ===== 标签区 ===== */
.report-tags-section { margin-top: 4px; }
.report-tags-title { font-size: 11px; font-weight: 500; color: var(--mist); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.report-tags-hint { font-size: 10px; color: var(--charcoal); font-weight: 400; opacity: 0.6; }
.report-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.report-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 4px 10px;
  border-radius: 14px; background: #F5F2ED;
  border: 1px solid #E8E3DB; color: var(--ink); cursor: pointer;
  transition: all 0.15s; max-width: 180px; user-select: none;
}
.report-tag:hover { background: #EDE6D9; border-color: #D4C5B2; }
.report-tag.is-mapped {
  background: #F0F5EE; border-color: #D0DEC9; color: #3A6B3A;
}
.report-tag.is-mapped:hover { background: #E4EFE2; border-color: #B8D0AD; }
.report-tag .tag-remove {
  font-size: 12px; color: var(--mist); cursor: pointer;
  line-height: 1; margin-left: 2px; opacity: 0.5; transition: all 0.15s;
}
.report-tag .tag-remove:hover { color: #C25450; opacity: 1; }
.report-tag.editing { padding: 2px; border: none; background: none; max-width: none; cursor: default; }
.report-tag input.tag-input {
  width: 100px; padding: 3px 8px; font-size: 11px;
  border: 1px solid var(--gold); border-radius: 8px; outline: none; background: #fff;
  font-family: inherit;
}
.report-tag.tag-ghost {
  border-style: dashed; border-color: #D4C5B2;
  color: var(--mist); font-size: 11px; background: transparent; padding: 4px 10px;
}
.report-tag.tag-ghost:hover { border-color: var(--gold); color: var(--gold-dark); background: #FDF9F3; }



/* Color Picker */
.color-palette-section { margin-top: 8px; }
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.color-picker-input {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: none;
}
.color-picker-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-input::-webkit-color-swatch { border: none; border-radius: 4px; }

.color-palette-panel.show { display: block; }
.palette-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  margin-bottom: 10px;
}
.palette-swatch {
  aspect-ratio: 1; border-radius: 4px; cursor: pointer;
  border: 2px solid transparent; transition: all 0.15s;
  position: relative;
}
.palette-swatch:hover { transform: scale(1.15); z-index: 1; }
.palette-swatch.selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,148,92,0.3); }
.palette-swatch[title]::after {
  content: attr(title); position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); padding: 2px 6px; border-radius: 3px;
  background: var(--charcoal); color: #fff; font-size: 10px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 2;
}
.palette-swatch:hover::after { opacity: 1; }
.palette-divider {
  height: 1px; background: var(--border); margin: 8px 0;
}
.palette-label { font-size: 10px; color: var(--mist); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.custom-color-row {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.custom-color-row input[type="color"] {
  width: 32px; height: 32px; border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer; padding: 2px; background: var(--surface);
}
.color-hex-display {
  flex: 1; display: flex; align-items: center; gap: 6px;
}
.color-hex-value {
  font-size: 12px; font-weight: 600; font-family: 'Courier New', monospace;
  color: var(--ink); padding: 4px 8px; border-radius: 4px;
  background: var(--surface-alt); border: 1px solid var(--border);
  letter-spacing: 0.5px;
}
.color-hex-name {
  font-size: 11px; color: var(--mist);
}
.color-preview-bar {
  height: 6px; border-radius: 3px; margin-top: 6px;
  transition: background-color 0.3s;
}
.color-clear-btn {
  font-size: 10px; color: var(--mist); cursor: pointer;
  padding: 2px 6px; border-radius: 3px; border: 1px solid var(--border);
  background: var(--surface); transition: all 0.15s;
}
.color-clear-btn:hover { border-color: var(--error); color: var(--error); }

/* Material Library Drawer */
.mat-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.mat-drawer-overlay.show { opacity: 1; pointer-events: auto; }
.mat-drawer {
  position: fixed; top: 0; right: 0; width: 500px; max-width: 92vw;
  height: 100vh; background: var(--surface-alt); z-index: 7001;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  display: flex; flex-direction: column;
  transform: translateX(100%); visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.3s;
  will-change: transform; backface-visibility: hidden;
}
.mat-drawer.show {
  transform: translateX(0); visibility: visible;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
}
.mat-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.mat-drawer-header h3 {
  font-size: 14px; font-weight: 600; color: var(--ink); margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.mat-drawer-header h3 svg { width: 16px; height: 16px; color: var(--gold); }
.mat-drawer-close {
  width: 28px; height: 28px; border: none; background: none; cursor: pointer;
  color: var(--mist); font-size: 18px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.mat-drawer-close:hover { background: var(--surface-alt); color: var(--ink); }
.mat-drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* Upload area */
.mat-upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer;
  transition: all 0.2s; margin-bottom: 16px; background: var(--surface);
}
.mat-upload-zone:hover { border-color: var(--gold); background: #FDF9F3; }
.mat-upload-zone svg { width: 32px; height: 32px; color: var(--mist); margin-bottom: 8px; }
.mat-upload-zone p { font-size: 12px; color: var(--mist); margin: 0; }
.mat-upload-zone .hint { font-size: 10px; color: var(--mist); margin-top: 4px; }

/* Upload form (shown after image selected) */
.mat-upload-form {
  display: none; margin-bottom: 16px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.mat-upload-form.show { display: block; }
.mat-upload-preview {
  width: 80px; height: 80px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); margin-bottom: 10px;
}
.mat-upload-form .form-group { margin-bottom: 8px; }
.mat-upload-form .form-label { font-size: 11px; }
.mat-upload-form .form-input { font-size: 12px; padding: 6px 10px; }
.mat-desc-textarea {
  width: 100%; min-height: 60px; resize: vertical;
  font-size: 12px; padding: 8px 10px; line-height: 1.5;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-family: inherit;
  field-sizing: content; /* 现代浏览器自适应高度 */
}
.mat-desc-textarea:focus { outline: none; border-color: var(--gold); }
.mat-desc-textarea:disabled { background: #f0ece6; color: var(--mist); }
.mat-recognize-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 5px 12px; border-radius: 14px;
  border: 1px solid var(--gold); background: #FDF5E6; color: #8B6914;
  cursor: pointer; transition: all 0.15s; margin-bottom: 6px;
}
.mat-recognize-btn:hover { background: #F5E6C8; }
.mat-recognize-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mat-recognize-btn svg { width: 12px; height: 12px; }

/* Tag input */
.mat-tag-container {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
  padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); min-height: 32px;
}
.mat-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 10px; font-size: 10px;
  background: #F0E6D6; color: var(--ink); border: 1px solid var(--champagne);
}
.mat-tag .mat-tag-remove {
  cursor: pointer; font-size: 12px; line-height: 1;
  color: var(--mist); margin-left: 2px;
}
.mat-tag .mat-tag-remove:hover { color: var(--error); }
.mat-tag-presets {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px;
}
.mat-tag-preset {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--mist); cursor: pointer; transition: all 0.15s;
}
.mat-tag-preset:hover { border-color: var(--gold); color: var(--gold); background: #FDF9F3; }
.mat-tag-preset.used { background: #F0E6D6; color: var(--ink); border-color: var(--champagne); }

/* Material grid */
.mat-toolbar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  flex-wrap: wrap;
}
.mat-filter-btn {
  font-size: 10px; padding: 3px 10px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--mist); cursor: pointer; transition: all 0.15s;
}
.mat-filter-btn:hover { border-color: var(--gold); color: var(--gold); }
.mat-filter-btn.active { background: var(--gold); color: #fff; border-color: var(--gold); }
.mat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.mat-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden; cursor: pointer;
  transition: all 0.2s; position: relative;
}
.mat-card:hover { box-shadow: var(--shadow); border-color: var(--gold); }
.mat-card.selectable:hover { transform: translateY(-2px); }
.mat-card-img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-bottom: 1px solid var(--border);
}
.mat-card-body { padding: 8px; }
.mat-card-name {
  font-size: 11px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mat-card-desc {
  font-size: 9px; color: var(--mist); line-height: 1.4;
  margin-top: 2px; max-height: 26px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.mat-card-tags {
  display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px;
}
.mat-card-tag {
  font-size: 9px; padding: 1px 5px; border-radius: 6px;
  background: #F0E6D6; color: var(--ink);
}
.mat-card-actions {
  position: absolute; top: 4px; right: 4px; display: flex; gap: 2px;
  opacity: 0; transition: opacity 0.15s;
}
.mat-card:hover .mat-card-actions { opacity: 1; }
.mat-card-action {
  width: 22px; height: 22px; border-radius: 4px; border: none;
  background: rgba(255,255,255,0.9); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--mist);
}
.mat-card-action:hover { background: #fff; color: var(--error); }
.mat-card-action.select-action:hover { color: var(--gold); }

/* Empty state */
.mat-empty {
  text-align: center; padding: 40px 20px; color: var(--mist);
}
.mat-empty svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.mat-empty p { font-size: 12px; }

/* "进入素材库" entry button in section header */
.mat-lib-entry {
  margin-left: auto; font-size: 10px; cursor: pointer;
  border: 1px solid var(--champagne); background: #FDF9F3;
  color: var(--gold-dark); border-radius: 10px; padding: 2px 10px;
  display: inline-flex; align-items: center; gap: 3px;
  transition: all 0.2s; white-space: nowrap;
}
.mat-lib-entry:hover { border-color: var(--gold); background: #F5EDE0; }

/* "从素材库选择" inline button next to input */
.mat-select-btn {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; color: var(--gold-dark); cursor: pointer;
  padding: 5px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--champagne); background: #FDF9F3;
  transition: all 0.2s; user-select: none; white-space: nowrap;
  flex-shrink: 0;
}
.mat-select-btn:hover { border-color: var(--gold); background: #F5EDE0; }
.mat-select-btn svg { width: 10px; height: 10px; }

/* Highlight auto-filled fields */
.form-input.auto-filled {
  border-color: var(--gold);
  background: #FDF9F3;
  transition: all 0.3s;
}

/* Upload */
.upload-zone {
  border: 2px dashed var(--champagne); border-radius: var(--radius);
  padding: 20px 14px; text-align: center; cursor: pointer;
  transition: all 0.25s; background: var(--surface); position: relative;
  margin-bottom: 10px;
}
.upload-zone:hover { border-color: var(--gold); background: #FDF9F3; }
.upload-zone.has-file { border-style: solid; border-color: var(--gold); background: #FDF9F3; }
.upload-icon { width: 36px; height: 36px; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--blush); }
.upload-icon svg { width: 16px; height: 16px; color: var(--gold-dark); }
.upload-text { font-size: 12px; color: var(--ink); }
.upload-hint { font-size: 10px; color: var(--mist); margin-top: 2px; }
.upload-name { font-size: 11px; color: var(--gold-dark); margin-top: 4px; font-weight: 500; display: none; }
.upload-zone.has-file .upload-name { display: block; }
.upload-zone.has-file .upload-text { color: #4A7A5A; }
.upload-zone.has-file .upload-icon { background: #E0EDE0; }
.upload-zone.has-file .upload-icon svg { color: #4A7A5A; }

/* Sketch thumbnails */
.sketch-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.sketch-thumb {
  width: 52px; height: 52px; border-radius: 4px; overflow: hidden;
  cursor: pointer; border: 2px solid transparent; opacity: 0.6; transition: all 0.2s;
  position: relative;
}
.sketch-thumb.primary { border-color: var(--gold); opacity: 1; }
.sketch-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sketch-thumb .badge {
  position: absolute; top: 1px; right: 1px; background: var(--gold); color: #fff;
  font-size: 8px; padding: 0 3px; border-radius: 2px;
}

/* Action buttons */
.left-panel-actions {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.left-panel-actions .btn-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
}
/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 40px; font-size: 12px;
  font-weight: 500; cursor: pointer; border: none; transition: all 0.2s;
  font-family: var(--font-body); white-space: nowrap; min-height: 34px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--ink); color: #fff; flex: 1; padding: 9px 12px; font-size: 12px;
}
.btn-primary:hover { background: #3D3A37; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-gold { background: var(--gold); color: #fff; flex: 1; padding: 9px 12px; font-size: 12px; }
.btn-gold:hover { background: var(--gold-dark); }
.btn-gold:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-danger { background: #c0392b; color: #fff; flex: 0; padding: 9px 14px; font-size: 12px; }
.btn-danger:hover { background: #a93226; }
.btn-danger svg { width: 14px; height: 14px; }
.btn-outline-gold { background: transparent; border: 1px solid var(--gold); color: var(--gold-dark); width: 100%; padding: 10px 20px; font-size: 12px; }
.btn-outline-gold:hover { background: #FDF9F3; }
.btn-outline-gold:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-alt); border-color: var(--champagne); }
.btn-icon {
  width: 32px; height: 32px; padding: 0; border-radius: 8px;
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover { background: var(--blush); border-color: var(--champagne); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-sm { font-size: 11px; padding: 6px 14px; }

/* ===== RIGHT PANEL ===== */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--cream);
  position: relative;
}

/* Workspace top bar */
.workspace-topbar {
  height: 44px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  flex-shrink: 0;
}
.ws-tab {
  font-size: 12px; padding: 6px 14px; border-radius: 6px; cursor: pointer;
  color: var(--mist); background: transparent; border: none;
  font-family: var(--font-body); font-weight: 500; transition: all 0.15s;
  position: relative;
}
.ws-tab:hover { color: var(--ink); background: var(--surface-alt); }
.ws-tab.active { color: var(--ink); background: var(--ivory); }
.ws-tab .tab-count {
  position: absolute; top: 2px; right: 2px;
  font-size: 8px; background: var(--gold); color: #fff;
  min-width: 14px; height: 14px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* Task selector in top bar */
.task-selector-wrap {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto; margin-right: 12px;
}
.task-selector-label { font-size: 11px; color: var(--mist); white-space: nowrap; }
.task-selector {
  font-size: 12px; padding: 4px 28px 4px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238C8883' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  max-width: 200px;
  font-family: var(--font-body);
}
.task-selector:focus { outline: none; border-color: var(--gold); }
.btn-task-manage {
  font-size: 11px; padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--mist);
  cursor: pointer; display: flex; align-items: center; gap: 4px;
  transition: all 0.15s;
}
.btn-task-manage:hover { color: var(--ink); border-color: var(--champagne); }

.ws-status { }

/* Main viewer area */
.viewer-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.viewer-empty {
  text-align: center; color: var(--mist); font-size: 13px;
}
.viewer-empty-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--blush); display: flex; align-items: center; justify-content: center;
}
.viewer-empty-icon svg { width: 28px; height: 28px; color: var(--gold-dark); }
.viewer-empty h3 { font-size: 15px; color: var(--ink); margin-bottom: 4px; font-weight: 500; }
.viewer-empty p { font-size: 12px; }

.viewer-image-wrap {
  max-width: 100%; max-height: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.viewer-image-wrap img {
  max-width: 100%; max-height: calc(100vh - 52px - 44px - 120px - 48px);
  object-fit: contain; border-radius: 4px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
  cursor: zoom-in;
}

/* Image toolbar */
.image-toolbar {
  position: absolute; top: 16px; right: 16px;
  display: flex; gap: 6px; opacity: 0; transition: opacity 0.2s;
}
.viewer-image-wrap:hover .image-toolbar { opacity: 1; }

/* ===== BOTTOM THUMBNAIL STRIP ===== */
.thumb-strip {
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  min-height: 120px;
  max-height: 140px;
  display: flex;
  flex-direction: column;
}
.thumb-strip-header {
  display: flex; align-items: center; padding: 8px 16px 4px; gap: 8px;
}
.thumb-strip-title {
  font-size: 11px; font-weight: 600; color: var(--mist); letter-spacing: 0.06em;
}
.thumb-strip-count {
  font-size: 10px; color: var(--mist); background: var(--surface-alt);
  padding: 1px 6px; border-radius: 8px;
}
.thumb-strip-actions { margin-left: auto; display: flex; gap: 4px; }
.thumb-scroll {
  display: flex;
  gap: 6px;
  padding: 4px 16px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -ms-overflow-style: none;
  scrollbar-width: auto;
}
.thumb-scroll::-webkit-scrollbar { height: 6px; }
.thumb-scroll::-webkit-scrollbar-track { background: var(--surface-alt); border-radius: 3px; }
.thumb-scroll::-webkit-scrollbar-thumb { background: var(--champagne); border-radius: 3px; }
.thumb-scroll::-webkit-scrollbar-thumb:hover { background: var(--gold); }

.thumb-item {
  width: 72px; min-width: 72px; height: 88px;
  border-radius: 6px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; transition: all 0.15s;
  position: relative; background: var(--cream);
  display: flex; flex-direction: column;
}
.thumb-item:hover { border-color: var(--champagne); }
.thumb-item.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,148,92,0.2); }
.thumb-item img { width: 100%; height: 64px; object-fit: cover; }
.thumb-item-label {
  font-size: 9px; color: var(--mist); text-align: center; padding: 2px 2px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb-item-badge {
  position: absolute; top: 2px; left: 2px;
  font-size: 8px; padding: 0 4px; border-radius: 2px; color: #fff;
  line-height: 14px;
}
.thumb-item-badge.sketch-badge { background: var(--mist); }
.thumb-item-badge.main-badge { background: var(--gold-dark); }
.thumb-item-badge.angle-badge { background: #5A8A6A; }
.thumb-item-badge.detail-badge { background: #7A6A9A; }
.thumb-item-badge.scene-badge { background: #6A8A9A; }
.thumb-item-badge.refined-badge { background: #8E5EA2; }
.thumb-item-badge.decor-badge { background: #9A6A7A; }

.thumb-item-edit {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; background: rgba(100,140,180,0.75);
  color: #fff; border: none; border-radius: 3px; font-size: 11px;
  cursor: pointer; display: none; align-items: center; justify-content: center;
  line-height: 1;
}
.thumb-item:hover .thumb-item-edit { display: flex; }
.thumb-item-edit:hover { background: rgba(100,140,180,0.95); }

.thumb-item-delete {
  position: absolute; top: 2px; right: 24px;
  width: 20px; height: 20px; background: rgba(194,84,80,0.7);
  color: #fff; border: none; border-radius: 3px; font-size: 10px;
  cursor: pointer; display: none; align-items: center; justify-content: center;
}
.thumb-item:hover .thumb-item-delete { display: flex; }
.thumb-item-delete:hover { background: rgba(194,84,80,0.95); }

/* ===== 多角度视图生成 — 浮窗 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.batch-modal {
  background: #1a1a2e;
  border-radius: 14px;
  width: 520px; max-width: 92vw;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(184,148,92,0.15);
  animation: modalIn .25s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.batch-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.batch-modal-title {
  font-size: 15px; font-weight: 600; color: #e8d5b0;
  letter-spacing: 0.5px;
}
.batch-modal-close {
  background: none; border: none; color: rgba(255,255,255,0.3);
  font-size: 18px; cursor: pointer; padding: 4px; line-height: 1;
  transition: color .15s;
}
.batch-modal-close:hover { color: #ff6b6b; }
.batch-modal-section { padding: 14px 20px; }
.batch-modal-step {
  font-size: 9px; font-weight: 600; color: rgba(184,148,92,0.5);
  letter-spacing: 2px; margin-bottom: 4px;
}
.batch-modal-label {
  font-size: 13px; color: #c8b88a; margin-bottom: 10px;
}
.batch-modal-hint { font-size: 11px; color: rgba(255,255,255,0.25); margin-left: 6px; }
.batch-modal-divider {
  height: 1px; background: linear-gradient(90deg, transparent, rgba(184,148,92,0.15), transparent);
  margin: 0 20px;
}
/* 缩略图选择区 */
.batch-modal-thumbs {
  display: flex; gap: 8px; flex-wrap: wrap;
  min-height: 60px;
}
.batch-modal-empty {
  width: 100%; text-align: center; padding: 20px 0;
  font-size: 12px; color: rgba(255,255,255,0.2);
}
.batch-modal-thumb {
  width: 72px; height: 72px; border-radius: 8px;
  overflow: hidden; cursor: pointer;
  border: 2px solid transparent;
  position: relative; transition: all .15s;
  flex-shrink: 0;
}
.batch-modal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.batch-modal-thumb:hover { border-color: rgba(184,148,92,0.3); transform: translateY(-2px); }
.batch-modal-thumb.selected {
  border-color: #b8945c;
  box-shadow: 0 0 12px rgba(184,148,92,0.3);
}
.batch-modal-thumb.selected::after {
  content: '✓'; position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #b8945c; color: #000;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.batch-modal-thumb .thumb-badge {
  position: absolute; bottom: 2px; left: 2px;
  font-size: 8px; padding: 1px 4px; border-radius: 3px;
  background: rgba(0,0,0,0.6); color: rgba(255,255,255,0.7);
}
/* 视图选择区 */
.batch-modal-views {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.batch-view-option {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 8px;
  cursor: pointer; transition: all .12s;
  font-size: 12px; color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  user-select: none;
}
.batch-view-option:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.8);
}
.batch-view-option:has(input:checked) {
  background: rgba(184,148,92,0.08);
  border-color: rgba(184,148,92,0.2);
  color: #e8d5b0;
}
.batch-view-option input[type="checkbox"] {
  accent-color: #b8945c; width: 13px; height: 13px; margin: 0;
}
.batch-view-icon {
  font-size: 10px; opacity: 0.5; width: 14px; text-align: center;
}
.batch-view-option:has(input:checked) .batch-view-icon { opacity: 1; color: #b8945c; }
/* 参考图标签 */
.ref-tag {
  font-size: 8px; padding: 1px 5px; border-radius: 4px;
  margin-left: auto; font-weight: 500; letter-spacing: 0.5px;
  flex-shrink: 0;
}
.ref-main { background: rgba(184,148,92,0.12); color: #b8945c; }
.ref-back { background: rgba(0,212,255,0.1); color: #5ac8e0; }
/* 底部 */
.batch-modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.batch-modal-summary {
  font-size: 11px; color: rgba(255,255,255,0.3);
}
.batch-modal-actions { display: flex; gap: 8px; }
.batch-modal-actions .btn { border-radius: 8px; padding: 7px 18px; font-size: 12px; }
.btn-ghost {
  background: transparent; border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.4); cursor: pointer; transition: all .12s;
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.7); }
.batch-modal-actions .btn-gold {
  background: linear-gradient(135deg, #b8945c, #a07840);
  border: none; color: #fff; font-weight: 500;
}
.batch-modal-actions .btn-gold:hover {
  background: linear-gradient(135deg, #c8a46c, #b08850);
  box-shadow: 0 4px 15px rgba(184,148,92,0.3);
}

/* Empty state in thumb strip */
.thumb-empty-msg {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mist);
  font-size: 12px;
  padding: 24px 0;
}

/* ===== PROGRESS BAR ===== */
.progress-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.96); border-top: 1px solid var(--border);
  padding: 16px 24px; z-index: 10;
  display: none; backdrop-filter: blur(8px);
}
.progress-overlay.show { display: block; }
.progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.progress-title { font-size: 13px; font-weight: 600; }
.progress-step { font-size: 11px; color: var(--mist); }
.progress-bar-track {
  width: 100%; height: 6px; background: var(--surface-alt);
  border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  border-radius: 3px; transition: width 0.5s ease; width: 0%;
}
.progress-bar-fill.indeterminate { width: 30%; animation: indeterminate 1.5s ease-in-out infinite; }
@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
.progress-tasks { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.progress-task {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  padding: 4px 8px; border-radius: 4px; background: var(--surface-alt);
}
.progress-task .task-icon { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.progress-task.pending { color: var(--mist); }
.progress-task.active { color: var(--loading-text); background: var(--loading-bg); font-weight: 500; }
.progress-task.done { color: var(--success-text); background: var(--success-bg); }
.progress-task.failed { color: var(--error-text); background: var(--error-bg); }

/* ===== STATUS TOAST ===== */
.status-toast {
  padding: 6px 14px; border-radius: 20px; font-size: 11px;
  display: none; align-items: center; gap: 6px;
}
.status-toast.show { display: inline-flex; }
.status-toast.loading { background: var(--loading-bg); color: var(--loading-text); border: 1px solid #F5E6A3; }
.status-toast.success { background: var(--success-bg); color: var(--success-text); border: 1px solid #C3E0C3; }
.status-toast.error { background: var(--error-bg); color: var(--error-text); border: 1px solid #F5C6C3; }
.status-toast.info { background: #F0F0F0; color: #666; border: 1px solid #DDD; }

/* ===== REFINE PANEL ===== */
.refine-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 320px; background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 14px 16px; z-index: 9; display: none;
  box-shadow: -4px 0 16px rgba(0,0,0,0.06);
  flex-direction: column;
}
.refine-panel.show { display: flex; }
.refine-panel textarea { flex: 1; min-height: 60px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; resize: none; font-family: var(--font-body); }
.refine-panel textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,148,92,0.1); }
.refine-panel .refine-btn-row { display: flex; gap: 8px; justify-content: flex-end; }

/* ===== TASK HISTORY PANEL ===== */
.task-history-panel {
  position: absolute; top: 0; right: 0; width: 340px; height: 100%;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 50; transform: translateX(100%); transition: transform 0.3s ease;
  display: flex; flex-direction: column;
}
.task-history-panel.show { transform: translateX(0); }
.task-history-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.task-history-title { font-size: 14px; font-weight: 600; }
.task-history-close { cursor: pointer; color: var(--mist); font-size: 18px; border: none; background: none; }
.task-history-list { flex: 1; overflow-y: auto; padding: 8px; }
.task-history-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 6px; cursor: pointer;
  transition: all 0.15s;
}
.task-history-item:hover { border-color: var(--champagne); background: var(--surface-alt); }
.task-history-item.active { border-color: var(--gold); background: #FDF9F3; }
.task-history-time { font-size: 10px; color: var(--mist); }
.task-history-label { font-size: 12px; font-weight: 500; margin: 2px 0; display: flex; align-items: center; gap: 6px; }
.task-history-label input {
  font-size: 12px; font-weight: 500; border: 1px solid transparent;
  background: transparent; padding: 1px 4px; border-radius: 3px; flex: 1;
  color: var(--ink); font-family: var(--font-body);
}
.task-history-label input:focus { outline: none; border-color: var(--gold); background: var(--surface); }
.task-history-meta { font-size: 10px; color: var(--mist); display: flex; gap: 8px; align-items: center; }
.task-history-status {
  font-size: 9px; padding: 1px 6px; border-radius: 8px;
}
.task-history-status.completed { background: var(--success-bg); color: var(--success-text); }
.task-history-status.running { background: var(--loading-bg); color: var(--loading-text); }
.task-history-actions { margin-left: auto; display: flex; gap: 4px; }
.task-history-actions button {
  font-size: 10px; padding: 2px 6px; border-radius: 3px;
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--mist);
  cursor: pointer;
}
.task-history-actions button:hover { color: var(--error); border-color: var(--error); }
.task-history-empty { text-align: center; color: var(--mist); font-size: 12px; padding: 40px 16px; }
.task-history-group { margin-bottom: 4px; }
.task-history-group-title {
  font-size: 11px; font-weight: 600; color: var(--gold-dark);
  padding: 10px 4px 6px; letter-spacing: 0.04em;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.88); z-index: 9999;
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-overlay img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 4px; }
.modal-download {
  position: absolute; bottom: 24px; right: 24px;
  background: var(--gold); color: #fff; border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 6px; font-family: var(--font-body);
  transition: background 0.2s;
}
.modal-download:hover { background: var(--gold-dark); }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }

/* Analyze overlay */
.analyze-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 200;
  display: none; align-items: center; justify-content: center;
}
.analyze-overlay.show { display: flex; }
.analyze-card {
  background: var(--surface); border-radius: var(--radius-lg); padding: 28px 32px;
  max-width: 400px; width: 90%; text-align: center;
  box-shadow: var(--shadow-lg);
}
.analyze-card h3 { font-size: 16px; margin-bottom: 12px; }
.analyze-card p { font-size: 12px; color: var(--mist); margin-bottom: 16px; }

/* ===== RESPONSIVE ===== */
/* 宽屏 1920+ */
@media (min-width: 1920px) {
  .viewer-wrap { padding: 28px 32px; }
  .viewer-image-wrap img { max-height: 72vh; }
  .mat-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .mat-drawer { width: 560px; max-width: 46vw; }
  .thumb-strip { min-height: 130px; max-height: 150px; }
  .thumb-scroll { padding: 8px 20px 12px; gap: 10px; }
  .thumb-item { width: 80px; min-width: 80px; height: 100px; }
  .thumb-item img { height: 72px; }
  .task-history-panel { width: 400px; }
  .refine-panel { width: 340px; }
  .header { padding: 0 28px; }
  .header-right { gap: 16px; }
  .left-panel-header { padding: 24px 26px 16px; }
  .left-panel-title { font-size: 20px; }
  .left-panel-sub { font-size: 13px; }
  .form-scroll { padding: 14px 22px 20px; }
  .form-section { margin-bottom: 14px; }
  .section-title { font-size: 11px; padding: 12px 16px 0; }
  .form-body { padding: 12px 16px 14px; }
  .form-label { font-size: 12px; }
  select.form-input, textarea.form-input, input.form-input { font-size: 13px; padding: 10px 34px 10px 12px; }
  .upload-zone { padding: 20px 18px; }
  .palette-grid { grid-template-columns: repeat(10, 1fr); gap: 5px; }
  .branding-panel { width: 480px; }
}

/* 标准桌面 1440 */
@media (max-width: 1440px) and (min-width: 1367px) {
  .viewer-wrap { padding: 16px 20px; }
  .viewer-image-wrap img { max-height: 64vh; }
  .left-panel-header { padding: 16px 18px 12px; }
  .left-panel-title { font-size: 17px; }
  .form-scroll { padding: 10px 14px 16px; }
  .form-section { margin-bottom: 10px; }
  .section-title { font-size: 10px; padding: 10px 12px 0; }
  .form-body { padding: 10px 12px 12px; }
  .form-group { margin-bottom: 8px; }
  .upload-zone { padding: 14px 12px; }
  .mat-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .mat-drawer { width: 460px; }
  .thumb-strip { min-height: 100px; max-height: 110px; }
  .thumb-scroll { padding: 6px 14px 10px; gap: 8px; }
  .thumb-item { width: 68px; min-width: 68px; height: 82px; }
  .thumb-item img { height: 58px; }
  .task-history-panel { width: 320px; }
  .refine-panel { width: 290px; }
  .header { padding: 0 20px; }
  .palette-grid { grid-template-columns: repeat(8, 1fr); gap: 4px; }
  .branding-panel { width: 420px; }
}

/* 小笔记本/大平板 1025-1365 (含 iPad Pro 12.9"/11" 横屏) */
@media (max-width: 1365px) and (min-width: 1025px) {
  .header { padding: 0 16px; height: 48px; }
  .header-right { gap: 8px; }
  .logo-sub { font-size: 10px; }
  .model-badge { font-size: 10px; padding: 4px 10px; height: 30px; }
  .model-capability-hint { width: 16px; height: 16px; }
  .header-text-btn { font-size: 11px; height: 28px; padding: 0 8px; }
  .model-cap-popover { right: 40px; width: 360px; }

  .left-panel { width: clamp(280px, 55vw, 340px); min-width: 260px; }
  .left-panel-header { padding: 12px 14px 8px; }
  .left-panel-title { font-size: 15px; }
  .left-panel-sub { font-size: 11px; }
  .form-scroll { padding: 8px 12px 12px; }
  .form-section { margin-bottom: 8px; }
  .section-title { font-size: 10px; padding: 8px 10px 0; }
  .form-body { padding: 8px 10px 10px; }
  .form-group { margin-bottom: 6px; }
  .form-label { font-size: 12px; }
  select.form-input, textarea.form-input, input.form-input { font-size: 13px; padding: 8px 28px 8px 10px; min-height: 36px; }
  .form-row { grid-template-columns: 1fr; gap: 8px; }

  .upload-zone { padding: 14px 12px; margin-bottom: 8px; }
  .upload-icon svg { width: 28px; height: 28px; }
  .upload-text { font-size: 13px; }
  .upload-hint { font-size: 11px; }

  .scenario-icon { width: 20px; height: 20px; font-size: 12px; }
  .scenario-label { font-size: 12px; }

  .left-panel-actions { padding: 8px 12px; }
  .left-panel-actions .btn { font-size: 12px; padding: 8px 14px; min-height: 36px; }
  .btn { min-height: 34px; }
  .btn-sm { min-height: 28px; }

  .viewer-wrap { padding: 12px 16px; }
  .viewer-image-wrap img { max-height: 58vh; }
  .thumb-strip { min-height: 90px; max-height: 100px; }
  .thumb-scroll { padding: 4px 12px 8px; gap: 6px; }
  .thumb-item { width: 60px; min-width: 60px; height: 72px; }
  .thumb-item img { height: 50px; }

  .image-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; padding: 12px; }

  .mat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .mat-drawer { width: 440px; max-width: 88vw; }
  .task-history-panel { width: 300px; }
  .refine-panel { width: 260px; }
  .branding-panel { width: 360px; }
  .palette-grid { grid-template-columns: repeat(6, 1fr); gap: 3px; }
  .settings-panel { width: 480px; }
  .modelcfg-panel { width: 480px; }
}

/* iPad 竖屏/小平板 1024 */
@media (max-width: 1024px) {
  .app-body { flex-direction: column; }
  .left-panel { width: 100%; min-width: auto; max-height: 55vh; border-right: none; border-bottom: 1px solid var(--border); }
  .left-panel-header { padding: 10px 12px 6px; }
  .left-panel-title { font-size: 15px; }
  .left-panel-sub { font-size: 11px; }
  .form-scroll { padding: 8px 10px 12px; flex: 1; }
  .form-section { margin-bottom: 8px; border-radius: 10px; }
  .section-title { font-size: 10px; padding: 8px 10px 0; }
  .form-body { padding: 8px 10px 10px; }
  .form-label { font-size: 12px; }
  select.form-input, textarea.form-input, input.form-input { font-size: 13px; padding: 9px 28px 9px 12px; min-height: 38px; }
  .form-row { grid-template-columns: 1fr; gap: 8px; }

  .upload-zone { padding: 14px 12px; margin-bottom: 8px; }
  .upload-icon svg { width: 32px; height: 32px; }
  .upload-text { font-size: 13px; }
  .upload-hint { font-size: 12px; }

  .scenario-icon { width: 22px; height: 22px; font-size: 12px; }
  .scenario-label { font-size: 13px; }

  .left-panel-actions { padding: 8px 12px; }
  .left-panel-actions .btn { font-size: 13px; padding: 9px 16px; min-height: 40px; }
  .btn { min-height: 38px; }
  .btn-sm { min-height: 32px; }

  /* 查看器区域：缩小但保留可操作 */
  .viewer-area { flex: 1; min-height: 35vh; max-height: 45vh; }
  .viewer-image-wrap { padding: 8px; }
  .viewer-image-wrap img { max-height: 30vh; }
  .viewer-empty { padding: 20px; }
  .viewer-empty h3 { font-size: 13px; }
  .viewer-empty p { font-size: 11px; }
  .viewer-empty-icon svg { width: 24px; height: 24px; }

  .header { padding: 0 12px; height: 46px; }
  .header-right { gap: 6px; }
  .logo-sub { font-size: 10px; }
  .model-badge { font-size: 10px; padding: 4px 8px; height: 30px; }
  .model-capability-hint { width: 16px; height: 16px; }
  .header-text-btn { font-size: 11px; height: 28px; padding: 0 8px; }
  .model-cap-popover { right: 20px; width: 340px; }

  .thumb-strip { min-height: 70px; max-height: 80px; }
  .thumb-scroll { padding: 4px 10px 8px; gap: 5px; }
  .thumb-item { width: 54px; min-width: 54px; height: 64px; }
  .thumb-item img { height: 44px; }
  .thumb-item-label { font-size: 9px; }

  .image-gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; padding: 10px; }

  .mat-drawer { width: 92vw; max-width: 480px; }
  .mat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .palette-grid { grid-template-columns: repeat(6, 1fr); gap: 4px; }
  .sketch-thumbs { gap: 4px; }
  .sketch-thumb { width: 44px; height: 44px; }
  .task-history-panel { width: 280px; }
  .refine-panel { width: 260px; }
  .branding-panel { width: 360px; }
  .settings-panel { width: 90vw; }
  .modelcfg-panel { width: 90vw; }
  .mat-upload-zone { padding: 18px; }
  .mat-upload-zone svg { width: 32px; height: 32px; }
  .image-toolbar { top: 6px; right: 6px; }
  .image-toolbar .btn { min-height: 28px; padding: 4px 8px; font-size: 10px; }
}

/* 手机/小平板 <768 */
@media (max-width: 768px) {
  .header { padding: 0 10px; height: 44px; }
  .header-right { gap: 4px; }
  .logo-sub { display: none; }
  .model-badge { font-size: 10px; padding: 3px 8px; height: 28px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .model-capability-hint { width: 14px; height: 14px; }
  .header-text-btn { font-size: 11px; height: 26px; padding: 0 6px; }
  .model-cap-popover { right: 10px; width: 300px; }

  .app-body { height: calc(100vh - 44px); }
  .left-panel { max-height: 50vh; }
  .left-panel-header { padding: 8px 10px 6px; }
  .left-panel-title { font-size: 14px; }
  .left-panel-sub { font-size: 10px; }
  .form-scroll { padding: 6px 8px 10px; }
  .form-section { margin-bottom: 6px; border-radius: 8px; }
  .section-title { font-size: 9px; padding: 6px 8px 0; }
  .form-body { padding: 6px 8px 8px; }
  .form-label { font-size: 12px; }
  select.form-input, textarea.form-input, input.form-input { font-size: 13px; padding: 8px 24px 8px 10px; min-height: 36px; }
  .form-row { grid-template-columns: 1fr; gap: 6px; }

  .upload-zone { padding: 10px 8px; margin-bottom: 6px; }
  .upload-icon svg { width: 26px; height: 26px; }
  .upload-text { font-size: 12px; }
  .upload-hint { font-size: 11px; }

  .scenario-icon { width: 20px; height: 20px; font-size: 12px; }
  .scenario-label { font-size: 12px; }

  .left-panel-actions { padding: 6px 8px; }
  .left-panel-actions .btn { font-size: 12px; padding: 8px 12px; min-height: 38px; }
  .btn { min-height: 36px; }
  .btn-sm { min-height: 28px; }

  .viewer-image-wrap img { max-height: 30vh; }
  .image-toolbar { top: 8px; right: 8px; }

  .thumb-strip { min-height: 70px; max-height: 80px; }
  .thumb-scroll { gap: 4px; padding: 2px 8px 6px; }
  .thumb-item { width: 52px; min-width: 52px; height: 62px; }
  .thumb-item img { height: 42px; }
  .thumb-item-label { font-size: 8px; }

  .mat-drawer { width: 100vw; max-width: 100vw; }
  .mat-drawer-body { padding: 12px 14px; }
  .mat-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .mat-upload-zone { padding: 14px; }
  .mat-upload-zone svg { width: 24px; height: 24px; }
  .mat-card-actions { opacity: 1; }
  .mat-card-action { width: 26px; height: 26px; }
  .palette-grid { grid-template-columns: repeat(5, 1fr); gap: 3px; }
  .color-palette-panel { padding: 8px; }
  .sketch-thumbs { gap: 3px; }
  .sketch-thumb { width: 38px; height: 38px; }
  .task-history-panel { width: 100vw; }
  .refine-panel { width: 100%; }
  .branding-panel { width: 94vw; }
  .analyze-card { max-width: 94%; padding: 20px; }
}

/* ===== BRANDING SETTINGS MODAL ===== */
.branding-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35); z-index: 5000; display: none;
  backdrop-filter: blur(2px);
}
.branding-overlay.show { display: block; }
.branding-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 400px; max-width: 92vw; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  z-index: 5001; display: none; overflow: hidden;
}
.branding-panel.show { display: block; }
.branding-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border);
}
.branding-header h3 { font-family: var(--font-display); font-size: 16px; color: var(--ink); margin: 0; }

/* ===== SYSTEM SETTINGS MODAL ===== */
.settings-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35); z-index: 5000; display: none;
  backdrop-filter: blur(2px);
}
.settings-overlay.show { display: block; }
.settings-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 640px; max-width: 94vw; max-height: 85vh;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.15); z-index: 5001;
  display: none; overflow: hidden; flex-direction: column;
}
.settings-panel.show { display: flex; }
.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.settings-header h3 { font-family: var(--font-display); font-size: 16px; color: var(--ink); margin: 0; }
.settings-close {
  background: none; border: none; font-size: 22px; color: var(--mist); cursor: pointer;
  padding: 0 4px; line-height: 1;
}
.settings-close:hover { color: var(--ink); }
.settings-body { padding: 16px 22px; overflow-y: auto; flex: 1; }
.settings-tabs {
  display: flex; gap: 0; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.settings-tab {
  padding: 8px 18px; font-size: 13px; cursor: pointer; border: none;
  background: none; color: var(--mist); border-bottom: 2px solid transparent;
  transition: all 0.15s; font-weight: 500;
}
.settings-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.settings-tab:hover { color: var(--ink); }
.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-tool-card {
  background: var(--bg); border-radius: var(--radius); padding: 14px 16px;
  border: 1px solid var(--border);
}
.settings-tool-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.settings-tool-desc { font-size: 11px; color: var(--mist); margin: 4px 0; }
.prompt-editor-item {
  background: var(--bg); border-radius: var(--radius); padding: 12px 14px;
  border: 1px solid var(--border);
}
.prompt-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.prompt-editor-key {
  font-size: 12px; font-weight: 600; color: var(--gold-dark);
  display: flex; align-items: center; gap: 8px;
}
.prompt-editor-ta {
  width: 100%; min-height: 50px;
  font-size: 12px; font-family: monospace; line-height: 1.5;
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink); resize: vertical; box-sizing: border-box;
  overflow: hidden;
}
.prompt-editor-ta:focus { outline: none; border-color: var(--primary); }
.prompt-editor-actions {
  display: flex; gap: 6px; flex-shrink: 0;
}
.prompt-editor-actions .btn { font-size: 11px; padding: 3px 12px; }

/* ===== MODEL API CONFIG MODAL ===== */
.modelcfg-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35); z-index: 5000; display: none;
  backdrop-filter: blur(2px);
}
.modelcfg-overlay.show { display: block; }
.modelcfg-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 560px; max-width: 94vw; max-height: 85vh;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.15); z-index: 5001;
  display: none; overflow: hidden; flex-direction: column;
}
.modelcfg-panel.show { display: flex; }
.modelcfg-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modelcfg-header h3 { font-family: var(--font-display); font-size: 16px; color: var(--ink); margin: 0; }
.modelcfg-close {
  background: none; border: none; font-size: 22px; color: var(--mist); cursor: pointer;
  padding: 0 4px; line-height: 1;
}
.modelcfg-close:hover { color: var(--ink); }
.modelcfg-body { padding: 16px 22px; overflow-y: auto; flex: 1; }
.modelcfg-tabs {
  display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.modelcfg-tab {
  padding: 8px 18px; font-size: 13px; cursor: pointer; border: none;
  background: none; color: var(--mist); border-bottom: 2px solid transparent;
  transition: all 0.15s; font-weight: 500;
}
.modelcfg-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.modelcfg-tab:hover { color: var(--ink); }
.modelcfg-section { display: none; }
.modelcfg-section.active { display: block; }
.modelcfg-provider-select {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.modelcfg-provider-btn {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 12px; cursor: pointer; background: var(--bg); color: var(--mist);
  transition: all 0.15s; font-weight: 500;
}
.modelcfg-provider-btn.active { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.modelcfg-provider-btn:hover { border-color: var(--primary); color: var(--primary); }
.modelcfg-field { margin-bottom: 14px; }
.modelcfg-field label { display: block; font-size: 12px; color: var(--mist); margin-bottom: 4px; font-weight: 500; }
.modelcfg-field input, .modelcfg-field select {
  width: 100%; padding: 8px 10px; font-size: 13px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg); color: var(--ink); box-sizing: border-box;
}
.modelcfg-field input:focus, .modelcfg-field select:focus { outline: none; border-color: var(--primary); }
.modelcfg-field .modelcfg-hint { font-size: 11px; color: var(--mist); margin-top: 3px; }
.modelcfg-field .modelcfg-key-row { display: flex; gap: 6px; }
.modelcfg-field .modelcfg-key-row input { flex: 1; }
.modelcfg-field .modelcfg-toggle-btn {
  padding: 8px 12px; font-size: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg); cursor: pointer; color: var(--mist);
  white-space: nowrap; font-family: 'monospace', monospace;
}
.modelcfg-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.modelcfg-status { font-size: 11px; color: var(--mist); }
.modelcfg-status.ok { color: var(--primary); }

/* ===== API PROVIDER CARD (统一设置面板内) ===== */
.api-provider-card {
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}
.api-provider-card:hover { border-color: var(--champagne); }
.api-provider-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.api-provider-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  min-width: 110px;
  flex-shrink: 0;
}
.api-provider-key-wrap {
  flex: 1;
  min-width: 0;
}
.api-provider-key-wrap input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: 'SFMono-Regular', Consolas, monospace;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.api-provider-key-wrap input:focus { border-color: var(--gold); }
.api-provider-key-wrap input[readonly] {
  background: var(--surface);
  color: var(--mist);
  cursor: default;
}
.api-provider-btn {
  flex-shrink: 0;
  padding: 5px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--gold-dark);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  min-width: 50px;
  text-align: center;
}
.api-provider-btn:hover { border-color: var(--gold); background: rgba(184,148,92,0.06); }
.api-provider-btn.active { border-color: var(--gold); background: rgba(184,148,92,0.1); color: var(--gold-dark); }
.api-provider-meta {
  font-size: 10px;
  color: var(--mist);
  margin-top: 4px;
  padding-left: 0;
  line-height: 1.5;
}
.branding-close {
  background: none; border: none; font-size: 22px; color: var(--mist); cursor: pointer;
  padding: 0 4px; line-height: 1;
}
.branding-close:hover { color: var(--ink); }
.branding-body { padding: 18px 22px; }
.branding-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 22px 18px; border-top: 1px solid var(--border);
}
.branding-logo-upload {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 8px; text-align: center; cursor: pointer; transition: all 0.2s;
  min-height: 80px; display: flex; align-items: center; justify-content: center;
}
.branding-logo-upload:hover { border-color: var(--gold); background: var(--surface-alt); }

/* ===== MATERIAL EDIT DIALOG ===== */
.mat-edit-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35); z-index: 8000; display: none;
  backdrop-filter: blur(2px);
}
.mat-edit-overlay.show { display: block; }
.mat-edit-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 480px; max-width: 92vw; max-height: 85vh;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  z-index: 8001; display: none; overflow: hidden;
  flex-direction: column;
}
.mat-edit-panel.show { display: flex; }
.mat-edit-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mat-edit-header h3 {
  font-size: 14px; font-weight: 600; color: var(--ink); margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.mat-edit-header h3 svg { width: 15px; height: 15px; color: var(--gold); }
.mat-edit-close {
  background: none; border: none; font-size: 22px; color: var(--mist); cursor: pointer;
  padding: 0 4px; line-height: 1;
}
.mat-edit-close:hover { color: var(--ink); }
.mat-edit-body {
  flex: 1; overflow-y: auto; padding: 14px 20px;
}
.mat-edit-body .form-group { margin-bottom: 12px; }
.mat-edit-body .form-input { font-size: 12px; padding: 7px 10px; }
.mat-edit-body .mat-desc-textarea { font-size: 12px; }
.mat-edit-divider {
  height: 1px; background: var(--border); margin: 14px 0 10px;
}
.mat-edit-section-title {
  font-size: 12px; font-weight: 600; color: var(--gold-dark);
  margin-bottom: 10px; letter-spacing: 0.04em;
}
.mat-edit-row {
  display: flex; gap: 12px;
}
@media (max-width: 768px) {
  .mat-edit-row { flex-direction: column; gap: 0; }
}
.mat-edit-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 12px 20px 16px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Tablets: edit dialog */
@media (max-width: 1024px) {
  .mat-edit-panel { width: 94vw; max-height: 80vh; }
}
/* ===== FIELD SELECTOR ===== */
#fieldSelector {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}
#fieldSelector.show { display: flex; }
.field-select-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.field-select-item:hover {
  border-color: var(--gold);
  box-shadow: 0 1px 6px rgba(184,148,92,0.12);
}
.field-select-item.disabled { opacity: 0.5; }
.field-select-checkbox {
  width: 24px; height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--border);
  font-size: 11px;
  color: transparent;
  transition: all 0.15s;
  margin-top: 3px;
}
.field-select-item.enabled .field-select-checkbox {
  border-color: var(--gold);
  background: var(--gold);
  color: #fff;
}
.field-select-name {
  width: 76px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
  padding-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.field-select-value {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--mist);
  line-height: 1.5;
  word-break: break-word;
  white-space: normal;
  padding-top: 4px;
}
.field-edit-btn {
  width: 46px;
  flex-shrink: 0;
  font-size: 10px;
  padding: 3px 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--gold-dark);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  margin-top: 2px;
}
.field-edit-btn:hover {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.field-select-count {
  font-size: 11px;
  color: var(--mist);
  margin-bottom: 4px;
}
/* field selector action buttons */
.field-select-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.field-select-actions .btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 11px;
  border-radius: var(--radius);
}
/* ===== FIELD INLINE EDITOR (轻量编辑弹窗) ===== */
.field-editor-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.field-editor-overlay.show { display: flex; }
.field-editor-panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.field-editor-panel h3 {
  font-size: 14px;
  margin: 0 0 4px;
  color: var(--ink);
}
.field-editor-panel .field-editor-sub {
  font-size: 11px;
  color: var(--mist);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.field-editor-panel textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.4;
}
.field-editor-panel .fe-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.field-editor-panel .fe-actions button {
  flex: 1;
  padding: 7px 0;
  font-size: 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}
.fe-cancel { background: var(--surface-alt); color: var(--ink); }
.fe-save { background: var(--gold); color: #fff; }
/* ██ S1 双Tab（替代旧 left-panel-tabs） */
  min-width: 14px; height: 14px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* 左面板内的报告内容容器 */
#reportContent {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}
#reportContent.show { display: flex; }

/* 报告确认并生成按钮（报告模式下显示在左面板底部） */
#btnConfirmFromReportPanel { display: none; }
.left-panel-actions.show-confirm #btnConfirmFromReportPanel {
  display: inline-flex;
  flex: 1;
  border-radius: var(--radius);
}
/* 应用到表单并编辑按钮（报告模式下显示） */
.left-panel-actions.show-confirm #btnApplyToForm {
  display: inline-flex;
  flex: 1;
  border-radius: var(--radius);
}

/* ===== FLOATING TOAST ===== */
#toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 360px;
  line-height: 1.4;
}
.toast-item.show {
  opacity: 1;
  transform: translateX(0);
}
.toast-item.success { background: #2d8a4e; }
.toast-item.error { background: #c0392b; }
.toast-item.warning { background: #d68910; }
.toast-item.info { background: #2980b9; }

