/* ============================================
   奇点AI · 电商主图生成 - 样式
   极简现代风 · 蓝紫渐变 · 遵循现代UI规范
   ============================================ */

/* ===== 设计令牌 ===== */
:root {
  /* 主色 */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;

  /* 背景 */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f8fafc;
  --bg-active: #eef2ff;

  /* 文字 */
  --text-1: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --text-4: #94a3b8;

  /* 边框 */
  --border-1: #e2e8f0;
  --border-2: #cbd5e1;

  /* 状态色 */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.05);

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* 间距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* 动画 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 150ms;
  --dur-base: 200ms;
  --dur-slow: 300ms;

  /* 尺寸 */
  --nav-h: 56px;
  --panel-w: 400px;
}

/* ===== 重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg-page);
  min-height: 100vh;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 隐藏滚动条但可滚动 */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* ===== 应用框架 ===== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 用户菜单 ===== */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}

.user-menu:hover {
  background: var(--primary-50);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-500), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--dur-fast) var(--ease-out);
  z-index: 100;
}

.user-menu:hover .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  transition: all var(--dur-fast) var(--ease-out);
}

.user-dropdown-item:hover {
  background: var(--bg-subtle);
  color: var(--primary-600);
}

.user-dropdown-item#logoutBtn:hover {
  color: var(--danger);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-1);
  margin: 4px 8px;
}

/* ===== 导航栏 ===== */
.navbar {
  height: var(--nav-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-1);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(12px);
  background: rgb(255 255 255 / 0.8);
}

.nav-inner {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-500), #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-600), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-divider {
  width: 1px;
  height: 24px;
  background: var(--border-1);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  transition: all var(--dur-fast) var(--ease-out);
}

.nav-link:hover {
  color: var(--text-1);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--primary-600);
  background: var(--primary-50);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #ecfdf5;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--success);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== 页面主区域 ===== */
.page {
  flex: 1;
  padding: var(--space-6) 0;
}

.page-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  gap: var(--space-6);
  align-items: start;
}

/* ===== 左侧配置面板 ===== */
.config-panel {
  position: sticky;
  top: calc(var(--nav-h) + var(--space-6));
  max-height: calc(100vh - var(--nav-h) - var(--space-6) * 2);
  overflow-y: auto;
  padding-right: var(--space-2);
}

.config-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-base) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.card-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  background: var(--primary-50);
  color: var(--primary-600);
  border-radius: 999px;
}

/* ===== 上传区域 ===== */
.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.upload-box {
  display: flex;
  flex-direction: column;
}

.upload-zone {
  position: relative;
  aspect-ratio: 1;
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  overflow: hidden;
}

.upload-zone:hover {
  border-color: var(--primary-400, #a5b4fc);
  background: var(--primary-50);
}

.upload-zone:focus-visible {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.upload-zone.drag-over {
  border-color: var(--primary-500);
  background: var(--primary-50);
  transform: scale(1.02);
}

.upload-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-3);
  text-align: center;
  pointer-events: none;
}

.upload-ico {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.upload-t1 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.upload-t2 {
  font-size: 11px;
  color: var(--text-4);
  line-height: 1.4;
}

.upload-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.upload-preview.has-image {
  display: block;
}

.upload-zone.has-image .upload-empty {
  display: none;
}

.upload-del {
  display: none;
}

.upload-zone.has-image .upload-del {
  display: flex;
}

.upload-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
  backdrop-filter: blur(4px);
}

.upload-zone:hover .upload-del {
  opacity: 1;
}

.upload-del:hover {
  background: var(--danger);
}

/* ===== 表单字段 ===== */
.field + .field {
  margin-top: var(--space-4);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.field-label-row .field-label {
  margin-bottom: 0;
}

.btn-ai-optimize {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--primary-200);
  background: var(--primary-50);
  color: var(--primary-600);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.btn-ai-optimize svg {
  display: block;
  flex-shrink: 0;
}

.btn-ai-optimize:hover {
  background: var(--primary-500);
  border-color: var(--primary-500);
  color: #fff;
}

.btn-ai-optimize.loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-ai-optimize.loading::after {
  content: '';
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-row .field {
  margin-bottom: 0;
  margin-top: 0;
}

.select-wrap {
  position: relative;
}

.select-wrap .select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
  display: block;
}

.field-select {
  width: 100%;
  height: 38px;
  padding: 0 30px 0 12px;
  border: 1.5px solid var(--border-1);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1;
  color: var(--text-1);
  background: var(--bg-surface);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--dur-fast) var(--ease-out);
}

