/* =============================================
   AI 图片生成平台 - 全局样式
   ============================================= */

:root {
  --bg: #ffffff;
  --bg2: #f8f9fa;
  --bg3: #f0f1f3;
  --bg4: #e8e9eb;
  --border: #e2e4e8;
  --border-light: #d0d3d8;
  --text: #1a1a2e;
  --text-sub: #555570;
  --text-muted: #8888a0;
  --accent: #6c5ce7;
  --accent-hover: #5a4bd1;
  --accent-light: rgba(108, 92, 231, 0.08);
  --green: #00b894;
  --red: #e74c3c;
  --orange: #f39c12;
  --yellow: #f1c40f;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ─── 左侧侧边栏 ──────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 72px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.sidebar-top {
  padding: 16px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0 6px;
}

.logo-svg {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(108, 92, 231, 0.3));
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 10px 12px;
  gap: 12px;
  overflow-x: hidden;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--text-sub);
  font-size: 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  width: 56px;
  text-align: center;
}

.sidebar-nav-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

.sidebar-nav-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav-icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sidebar-nav-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
}

.sidebar-nav-label {
  font-size: 10px;
  line-height: 1;
  opacity: 1;
}

/* 侧边栏底部 */
.sidebar-bottom {
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-sub);
  padding: 4px 8px;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-status .status-label { font-size: 10px; }

/* 侧边栏用户按钮 */
.sidebar-user { position: relative; }

.sidebar-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s;
}
.sidebar-user-btn:hover { background: var(--bg3); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.user-name {
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
}

/* 用户下拉菜单（fixed定位，JS动态设置位置，向上弹出，竖排） */
.sidebar-dropdown {
  position: fixed;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 300;
  min-width: 140px;
  display: flex;
  flex-direction: column;
}

.sidebar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-sub);
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.sidebar-dropdown-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.status-dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.partial { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.status-dot.error { background: var(--red); }

/* ─── 主内容 ────────────────────────────────── */
.main {
  margin-left: 72px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-panel { display: none; flex: 1; min-height: 0; }
.tab-panel.active { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

/* 资产页可滚动 */
#tab-assets.active { overflow-y: auto; }

/* ─── 双栏布局 ──────────────────────────────── */
.panel-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

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

/* ─── 控制面板 ──────────────────────────────── */
.control-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-section { display: flex; flex-direction: column; gap: 8px; }

.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sub);
}

/* ─── 提示词区域（含图片上传） ────────────────── */
.prompt-area {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg3);
}

.prompt-textarea {
  border: none !important;
  border-radius: 0 !important;
  padding: 12px;
  resize: none;
}

.prompt-textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* 多图缩略图区域（即梦风格，嵌在提示词框上方） */
.prompt-images {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 10px 0;
  flex-wrap: wrap;
}

.prompt-images-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.prompt-img-item {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
  animation: imgFadeIn 0.2s ease;
}

@keyframes imgFadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.prompt-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.prompt-img-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background 0.15s;
}

.prompt-img-remove:hover {
  background: var(--red);
}

.prompt-add-img-btn {
  width: 56px;
  height: 56px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.prompt-add-img-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.add-icon {
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}

.image-upload-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  min-height: 38px;
}

.img-upload-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-sub);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  flex-shrink: 0;
}

.img-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.img-count-hint {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
  text-align: right;
}

.img-count-hint .current { color: var(--accent); font-weight: 600; }
.img-count-hint .max { color: var(--text-muted); }

/* ─── 折叠面板 ──────────────────────────────── */
.collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.collapse-header:hover .section-title { color: var(--text); }

.collapse-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.collapse-header.open .collapse-arrow {
  transform: rotate(90deg);
}

.collapse-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s;
}

.collapse-body.open {
  display: block !important;
}

/* ─── 分辨率选项 ──────────────────────────────── */
.resolution-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.resolution-label {
  font-size: 12px;
  color: var(--text-sub);
  width: 50px;
  flex-shrink: 0;
}

.resolution-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.resolution-btn {
  padding: 5px 14px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.resolution-btn:hover {
  border-color: var(--border-light);
  color: var(--text);
}

.resolution-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.resolution-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

/* ─── 折叠面板预览（标题栏显示当前比例+分辨率） ── */
.collapse-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-sub);
}

