﻿/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #161616;
  --bg-hover: #1e1e1e;
  --border: #222222;
  --border-light: #2a2a2a;
  --text-primary: #f0f0f0;
  --text-secondary: #999999;
  --text-muted: #555555;
  --accent: #d4a843;
  --accent-dim: rgba(212,168,67,0.12);
  --accent-glow: rgba(212,168,67,0.25);
  --accent-gradient: linear-gradient(135deg, #d4a843 0%, #b8922e 100%);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
}

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

/* ===== Header ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header-left .brand-tag {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.header-left .title {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}
.header-left .title span { color: var(--accent); }
.header-left .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.points-display {
  text-align: right;
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.points-display .pts-label { font-size: 10px; color: var(--text-muted); }
.points-display .pts-value { font-size: 20px; color: var(--accent); font-weight: 600; }
.user-btn {
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: var(--transition);
  background: transparent;
}
.user-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* ===== Nav Tabs ===== */
.nav-tabs {
  display: flex;
  gap: 24px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  align-items: center;
}
.nav-tab {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  padding: 4px 0;
}
.nav-tab:hover { color: var(--text-secondary); }
.nav-tab.active {
  color: var(--text-primary);
  font-weight: 500;
}
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}
.nav-tab .count {
  color: var(--text-muted);
  font-size: 11px;
}
#apiStatus {
  font-size: 10px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-muted);
  white-space: nowrap;
}
#apiStatus.ok { border-color: #2a6e3a; color: #4caf50; background: rgba(76,175,80,0.06); }
#apiStatus.err { border-color: #6e2a2a; color: #f44336; background: rgba(244,67,54,0.06); }