.field-select:hover {
  border-color: var(--border-2);
}

.field-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.field-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-1);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-1);
  background: var(--bg-surface);
  transition: all var(--dur-fast) var(--ease-out);
}

.field-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.req {
  color: var(--danger);
  margin-left: 2px;
}

.opt {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-4);
  margin-left: 4px;
}

.field-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-1);
  resize: vertical;
  transition: all var(--dur-fast) var(--ease-out);
}

.field-textarea:hover {
  border-color: var(--border-2);
}

.field-textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.field-textarea::placeholder {
  color: var(--text-4);
}

.field-hint {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 4px;
  line-height: 1.5;
}

/* ===== 分段选择器 ===== */
.seg-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.seg-btn {
  flex: 1;
  min-width: 52px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  border-radius: 5px;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.seg-btn:hover {
  color: var(--text-1);
  background: var(--bg-surface);
}

.seg-btn.active {
  color: var(--primary-600);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ===== 提交按钮 ===== */
.btn-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 var(--space-5);
  background: linear-gradient(135deg, var(--primary-600), #8b5cf6);
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px -2px rgb(79 70 229 / 0.4);
  transition: all var(--dur-base) var(--ease-out);
  overflow: hidden;
}

.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-700), #7c3aed);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.btn-submit:hover::before {
  opacity: 1;
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -3px rgb(79 70 229 / 0.5);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-submit > * {
  position: relative;
  z-index: 1;
}

.btn-ico {
  display: inline-flex;
  transition: transform var(--dur-base) var(--ease-out);
}

.btn-submit:hover .btn-ico {
  transform: translateY(-1px) scale(1.1);
}

/* 加载状态 */
.btn-submit.loading .btn-ico,
.btn-submit.loading .btn-label {
  opacity: 0;
}

.btn-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgb(255 255 255 / 0.3);
  border-top-color: white;
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.8s linear infinite;
}

.btn-submit.loading .btn-spinner {
  opacity: 1;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 右侧结果面板 ===== */
.result-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  min-height: calc(100vh - var(--nav-h) - var(--space-6) * 2);
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-1);
}

.result-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
}

.result-sub {
  font-size: 12px;
  color: var(--text-4);
  margin-top: 2px;
}

.result-timer {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-subtle);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ===== 结果 Tab ===== */
.result-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-4);
  padding: 4px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  width: fit-content;
}

.result-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.result-tab:hover {
  color: var(--text-2);
}

.result-tab.active {
  background: var(--bg-surface);
  color: var(--primary-600);
  box-shadow: var(--shadow-sm);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary-100);
  color: var(--primary-700);
  font-size: 11px;
  font-weight: 600;
}

.result-tab.active .tab-badge {
  background: var(--primary-500);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: tabFadeIn 0.25s var(--ease-out);
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 历史记录 ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--dur-fast) var(--ease-out);
}

.history-card:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-md);
}

.history-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-1);
}

.history-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.history-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-500), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-3);
}

.history-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-token {
  color: var(--primary-600);
  font-weight: 600;
}

.history-images {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
}

.history-images.grid-1 { grid-template-columns: 1fr; }
.history-images.grid-2 { grid-template-columns: repeat(2, 1fr); }

.history-img-wrap {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-subtle);
}

.history-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-base) var(--ease-out);
}

.history-img-wrap:hover img {
  transform: scale(1.05);
}

.history-copy {
  padding: 0 16px 12px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-display-mode {
  padding: 0 16px 12px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}

.hdm-label {
  color: var(--primary-600);
  font-weight: 600;
}

/* ===== 进度时间线 ===== */
.prog-card {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
}

.prog-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ptl-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 0;
}

.ptl-item + .ptl-item::before {
  content: '';
  position: absolute;
  left: 9px;
  top: -8px;
  width: 2px;
  height: 16px;
  background: var(--border-2);
}

.ptl-dot {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--dur-base) var(--ease-out);
}

.ptl-check {
  color: transparent;
  transition: color var(--dur-fast) var(--ease-out);
}

.ptl-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.ptl-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-4);
  transition: color var(--dur-base) var(--ease-out);
}

.ptl-time {
  font-size: 11px;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}