.preview-ratio-box {
  width: 16px;
  height: 16px;
  background: var(--border);
  border-radius: 2px;
  transition: all 0.2s;
}

.preview-sep {
  color: var(--text-muted);
  font-size: 11px;
}

.preview-res-tag {
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text-sub);
  transition: all 0.2s;
}

/* ─── 画质选项 ──────────────────────────────── */
.quality-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quality-label {
  font-size: 12px;
  color: var(--text-sub);
  width: 50px;
  flex-shrink: 0;
}

.quality-select {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
}

/* ─── 文本输入 ──────────────────────────────── */
.textarea-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  line-height: 1.6;
}

.textarea-input:focus {
  outline: none;
  border-color: var(--accent);
}

.textarea-input::placeholder { color: var(--text-muted); }

/* ─── 提示词标签 ────────────────────────────── */
.prompt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-label { font-size: 11px; color: var(--text-muted); }

.tag-btn {
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text-sub);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.tag-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ─── 比例选择（紧凑版） ───────────────────── */
.ratio-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ratio-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg3);
  transition: all 0.2s;
  font-size: 10px;
  color: var(--text-sub);
}

.ratio-item input[type="radio"] { display: none; }
.ratio-item:hover { border-color: var(--border-light); color: var(--text); }
.ratio-item.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.ratio-box {
  background: var(--border);
  border-radius: 3px;
  transition: background 0.2s;
}
.ratio-item.active .ratio-box { background: var(--accent); }

/* ─── 下拉选择 ──────────────────────────────── */
.select-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select-input:focus { outline: none; border-color: var(--accent); }
.select-input option { background: var(--bg2); }

/* ─── 子模型描述 ──────────────────────────────── */
.sub-model-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* ─── 生成按钮 ──────────────────────────────── */
.generate-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #9c4dff);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: inherit;
  box-shadow: 0 4px 20px rgba(124, 111, 247, 0.35);
}

.generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(124, 111, 247, 0.5);
}

.generate-btn:active { transform: translateY(0); }
.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon { font-size: 16px; }

/* ─── 结果区域 ──────────────────────────────── */
.result-area {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* 空状态 */
.result-placeholder {
  text-align: center;
  padding: 60px 40px;
}

.placeholder-icon { font-size: 64px; margin-bottom: 20px; opacity: 0.4; }
.placeholder-text { font-size: 16px; color: var(--text-sub); margin-bottom: 8px; }
.placeholder-sub { font-size: 13px; color: var(--text-muted); }

/* 加载状态 */
.result-loading {
  text-align: center;
  padding: 60px;
}

.loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-text { font-size: 15px; color: var(--text); margin-bottom: 8px; }
.loading-sub { font-size: 12px; color: var(--text-muted); }

/* 结果图片 */
.result-content { width: 100%; height: 100%; }

.result-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 520px;
  padding: 16px;
}

.result-image {
  max-width: 100%;
  max-height: 640px;
  border-radius: var(--radius);
  display: block;
}

.result-overlay {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.result-image-wrap:hover .result-overlay { opacity: 1; }

.overlay-btn {
  padding: 8px 14px;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}

.overlay-btn:hover { background: rgba(124,111,247,0.8); border-color: var(--accent); }

.result-meta {
  padding: 14px 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

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

/* 错误状态 */
.result-error {
  text-align: center;
  padding: 60px;
}

.error-icon { font-size: 48px; margin-bottom: 16px; }
.error-text { color: var(--red); font-size: 14px; margin-bottom: 20px; max-width: 400px; }

.retry-btn {
  padding: 9px 24px;
  background: transparent;
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.retry-btn:hover { background: rgba(248, 113, 113, 0.1); }

/* ─── 上传区域 ──────────────────────────────── */
.note { font-size: 11px; color: var(--text-muted); }

/* ─── 历史记录 ──────────────────────────────── */
.history-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.history-title { font-size: 18px; font-weight: 700; }

.clear-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.clear-btn:hover { border-color: var(--red); color: var(--red); }

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.history-loading { color: var(--text-muted); padding: 40px; text-align: center; grid-column: 1/-1; }
.history-empty { color: var(--text-muted); padding: 60px; text-align: center; grid-column: 1/-1; font-size: 15px; }

.history-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.history-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.history-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.history-card-info {
  padding: 10px 12px;
}

.history-card-model {
  font-size: 10px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.history-card-prompt {
  font-size: 12px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.history-card-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
}

.history-card-actions {
  padding: 0 12px 10px;
  display: flex;
  gap: 6px;
}

.history-action-btn {
  flex: 1;
  padding: 5px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-sub);
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: all 0.15s;
}

.history-action-btn:hover { border-color: var(--border-light); color: var(--text); }
.history-action-btn.del:hover { border-color: var(--red); color: var(--red); }

/* 图片卡片悬浮遮罩 */
.history-card-img-wrap {
  position: relative;
  overflow: hidden;
}

.history-card-img-wrap img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform 0.2s;
}

.history-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 6px;
}

.history-card:hover .history-card-overlay {
  opacity: 1;
}

.history-card-delete-btn,
.history-card-download-btn {
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.history-card-delete-btn:hover {
  background: #e74c3c;
}

.history-card-download-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* ─── 灯箱 → 图片详情弹窗（即梦风格） ───────── */
.img-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  animation: imgDetailIn 0.25s ease;
}

@keyframes imgDetailIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.img-detail-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 40px;
}