/* ===== Product Analysis Page ===== */
.analysis-page {
  padding: 20px 32px;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 120px);
}
.analysis-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.analysis-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.analysis-result-panel { min-height: 520px; }
.analysis-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}
.analysis-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 18px;
}
.analysis-input-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.analysis-upload {
  min-height: 150px;
  background: #0d0d0d;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
}
.analysis-upload:hover {
  border-color: var(--accent);
  background: #111;
}
.analysis-upload-plus {
  width: 36px;
  height: 36px;
  margin: 0 auto 8px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
}
.analysis-upload-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 0 12px;
}
.analysis-upload-img {
  width: 100%;
  max-height: 190px;
  object-fit: contain;
  display: block;
  background: #0a0a0a;
}
.analysis-label {
  font-size: 11px;
  color: var(--accent);
}
.analysis-textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  background: #0d0d0d;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
  outline: none;
}
.analysis-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.analysis-btn,
.analysis-secondary-btn {
  height: 38px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #0a0a0a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.analysis-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.analysis-secondary-btn {
  background: #19170f;
  color: var(--accent);
  padding: 0 14px;
}
.analysis-empty {
  min-height: 460px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
}
.analysis-empty-title {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.analysis-empty-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
.analysis-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.analysis-kv {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.analysis-kv span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.analysis-kv strong {
  display: block;
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.analysis-card {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
}
.analysis-card-title {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 700;
}
.analysis-direction-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.analysis-direction-card {
  background: #151515;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 11px;
  min-width: 0;
}
.analysis-direction-title {
  font-size: 12px;
  color: #ddd;
  font-weight: 700;
  margin-bottom: 7px;
}
.analysis-direction-skill {
  display: inline-block;
  color: var(--accent);
  border: 1px solid rgba(212,168,67,0.35);
  background: rgba(212,168,67,0.08);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 10px;
  margin-bottom: 8px;
}
.analysis-direction-copy {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.analysis-use-btn {
  width: 100%;
  height: 32px;
  margin-top: 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: rgba(212,168,67,0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.analysis-use-btn:hover {
  background: rgba(212,168,67,0.18);
}
.analysis-big-copy {
  font-size: 26px;
  color: #fff;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
}
.analysis-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 8px;
}
.analysis-chip {
  display: inline-block;
  background: #171717;
  border: 1px solid #2b2b2b;
  border-radius: 5px;
  padding: 4px 8px;
  margin: 3px;
  color: #bbb;
  font-size: 11px;
}
.analysis-module-list,
.analysis-skill-list,
.analysis-material-list {
  display: grid;
  gap: 7px;
}
.analysis-module-row,
.analysis-skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: #151515;
  border: 1px solid #252525;
  border-radius: 6px;
  padding: 9px 10px;
}
.analysis-module-row strong,
.analysis-skill-row strong {
  display: block;
  color: #ddd;
  font-size: 12px;
  margin-bottom: 3px;
}
.analysis-module-row span,
.analysis-skill-row span {
  display: block;
  color: #777;
  font-size: 11px;
  line-height: 1.5;
}
.analysis-module-row em,
.analysis-skill-row em {
  font-style: normal;
  color: var(--accent);
  font-size: 11px;
  white-space: nowrap;
}
.analysis-material-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) minmax(150px, auto);
  gap: 10px;
  align-items: center;
  background: #151515;
  border: 1px solid #252525;
  border-radius: 6px;
  padding: 10px;
}
.analysis-material-index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(212,168,67,0.12);
  border: 1px solid rgba(212,168,67,0.35);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.analysis-material-main strong {
  display: block;
  color: #ddd;
  font-size: 12px;
  margin-bottom: 3px;
}
.analysis-material-main span,
.analysis-material-main small {
  display: block;
  color: #777;
  font-size: 11px;
  line-height: 1.45;
}
.analysis-material-main small { color: #666; margin-top: 2px; }
.analysis-material-side {
  text-align: right;
  min-width: 130px;
}
.analysis-material-side em {
  display: block;
  font-style: normal;
  color: var(--accent);
  font-size: 12px;
  margin-bottom: 4px;
}
.analysis-material-side span {
  display: block;
  color: #888;
  font-size: 10px;
  line-height: 1.4;
}
.analysis-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .analysis-layout,
  .analysis-summary,
  .analysis-grid,
  .analysis-direction-grid {
    grid-template-columns: 1fr;
  }
  .analysis-material-row {
    grid-template-columns: 24px minmax(0, 1fr);
  }
  .analysis-material-side {
    grid-column: 2;
    text-align: left;
  }
  .analysis-page {
    padding: 16px;
  }
  .nav-tabs {
    gap: 16px;
    overflow-x: auto;
  }
}

/* ===== Main Container ===== */
.main-container {
  display: flex;
  padding: 20px 32px;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 120px);
}
.left-panel { flex: 1; min-width: 0; max-width: 780px; }
.right-panel {
  width: 420px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
  align-self: flex-start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

/* ===== Section Label ===== */
.section-label {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.section-label::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== SKILL Tags ===== */
.tag-row {
  margin-bottom: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.tag-category {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 2px;
  letter-spacing: 1px;
}
.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag {
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  position: relative;
}
.tag:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-hover);
}
.tag.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.tag .badge {
  display: inline-block;
  font-size: 8px;
  background: var(--accent);
  color: #000;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: middle;
}
.tag-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  padding-left: 2px;
}

/* ===== Upload Area ===== */
.input-section { margin-top: 24px; }
.upload-area {
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-secondary);
  position: relative;
}
.upload-area:hover {
  border-color: var(--text-muted);
  background: var(--bg-card);
}
.upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  border-style: solid;
}
.upload-area.has-image {
  border-style: solid;
  border-color: var(--border-light);
  padding: 8px;
}
.upload-icon {
  font-size: 28px;
  color: var(--text-muted);
  margin-bottom: 8px;
  transition: var(--transition);
}
.upload-area:hover .upload-icon { color: var(--accent); }
.upload-text {
  font-size: 12px;
  color: var(--text-secondary);
}
.upload-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}
.upload-preview {
  max-width: 140px;
  max-height: 140px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}