/* 进行中状态 */
.ptl-item[data-state="active"] .ptl-dot {
  border-color: var(--primary-500);
  background: var(--primary-500);
  animation: pulse-ring 2s ease-in-out infinite;
}

.ptl-item[data-state="active"] .ptl-label {
  color: var(--primary-600);
  font-weight: 600;
}

.ptl-item[data-state="active"] .ptl-time {
  opacity: 1;
  color: var(--primary-500);
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgb(99 102 241 / 0.4); }
  70% { box-shadow: 0 0 0 8px rgb(99 102 241 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(99 102 241 / 0); }
}

/* 完成状态 */
.ptl-item[data-state="done"] .ptl-dot {
  border-color: var(--success);
  background: var(--success);
}

.ptl-item[data-state="done"] .ptl-check {
  color: white;
}

.ptl-item[data-state="done"] .ptl-label {
  color: var(--text-2);
  text-decoration: none;
}

.ptl-item[data-state="done"] .ptl-time {
  opacity: 1;
  color: var(--success);
}

.ptl-item[data-state="done"] + .ptl-item::before {
  background: var(--success);
}

/* ===== 结果网格 ===== */
.result-grid {
  display: grid;
  gap: var(--space-4);
}

.result-grid.grid-1 { grid-template-columns: 1fr; }
.result-grid.grid-2 { grid-template-columns: repeat(2, 1fr); }
.result-grid.grid-4 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 1024px) {
  .result-grid.grid-4 { grid-template-columns: repeat(2, 1fr); }
}

.result-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-subtle);
  aspect-ratio: 1;
  cursor: zoom-in;
  transition: all var(--dur-base) var(--ease-out);
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.result-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}

.result-card:hover img {
  transform: scale(1.05);
}

.result-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-3);
  background: linear-gradient(to top, rgb(0 0 0 / 0.6), transparent);
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--dur-base) var(--ease-out);
}

.result-card:hover .result-actions {
  opacity: 1;
  transform: translateY(0);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-surface);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease-out);
}

.btn-download:hover {
  background: var(--primary-50);
  color: var(--primary-600);
}

/* ===== 空状态 ===== */
.result-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  text-align: center;
}

.empty-illu {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 12px;
  color: var(--text-4);
  line-height: 1.6;
}

/* ===== 模态框 ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.modal[hidden] {
  display: none;
}

.modal-bg {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.7);
  backdrop-filter: blur(8px);
  animation: fade-in var(--dur-base) var(--ease-out);
}

.modal-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow-xl);
  animation: modal-in var(--dur-slow) var(--ease-out);
}

.modal-wrap img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

.modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.5);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
  backdrop-filter: blur(4px);
  z-index: 1;
}

.modal-close:hover {
  background: rgb(0 0 0 / 0.7);
  transform: scale(1.1);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 表单弹窗 */
.modal-wrap-sm {
  width: 420px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.modal-body .field-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-2);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg-soft);
  transition: all 0.2s;
  outline: none;
  box-sizing: border-box;
}

.modal-body .field-input:focus {
  border-color: var(--primary-400);
  background: #fff;
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.modal-body .field-input:disabled {
  background: var(--bg-subtle);
  color: var(--text-4);
  cursor: not-allowed;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin-top: 4px;
}

.user-info-dept {
  font-size: 11px;
  color: var(--text-4);
  font-weight: 400;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .page-inner {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .config-panel {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .result-panel {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  :root {
    --panel-w: 100%;
  }

  .nav-inner {
    padding: 0 var(--space-4);
  }

  .nav-divider { display: none; }
  .status-badge { display: none; }

  .page {
    padding: var(--space-4) 0;
  }

  .page-inner {
    padding: 0 var(--space-4);
    gap: var(--space-3);
  }

  .card {
    padding: var(--space-4);
  }

  .result-panel {
    padding: var(--space-4);
  }

  .result-grid.grid-2,
  .result-grid.grid-4 {
    grid-template-columns: 1fr;
  }

  .upload-row {
    grid-template-columns: 1fr;
  }
}

/* ===== 工具类 ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== 滚动条美化 ===== */
.config-panel::-webkit-scrollbar {
  width: 6px;
}

.config-panel::-webkit-scrollbar-track {
  background: transparent;
}

.config-panel::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 3px;
}

.config-panel::-webkit-scrollbar-thumb:hover {
  background: var(--text-4);
}