.img-detail-view {
  max-width: 100%;
  max-height: calc(100vh - 80px);
  object-fit: contain;
  border-radius: 8px;
  transform-origin: center center;
  transition: transform 0.1s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

.detail-zoom-label {
  position: absolute;
  bottom: 20px;
  right: 20px;
  padding: 4px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  pointer-events: none;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s;
}

.detail-zoom-label:not(:empty) {
  opacity: 1;
}

.img-detail-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.45);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}

.img-detail-nav:hover {
  background: rgba(0,0,0,0.7);
  border-color: rgba(255,255,255,0.4);
  transform: translateY(-50%) scale(1.08);
}

.img-detail-prev { left: 16px; }
.img-detail-next { right: 16px; }

.img-detail-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.45);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}

.img-detail-close-btn:hover {
  background: rgba(239,68,68,0.8);
  border-color: rgba(239,68,68,0.9);
}

.img-detail-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  border-radius: 12px;
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.img-detail-right {
  width: 380px;
  flex-shrink: 0;
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-left: 1px solid rgba(255,255,255,0.08);
}

.img-detail-section {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.img-detail-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.img-detail-prompt {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  line-height: 1.7;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.img-detail-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.img-detail-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.img-detail-info-key {
  color: rgba(255,255,255,0.4);
  min-width: 64px;
  flex-shrink: 0;
}

.img-detail-info-val {
  color: rgba(255,255,255,0.8);
}

.img-detail-actions {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.img-detail-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.img-detail-action-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
}

.img-detail-action-btn.primary {
  background: rgba(99,102,241,0.2);
  border-color: rgba(99,102,241,0.4);
  color: #a5b4fc;
}

.img-detail-action-btn.primary:hover {
  background: rgba(99,102,241,0.35);
  border-color: rgba(99,102,241,0.6);
  color: #c7d2fe;
}

.img-detail-action-btn-danger {
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}

.img-detail-action-btn-danger:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.5);
  color: #fecaca;
}

.img-detail-right::-webkit-scrollbar { width: 4px; }
.img-detail-right::-webkit-scrollbar-track { background: transparent; }
.img-detail-right::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.img-detail-right::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

@media (max-width: 768px) {
  .img-detail-overlay { flex-direction: column; }
  .img-detail-left { padding: 20px; flex: 1; min-height: 50vh; }
  .img-detail-right {
    width: 100%;
    max-height: 45vh;
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .img-detail-actions { flex-direction: row; flex-wrap: wrap; }
  .img-detail-action-btn { flex: 1; min-width: 120px; }
}

/* ─── 滚动条 ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── 认证系统（登录 + 管理面板） ──────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(16px);
}

.auth-modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.auth-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.auth-desc {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.1em;
  transition: border-color 0.2s;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-input::placeholder {
  letter-spacing: normal;
  color: var(--text-muted);
}

.auth-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent), #9c4dff);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(124, 111, 247, 0.35);
}

.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(124, 111, 247, 0.5);
}

.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
  font-family: inherit;
  transition: color 0.2s;
}

.auth-link-btn:hover {
  color: var(--accent);
}

.auth-error {
  font-size: 13px;
  color: var(--red);
  margin-top: 12px;
}

.auth-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

.auth-switch-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 4px;
}

.auth-success {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 等待授权动画 */
.auth-waiting-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: authSpin 1s linear infinite;
}

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