/* ===== Multi-image Upload Grid ===== */
.upload-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.upload-grid-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.upload-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upload-grid-item .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  display: none;
}
.upload-grid-item:hover .remove-btn {
  display: block;
}
.upload-grid-item .remove-btn:hover {
  background: rgba(200,0,0,0.8);
}
.upload-add-more {
  width: 64px;
  height: 64px;
  border: 1.5px dashed var(--border-light);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  transition: var(--transition);
  flex-shrink: 0;
}
.upload-add-more:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.upload-add-more .plus {
  font-size: 20px;
  line-height: 1;
}

.upload-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.upload-count {
  font-size: 11px;
  color: var(--text-muted);
}
.clear-btn {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: var(--transition);
}
.clear-btn:hover {
  border-color: #a44;
  color: #f44;
}
.img-index {
  position: absolute;
  bottom: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
}

/* ===== Product Description ===== */
.prompt-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.prompt-box:focus-within {
  border-color: var(--border-light);
}
.prompt-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.prompt-label .highlight {
  color: var(--accent);
  font-weight: 500;
  font-size: 11px;
}
.prompt-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  min-height: 72px;
  outline: none;
  font-family: inherit;
}
.prompt-textarea::placeholder { color: var(--text-muted); }
.prompt-textarea:focus { color: var(--text-primary); }
.tag-tips {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(212,168,67,0.12);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: 10px;
  line-height: 1.5;
}

/* ===== Settings ===== */
.settings-row {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}
.setting-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.setting-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.setting-select {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.setting-select:hover { border-color: var(--border-light); }
.setting-select:focus { border-color: var(--accent); }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding-top: 4px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: relative;
  width: 34px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 20px;
  transition: var(--transition);
  flex-shrink: 0;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}
.toggle-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.toggle-switch input:checked ~ .toggle-label {
  color: var(--accent);
}

/* ===== Generate Button ===== */
.generate-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius);
  color: #000;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.5px;
}
.generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.generate-btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}
.generate-btn.loading .spinner { display: inline-block; }
.generate-btn.loading .btn-text { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Output Area ===== */
.output-area {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.output-area.has-result {
  justify-content: flex-start;
  padding: 0;
  background: var(--bg-card);
}

/* ===== History Page ===== */
.history-page {
  padding: 20px 32px 32px;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.history-title {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
}
.history-refresh,
.history-filter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}
.history-refresh:hover,
.history-filter:hover,
.history-filter.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.history-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.history-content {
  min-height: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.history-thumb-btn {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.history-thumb {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}
.history-meta {
  padding: 7px;
}
.history-name {
  color: var(--accent);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}
.history-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 10px;
}
.history-actions a {
  color: var(--text-secondary);
  text-decoration: none;
}
.history-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 80px 16px;
}
.output-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-bottom: 20px;
  text-transform: uppercase;
}
.output-waiting {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 2;
}
.output-waiting .step { margin: 6px 0; }
.output-waiting .step-num {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 10px;
  margin-right: 8px;
  color: var(--text-muted);
}

/* Result Image */
.result-image {
  width: 100%;
  display: block;
}
.result-info {
  padding: 16px 20px;
  text-align: left;
  width: 100%;
  border-top: 1px solid var(--border);
}
.result-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.result-prompt {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.result-actions button {
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.result-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Progress */
.progress-container {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}
.progress-stage {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 12px;
}
.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.progress-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ===== Prompt Preview ===== */
.prompt-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 16px;
}
.prompt-preview-title {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.prompt-preview-content {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.8;
  font-family: "SF Mono", "Consolas", monospace;
  max-height: 200px;
  overflow-y: auto;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 12px;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  border: 1px solid var(--border-light);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .main-container { flex-direction: column; padding: 16px; }
  .right-panel { width: 100%; position: static; max-height: none; }
  .left-panel { max-width: none; }
  .header { padding: 12px 16px; }
  .nav-tabs { padding: 10px 16px; gap: 16px; overflow-x: auto; }
  .settings-row { flex-wrap: wrap; }
  .setting-item { min-width: calc(50% - 6px); }
  .history-page { padding: 16px; }
  .history-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
}