/* ─── 导航栏用户信息 ────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user {
  position: relative;
  display: flex;
  align-items: center;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 6px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: all 0.2s;
}

.user-btn:hover {
  border-color: var(--accent);
  background: var(--bg2);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.user-name {
  font-weight: 600;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 11px;
  color: var(--accent);
  background: rgba(124, 111, 247, 0.15);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  z-index: 100;
  overflow: hidden;
  flex-direction: column;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s;
}

.user-dropdown-item:hover {
  background: var(--bg3);
}

/* ─── 管理面板（独立全屏页面） ────────────────── */
.admin-panel {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  background: var(--bg);
  overflow-y: auto;
}

.admin-panel-inner {
  background: var(--bg);
  border: none;
  border-radius: 0;
  width: 900px;
  max-width: 100%;
  box-shadow: none;
  margin-top: 0;
  min-height: 100vh;
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.admin-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-tab-btn {
  padding: 6px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-tab-btn:hover,
.admin-tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.admin-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.admin-close-btn {
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  margin-left: 8px;
  transition: all 0.2s;
}

.admin-close-btn:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* 统计卡片 */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.admin-stat-card {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.admin-stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}

.admin-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 表格 */
.admin-table-wrap {
  padding: 16px 24px 24px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
}

.admin-table tr:hover td {
  background: rgba(124, 111, 247, 0.04);
}

.admin-username {
  font-weight: 600;
}

.admin-role-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.admin-role-tag.admin {
  background: rgba(124, 111, 247, 0.15);
  color: var(--accent);
}

.admin-role-tag.user {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.admin-status {
  font-size: 12px;
  font-weight: 600;
}

.admin-status.online { color: #34d399; }
.admin-status.offline { color: var(--text-muted); }
.admin-status.disabled { color: #ef4444; }
.admin-status.pending { color: #f59e0b; }

.admin-time {
  color: var(--text-sub);
  font-size: 12px;
}

.admin-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-action-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  background: var(--bg3);
  color: var(--text);
}

.admin-action-btn.success:hover {
  background: #059669;
  border-color: #059669;
  color: #fff;
}

.admin-action-btn.danger:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.admin-action-btn.warning:hover {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

.admin-action-btn.primary {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.admin-action-btn.primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.admin-action-none {
  color: var(--text-muted);
  font-size: 12px;
}

.admin-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 8px;
}

.admin-empty-td {
  text-align: center;
  color: var(--text-muted);
  padding: 40px !important;
  font-size: 13px;
}

@media (max-width: 640px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-panel-inner {
    margin-top: 10px;
  }
  .admin-table {
    font-size: 12px;
  }
  .admin-table th,
  .admin-table td {
    padding: 8px 6px;
  }
}

/* ─── 图片工作台 新版布局 ────────────────────── */

/* main-panel：右侧主区域 */
.main-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* 提示词区域 */
.prompt-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.prompt-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
}

.prompt-icon { font-size: 16px; }
.prompt-title { color: var(--text); }

.prompt-input-container {
  position: relative;
}

.prompt-input-container textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s;
  line-height: 1.6;
}

.prompt-input-container textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.prompt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.prompt-clear {
  padding: 4px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.prompt-clear:hover { border-color: var(--red); color: var(--red); }

.prompt-count {
  font-size: 11px;
  color: var(--text-muted);
}

.prompt-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 生成按钮样式 */
.generate-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #9c4dff);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(124, 111, 247, 0.35);
}
.generate-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(124, 111, 247, 0.5); }
.generate-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.generate-btn-icon { font-size: 18px; }
.generate-btn-text { font-size: 15px; }

.generate-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
  min-height: 18px;
}

/* 参考图区域 */
.reference-upload-area {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
}
.reference-upload-area:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.reference-upload-hint {
  display: flex;
  align-items: center;
  gap: 6px;
}
.reference-upload-icon { font-size: 20px; }
.reference-upload-text { font-size: 12px; color: var(--text-sub); }

.reference-images {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* 参数标签 */
.param-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.param-label {
  font-size: 12px;
  color: var(--text-sub);
  width: 60px;
  flex-shrink: 0;
}
.param-slider { flex: 1; }
.param-value {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  width: 20px;
  text-align: right;
}
.param-input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.param-input:focus { outline: none; border-color: var(--accent); }
.param-select {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.quality-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.quality-label {
  font-size: 12px;
  color: var(--text-sub);
  width: 40px;
  flex-shrink: 0;
}
.quality-select {
  flex: 1;
}

/* ─── 最近生成区域 ───────────────────────────── */
.history-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.history-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.history-icon { font-size: 16px; }
.history-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.history-clear {
  padding: 4px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.history-clear:hover { border-color: var(--red); color: var(--red); }

.history-grid-small {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  min-height: 60px;
  align-items: flex-start;
}
.history-grid-small:empty::after {
  content: '🌌 生成的图片会显示在这里';
  font-size: 13px;
  color: var(--text-muted);
  padding: 20px 0;
  display: block;
  width: 100%;
  text-align: center;
}

/* select 通用 */
.select-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s;
}
.select-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* =============================================
   图片工作台 · 即梦风格 v6
   统一输入框：提示词+参数+按钮
   ============================================= */

/* 工作区整体 */
.gen-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100vh;
  padding: 32px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* 生成结果区（图片在上） */
.gen-results {
  flex: 1;
  margin-bottom: 24px;
  min-height: 0;
  overflow-y: auto;
  max-height: calc(100vh - 380px);
  padding: 8px 4px;
  /* 让记录块贴底显示（新记录最靠近输入框） */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* ─── 生成记录（即梦风格） ──────────────────── */
.gen-record {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 提示词行 */
.gen-record-prompt {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 0 2px;
}

.gen-record-prompt:hover {
  -webkit-line-clamp: unset;
}

/* 标签行：模型 | 比例 | 分辨率 | 时间 */
.gen-record-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
  flex-wrap: wrap;
}

.gen-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.6;
}

.gen-tag-model {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-light);
}

.gen-tag-mode {
  color: #fff;
  font-weight: 600;
  background: var(--accent);
}

.gen-tag-info {
  color: var(--text-muted);
  background: var(--bg3);
}

.gen-tag-time {
  color: var(--text-muted);
  opacity: 0.7;
  margin-left: auto;
}

/* 图片网格 */
.gen-record-images {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* 记录操作按钮行（重新编辑 + 再次生成） */
.gen-record-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

.gen-record-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text-sub);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.gen-record-action-btn:hover {
  background: var(--bg3);
  border-color: var(--accent);
  color: var(--accent);
}

.gen-record-action-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.gen-record-action-btn.primary:hover {
  opacity: 0.85;
}

/* 底部操作栏（重新编辑 + 再次生成） */
.gen-record-action-bar {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* 提示词行（参考图 + 提示词） */
.gen-record-prompt-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* 提示词行中的提示词需要 flex 填充剩余空间且允许收缩 */
.gen-record-prompt-row .gen-record-prompt {
  flex: 1;
  min-width: 0;
}

/* 参考图缩略图 */
.gen-record-ref-thumb {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.gen-record-ref-thumb img {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s;
  object-fit: cover;
  display: block;
}
.gen-record-ref-thumb img:hover {
  transform: scale(1.08);
  border-color: var(--accent);
}

/* 资产页删除悬浮层 */
.asset-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.history-card:hover .asset-hover-overlay,
.history-card-img-wrap:hover .asset-hover-overlay {
  opacity: 1;
}
.asset-hover-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  color: #666;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.asset-hover-delete:hover {
  background: #ef4444;
  color: #fff;
}

/* 单张图片卡片 */
.gen-record-img-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  background: var(--bg3);
}

.gen-record-img-card:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.gen-record-img-card img {
  width: 100%;
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
}

/* 悬停遮罩 */
.gen-record-img-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  opacity: 0;
  transition: opacity 0.2s;
}

.gen-record-img-card:hover .gen-record-img-overlay {
  opacity: 1;
}

/* 操作按钮 */
.gen-record-img-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}

.gen-record-img-btn:hover {
  background: #fff;
  transform: scale(1.1);
}

/* 响应式：记录内图片网格 */
@media (max-width: 768px) {
  .gen-record-images {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 无图片时：workspace 居中对齐（通过 JS 添加 class） */
.gen-workspace.centered .gen-input-box {
  margin-top: auto;
  margin-bottom: auto;
}

.gen-results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.gen-results.has-images {
  animation: genResultsIn 0.4s ease;
}

@keyframes genResultsIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 统一输入框 */
.gen-input-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  transition: box-shadow 0.3s;
}

.gen-input-box:focus-within {
  box-shadow: 0 4px 32px rgba(108, 92, 231, 0.15);
  border-color: var(--accent);
}

/* 模式切换行 */
.gen-input-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
}

.gen-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg3);
  border-radius: 10px;
  padding: 3px;
}

.gen-mode-btn {
  padding: 5px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.gen-mode-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* 参考图区域 */
.gen-ref-images {
  display: flex;
  gap: 8px;
  padding: 8px 16px 0;
  flex-wrap: wrap;
}

/* 文本输入区 */
.gen-textarea-wrap {
  position: relative;
  padding: 12px 16px;
}

.gen-textarea-wrap textarea {
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 80px;
  line-height: 1.6;
}

.gen-textarea-wrap textarea::placeholder {
  color: var(--text-muted);
}

.gen-upload-btn {
  position: absolute;
  bottom: 12px;
  right: 16px;
  width: 28px;
  height: 28px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
}

.gen-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* 参数栏（单行） */
.gen-params-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
  flex-wrap: wrap;
  position: relative;
}

.gen-select {
  padding: 6px 28px 6px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.gen-select:focus {
  outline: none;
  border-color: var(--accent);
}

.gen-select option {
  background: #fff;
}

/* ─── 比例+分辨率 触发按钮 ───────────────────── */
.gen-size-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s;
  user-select: none;
}

.gen-size-trigger:hover {
  border-color: var(--accent);
}

.gen-size-trigger.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.gen-size-trigger-icon {
  display: flex;
  align-items: center;
  color: var(--text-sub);
}

.gen-size-trigger.active .gen-size-trigger-icon {
  color: var(--accent);
}

/* ─── 比例+分辨率 展开面板（挂载到 body，fixed 定位） ── */
.gen-size-panel {
  position: fixed;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  z-index: 9999;
  display: none;
  min-width: 360px;
}

.gen-size-panel.open {
  display: block;
}

.gen-size-panel-section {
  margin-bottom: 10px;
}

.gen-size-panel-section:last-child {
  margin-bottom: 0;
}

.gen-size-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.gen-size-panel-ratios,
.gen-size-panel-ress {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gen-size-panel-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* 面板内的比例按钮 */
.size-panel-ratio-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-sub);
  transition: all 0.12s;
  white-space: nowrap;
}

.size-panel-ratio-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.size-panel-ratio-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* 面板内的分辨率按钮 */
.size-panel-res-btn {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-sub);
  transition: all 0.12s;
  white-space: nowrap;
}

.size-panel-res-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.size-panel-res-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* 数量控制 */
.gen-count-control {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.gen-count-btn {
  width: 28px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--text-sub);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}

.gen-count-btn:hover {
  background: var(--bg3);
  color: var(--accent);
}

.gen-count-val {
  width: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* 生成按钮 */
.gen-submit-btn {
  padding: 6px 20px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: auto;
}

.gen-submit-btn:hover {
  background: var(--accent-hover);
}

.gen-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* spin动画 */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 灵感页容器 */
#tab-inspiration .oai-container {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  overflow: hidden;
}

/* 参考图区域（在工作台输入框上方） */
.gen-ref-area {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px 0;
  flex-wrap: wrap;
}

/* 右键菜单 */
.context-menu {
  position: fixed;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 200px;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}

.context-menu-item:hover {
  background: var(--bg3);
}

.context-menu-item-danger:hover {
  background: #fef2f2;
  color: #e74c3c;
}

.context-menu-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.jimeng-recent-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.jimeng-recent-icon {
  font-size: 20px;
  color: var(--accent);
}

.jimeng-recent-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.jimeng-recent-grid {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 10px;
  min-height: 120px;
  align-items: flex-start;
}

.jimeng-recent-empty {
  width: 100%;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
  font-style: italic;
}

/* 资产页面样式 */
.assets-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.assets-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.assets-actions {
  display: flex;
  gap: 12px;
}

.assets-upload-btn {
  padding: 8px 20px;
  background: linear-gradient(135deg, var(--accent), #9c4dff);
  border: none;
  border-radius: 20px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.assets-upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}

.assets-clear-btn {
  padding: 8px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-sub);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.assets-clear-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.assets-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 24px 24px;
}

.assets-date-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.assets-date-header:first-child {
  padding-top: 8px;
}

.assets-date-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.assets-date-count {
  font-size: 12px;
  color: var(--text-muted);
}

.assets-date-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  padding-bottom: 8px;
}

.assets-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 15px;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .gen-results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .jimeng-params-body {
    grid-template-columns: 1fr;
  }
  
  .jimeng-layout {
    gap: 16px;
  }
  
  .jimeng-top-section,
  .jimeng-params-section,
  .jimeng-result-section,
  .jimeng-recent-section {
    padding: 16px;
  }
  
  .assets-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* =============================================
   用量统计 & 报表样式
   ============================================= */

/* 使用量数字 */
.usage-count {
  font-weight: 700;
  color: var(--accent);
}

/* 用户名展开/折叠图标 */
.detail-toggle-icon {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 2px;
}

/* 折叠详情行 */
.detail-row { display: table-row; }
.detail-cell {
  padding: 0 !important;
  background: var(--bg2);
}
.detail-content {
  padding: 10px 16px 14px 52px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.usage-model-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg3);
  border-radius: 6px;
  font-size: 12px;
}
.usage-model-name {
  color: var(--text-sub);
}
.usage-model-count {
  color: var(--accent);
  font-weight: 600;
}
.usage-model-empty {
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 0;
}

/* ─── 报表区域 ─────────────────────────────── */
.report-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.report-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.report-card-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}
.report-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.report-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.report-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.report-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

/* 柱状图 */
.chart-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.chart-row:last-child { margin-bottom: 0; }
.chart-label {
  width: 180px;
  font-size: 12px;
  color: var(--text-sub);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-bar-wrap {
  flex: 1;
  height: 24px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
}
.chart-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #9c4dff);
  border-radius: 4px;
  min-width: 4px;
  transition: width 0.3s ease;
}
.chart-num {
  width: 40px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

/* 报表模型标签 */
.report-models-cell {
  font-size: 12px;
  line-height: 1.8;
}
.report-model-tag {
  display: inline-block;
  padding: 1px 8px;
  background: var(--bg3);
  border-radius: 4px;
  color: var(--text-sub);
  margin-right: 4px;
  white-space: nowrap;
}

/* ── 报表增强：时间维度 + 趋势图 ── */
.report-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.report-period-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.period-card {
  background: var(--bg3);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
.period-card-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}
.period-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.report-period-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.period-btn {
  padding: 5px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.period-btn:hover { border-color: var(--accent); color: var(--text); }
.period-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
/* 趋势迷你柱状图 */
.trend-chart-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.trend-chart-row:last-child { margin-bottom: 0; }
.trend-date {
  width: 50px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}
.trend-bar-wrap {
  flex: 1;
  height: 20px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.trend-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #9c4dff);
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.3s;
}
.trend-bar-zero {
  height: 100%;
  background: var(--bg3);
  border-radius: 3px;
}
.trend-count {
  width: 32px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  flex-shrink: 0;
}
/* 趋势行悬浮提示 */
.trend-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  pointer-events: none;
}
.trend-bar-wrap:hover .trend-tooltip { display: block; }
/* 用户排行：折叠模型明细 */
.report-user-row td { cursor: default; }
.report-user-toggle {
  cursor: pointer;
  user-select: none;
}
.report-user-toggle:hover { color: var(--accent); }
.report-detail-row { display: none; }
.report-detail-row.open { display: table-row; }
.report-detail-cell {
  padding: 12px 16px !important;
  background: var(--bg3);
}
.report-detail-models {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.report-detail-model-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
}
.report-detail-model-name {
  color: var(--text-sub);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-detail-model-count {
  font-weight: 700;
  color: var(--accent);
}
