:root {
  --bg: #f7f4ee;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #687076;
  --line: #dad7cf;
  --accent: #237b73;
  --accent-dark: #155a55;
  --brand: #1c8077;
  --warm: #b76738;
  --danger: #b42318;
  --font-scale: 1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: calc(16px * var(--font-scale));
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px 18px;
  background: #143d3a;
  color: #fff;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0;
}

.topbar p {
  margin: 0;
  color: #d8ebe7;
}

.font-hint {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 6px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-badge {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 500;
}

.logout-button,
.admin-link {
  min-height: 40px;
  border-color: rgba(255, 255, 255, 0.34);
  background: transparent;
  color: #fff;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 6px;
  text-decoration: none;
}

.logout-button:hover,
.admin-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.module-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.module-tab {
  flex: 1 1 104px;
  min-width: 88px;
  background: #fff;
  border-color: var(--line);
  color: #39413f;
}

.module-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.module-tab:disabled {
  color: #9aa09d;
  background: #f4f3ef;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(20, 61, 58, 0.92), rgba(35, 123, 115, 0.82)),
    linear-gradient(45deg, #f7f4ee, #ffffff);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.login-brand {
  margin-bottom: 26px;
}

.login-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.login-brand h1 {
  margin: 18px 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.login-brand p {
  margin: 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form input,
.login-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.login-form textarea {
  resize: vertical;
}

.login-error {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff1f0;
  color: var(--danger);
}

.login-error.success {
  background: #eaf7f2;
  color: #176453;
}

.login-button {
  width: 100%;
  min-height: 46px;
}

.login-register-entry {
  margin-top: 14px;
  text-align: center;
}

.register-form {
  margin-top: 18px;
}

.register-actions {
  display: grid;
  gap: 10px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.55fr) minmax(560px, 1.45fr);
  gap: 18px;
  padding: 22px 32px 36px;
  min-height: 100vh;
}

.admin-nav {
  display: flex;
  gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-nav button {
  min-height: 46px;
  padding: 0 24px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
}

.admin-nav button.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.admin-nav button:hover {
  color: var(--ink);
}

.admin-tab {
  display: none;
  grid-column: 1 / -1;
}

.admin-tab.active {
  display: grid;
  gap: 18px;
}

.admin-users-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.58fr) minmax(620px, 1.42fr);
  gap: 18px;
  align-items: stretch;
}

.admin-table-panel {
  min-width: 0;
}

.admin-table-panel.full-span {
  grid-column: 1 / -1;
}

.settings-form {
  margin-bottom: 14px;
}

.preset-form {
  margin: 0;
}

.preset-manager {
  display: grid;
  grid-template-columns: 180px minmax(760px, 1fr) 360px;
  gap: 16px;
  align-items: stretch;
  height: clamp(780px, 84vh, 1040px);
}

.preset-title-browser {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.preset-category {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  overflow: hidden;
}

.preset-category h3 {
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f6f1;
  font-size: 14px;
}

.preset-title-list {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 6px;
  overflow-y: auto;
}

.preset-title-empty {
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.preset-title-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.preset-title-item.active {
  border-color: var(--accent);
  background: #eef9f6;
}

.preset-title-item strong,
.preset-title-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-title-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.preset-title-thumb {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f2f0ea;
  overflow: hidden;
}

.preset-title-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preset-detail-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.preset-detail-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.preset-detail-head h3 {
  margin: 4px 0 0;
}

.preset-form-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
}

.preset-form label,
.preset-form-grid label {
  display: grid;
  gap: 6px;
}

.preset-form select,
.preset-form input,
.preset-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.preset-form select,
.preset-form input {
  min-height: 42px;
  padding: 0 12px;
}

.preset-form textarea {
  min-height: 220px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}

.preset-detail-preview {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  display: block;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.preset-detail-preview.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.prompt-lab-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.prompt-lab-product-dock {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(35, 123, 115, 0.18);
  border-radius: 8px;
  background: #f7fbf9;
}

.prompt-lab-editor-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.52fr) minmax(520px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.prompt-lab-scene-panel {
  display: grid;
  grid-template-rows: auto auto minmax(430px, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  min-width: 0;
}

.prompt-lab-scene-panel.dragover {
  border-color: var(--accent);
  background: #eef9f6;
  box-shadow: inset 0 0 0 2px rgba(35, 123, 115, 0.12);
}

.scene-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
}

.scene-panel-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.scene-panel-actions .small-button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 13px;
}

.prompt-lab-scene-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.prompt-lab-scene-slot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px dashed rgba(35, 123, 115, 0.42);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  overflow: hidden;
}

.prompt-lab-scene-slot.filled {
  border-style: solid;
  border-color: var(--line);
}

.prompt-lab-scene-slot.active {
  border-color: var(--accent);
  background: #eef9f6;
  box-shadow: 0 0 0 2px rgba(35, 123, 115, 0.12);
}

.prompt-lab-scene-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prompt-lab-scene-slot > span:not(.scene-plus) {
  position: absolute;
  left: 5px;
  bottom: 4px;
  min-width: 18px;
  min-height: 18px;
  border-radius: 999px;
  background: rgba(16, 56, 50, 0.72);
  color: #fff;
  font-size: 11px;
  text-align: center;
  line-height: 18px;
}

.prompt-lab-scene-slot b {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--danger);
  line-height: 18px;
  text-align: center;
  font-size: 15px;
}

.scene-plus {
  font-size: 24px;
  line-height: 1;
}

.prompt-lab-scene-slot small {
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.prompt-lab-scene-prompt-box {
  width: 100%;
  min-height: 430px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

.prompt-lab-library {
  display: grid;
  gap: 8px;
}

.prompt-lab-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-lab-library .product-search {
  margin-bottom: 0;
}

.prompt-lab-library .selected-product {
  margin: 0;
}

.prompt-lab-library .product-pager {
  margin-top: 0;
}

/* ═══ 测试结果区 ═══ */
#promptLabResultsSection {
  margin-top: 18px;
}

#promptLabResultsSection .section-title {
  margin-bottom: 14px;
}

#promptLabResultsSection .progress-track {
  margin-bottom: 16px;
}

.prompt-lab-tool-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(140px, 0.3fr);
  gap: 12px;
  align-items: start;
}

.prompt-lab-upload,
.prompt-lab-textarea,
.prompt-lab-tool-row label {
  display: grid;
  gap: 6px;
}

.prompt-lab-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.prompt-lab-title-row strong {
  color: #39413f;
}

.prompt-lab-title-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.prompt-lab-title-actions em {
  font-style: normal;
  white-space: nowrap;
}

.prompt-lab-upload input,
.prompt-lab-tool-row select,
.prompt-lab-textarea textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.prompt-lab-tool-row select {
  min-height: 42px;
  padding: 0 12px;
}

.prompt-lab-upload input {
  min-height: 42px;
  padding: 8px 10px;
}

.prompt-lab-textarea textarea {
  min-height: 430px;
  max-height: none;
  padding: 14px 16px;
  line-height: 1.6;
  resize: vertical;
}

.prompt-lab-upload img {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf7;
}

.prompt-lab-product-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 180px));
  justify-content: center;
  gap: 10px;
  min-height: 190px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.prompt-lab-product-preview-grid:empty {
  display: none;
}

.prompt-lab-product-preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  max-height: none;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.prompt-lab-results-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.prompt-lab-results-section .section-title {
  margin-bottom: 12px;
}

.prompt-lab-results-section .progress-track {
  margin-bottom: 12px;
}

.prompt-lab-effect-panel {
  position: sticky;
  top: 16px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  height: 100%;
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.prompt-lab-publish-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.prompt-lab-publish-actions button {
  min-height: 42px;
}

.prompt-lab-publish-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.preset-preview-list {
  display: grid;
  gap: 12px;
  padding: 10px;
}

.preset-preview-frame {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  min-height: clamp(150px, 18vh, 220px);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.preset-preview-frame.active {
  border-color: var(--accent);
  background: #eef9f6;
  box-shadow: 0 0 0 2px rgba(35, 123, 115, 0.12);
}

.preset-preview-frame img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.preset-preview-frame span {
  color: var(--muted);
  font-size: 13px;
}

.prompt-lab-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.prompt-lab-card {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.prompt-lab-card-del {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.55);
  color: #fff;
  font-size: 13px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.prompt-lab-card:hover .prompt-lab-card-del {
  opacity: 1;
}

.prompt-lab-card-del:hover {
  background: #d9534f;
}

.prompt-lab-card-cover {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: none;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
}

.prompt-lab-card.active .prompt-lab-card-cover {
  display: inline-block;
}

.prompt-lab-card.active {
  border-color: var(--accent);
  background: #eef9f6;
  box-shadow: 0 0 0 2px rgba(35, 123, 115, 0.12);
}

/* ═══ 测试结果右栏 ═══ */
.prompt-lab-results-panel {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.prompt-lab-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.prompt-lab-results-head h3 {
  margin: 0;
}

.prompt-lab-results-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.prompt-lab-results-empty {
  margin: 12px 0;
  padding: 24px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.prompt-lab-results-panel .prompt-lab-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  padding-right: 4px;
}

.prompt-lab-modal-actions {
  display: inline-flex;
  gap: 8px;
}

.prompt-lab-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.prompt-lab-card .prompt-lab-card-label {
  color: var(--muted);
  font-size: 13px;
}

.preset-content-cell {
  max-width: 720px;
  color: #39413f;
  line-height: 1.6;
  white-space: pre-wrap;
}

.preset-preview-cell {
  width: 112px;
}

.preset-preview-cell img {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f4ef;
}

.preset-preview-cell span {
  color: var(--muted);
  font-size: 13px;
}

.style-workbench {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 0.9fr);
  gap: 20px;
  align-items: stretch;
}

.style-select-stack {
  display: grid;
  gap: 14px;
  align-content: start;
}

.style-select-stack label {
  display: grid;
  gap: 8px;
}

.style-select-stack select {
  min-height: 156px;
}

.style-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(230px, 1fr) auto;
  gap: 12px;
  min-height: 360px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.style-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.style-preview-head h3 {
  margin: 3px 0 0;
  font-size: 18px;
}

.style-preview-stage {
  display: grid;
  place-items: center;
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.style-preview-stage img {
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #fff;
}

.style-preview-pager {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.style-preview-pager span {
  color: var(--muted);
  text-align: center;
}

.style-preview-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  min-height: 38px;
  margin-top: 8px;
}

.style-preview-empty {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

.style-preview-card {
  display: grid;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf7;
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.style-preview-card.active {
  border-color: var(--accent);
  background: #eef9f6;
  box-shadow: 0 0 0 2px rgba(35, 123, 115, 0.12);
}

.style-preview-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}

.style-preview-card span,
.style-preview-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-preview-card span {
  color: var(--ink);
  font-weight: 700;
}

/* ═══ 7图预览网格 ═══ */
.style-preview-set {
  display: grid;
  gap: 6px;
}

.style-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 4px;
}

.style-preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #fff;
}

.product-writeback-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}

.product-writeback-grid label {
  display: grid;
  gap: 6px;
}

.product-writeback-grid span {
  color: var(--muted);
  font-size: 13px;
}

.product-writeback-grid input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.prompt-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}

.prompt-settings-form {
  max-width: none;
}

.setting-field {
  display: grid;
  gap: 6px;
}

.setting-field input,
.setting-field textarea,
.admin-filter-row input,
.admin-filter-row select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.setting-field textarea,
.prompt-setting-field textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
}

.setting-field small,
.muted-note {
  color: var(--muted);
  font-size: 13px;
}

.settings-actions,
.admin-filter-row,
.admin-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-filter-row {
  margin-bottom: 12px;
}

.admin-filter-row input {
  max-width: 260px;
}

.admin-filter-row select {
  max-width: 150px;
}

.admin-pagination {
  justify-content: flex-end;
  margin-top: 12px;
}

.usage-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.usage-card,
.usage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.usage-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.usage-card span {
  color: var(--muted);
  font-size: 13px;
}

.usage-card strong {
  color: var(--accent);
  font-size: 24px;
  line-height: 1.1;
}

.usage-note {
  margin: 8px 0 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #f3faf7;
  color: var(--muted);
}

.usage-panel-grid,
.usage-table-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.usage-panel {
  padding: 14px;
  min-width: 0;
}

/* 用量表（用户消耗/任务明细，最多300行）限高滚动，避免撑高整页 */
.usage-table-grid .table-wrap {
  max-height: 440px;
  overflow-y: auto;
}
.usage-table-grid .table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.usage-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 170px;
  overflow-x: auto;
  padding: 10px 4px 2px;
}

.usage-bar {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 34px;
  color: var(--muted);
  font-size: 12px;
}

.usage-bar i {
  display: block;
  width: 18px;
  border-radius: 999px 999px 3px 3px;
  background: var(--accent);
  opacity: 0.82;
}

.usage-pricing-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.usage-pricing-list strong {
  display: block;
  color: var(--ink);
  margin-bottom: 8px;
}

.usage-pricing-list p {
  margin: 4px 0;
  font-size: 13px;
}

.admin-result-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.48);
}

.admin-result-modal[hidden] {
  display: none;
}

.scene-image-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(12, 28, 25, 0.38);
}

.scene-image-modal[hidden] {
  display: none;
}

.scene-image-dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 88vw);
  max-height: 88vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.scene-image-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f7f6f1;
  cursor: move;
  user-select: none;
}

.scene-image-stage {
  display: grid;
  place-items: center;
  min-height: min(620px, 72vh);
  padding: 12px;
  background: #fbfaf7;
}

.scene-image-stage img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #fff;
}

.admin-result-dialog {
  width: min(1120px, 96vw);
  max-height: 88vh;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  overflow: auto;
}

.admin-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 13px;
}

.admin-result-content {
  display: grid;
  gap: 18px;
}

.admin-result-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.admin-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.admin-result-image {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  color: var(--ink);
  text-decoration: none;
}

.admin-result-image img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.admin-result-image span {
  color: var(--muted);
  font-size: 13px;
}

.admin-title-list {
  display: grid;
  gap: 8px;
}

.admin-title-list p,
.admin-result-prompt-summary {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  line-height: 1.6;
}

.admin-title-list strong {
  margin-right: 10px;
}

.compact-table {
  min-width: 680px;
}

.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  word-break: break-all;
}

.admin-form {
  display: grid;
  gap: 16px;
}

.admin-form input[type="text"],
.admin-form input[type="password"] {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.admin-switches,
.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.field-title {
  display: block;
  margin-bottom: 8px;
  color: #39413f;
  font-weight: 600;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: #39413f;
  background: #f7f6f1;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 14px;
}

.status-pill.ok {
  background: #eaf7f2;
  color: #176453;
}

.status-pill.off {
  background: #f2f1ed;
  color: #70736f;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
}

.empty-table {
  color: var(--muted);
  text-align: center;
}

.danger-button {
  background: #fff;
  border-color: #f0b8b3;
  color: var(--danger);
}

.danger-button:hover {
  background: #fff1f0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
  padding: 22px 32px 36px;
}

.module-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 0 2px;
}

.module-heading h2 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.module-heading p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.product-panel {
  grid-column: 1 / -1;
}

.product-search {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.product-search input,
.product-search select,
.product-readonly input {
  flex: 1;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.product-search select {
  flex: 0 0 130px;
}

.combo-visual-quick-search {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 14px;
}

.combo-visual-quick-search > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.combo-visual-quick-search button {
  min-height: 32px;
  padding: 4px 14px;
  border: 1px solid #bfd8d2;
  border-radius: 6px;
  background: #f5fbf9;
  color: #176b60;
}

.combo-visual-quick-search button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.combo-visual-quick-search button:disabled {
  border-color: var(--line);
  background: #f5f4f1;
  color: #9b9d9c;
  cursor: wait;
}

.combo-visual-quick-search small {
  margin-left: 4px;
  color: var(--muted);
}

.product-readonly {
  display: block;
  margin: 0 0 12px;
}

.product-readonly input {
  color: #39413f;
  background: #fbfaf7;
}

.selected-product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #eaf7f2;
  color: #176453;
  transition: opacity 0.2s;
}

.selected-product img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(23, 100, 83, 0.15);
  flex: 0 0 auto;
}

.selected-product-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.selected-product span {
  color: #3b6f64;
}

.text-danger {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  border-color: #f0b8b3;
  background: #fff;
  color: var(--danger);
}

.text-danger:hover {
  background: #fff1f0;
}

.product-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* 商品状态筛选按钮组 */
.status-filter-btns {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: #eef2f0;
  border-radius: 8px;
}
.status-btn {
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.status-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 8px rgba(27, 121, 106, 0.14);
}

.prompt-product-panel {
  display: grid;
  gap: 12px;
}

.prompt-product-panel .product-search {
  margin-bottom: 0;
}

.prompt-product-panel .product-results {
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 10px;
}

.prompt-lab-products {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  max-height: 190px;
  min-height: 120px;
  overflow-y: auto;
  padding: 2px 6px 2px 2px;
  scrollbar-gutter: stable;
}

.prompt-lab-products .product-item {
  min-height: 142px;
  padding: 8px;
}

.prompt-lab-products .product-thumb {
  height: 76px;
}

.prompt-lab-products .product-no-image {
  min-height: 76px;
}

.prompt-lab-products .product-meta strong {
  font-size: 13px;
  line-height: 1.35;
}

.prompt-lab-products .product-meta small {
  font-size: 12px;
}

.style-clone-page {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  align-items: stretch;
  gap: 16px;
  padding: 22px 32px 36px;
}

.style-clone-page .module-heading {
  grid-column: 1 / -1;
}

.style-clone-product-panel,
.style-clone-reference-panel,
.style-clone-prompt-panel,
.style-clone-results-section {
  align-self: stretch;
}

.style-clone-product-panel,
.style-clone-reference-panel,
.style-clone-prompt-panel {
  display: flex;
  flex-direction: column;
}

.style-clone-product-panel {
  grid-column: 1 / span 4;
  grid-row: 2;
}

.style-clone-reference-panel {
  grid-column: 5 / span 5;
  grid-row: 2;
}

.style-clone-prompt-panel {
  grid-column: 10 / span 3;
  grid-row: 2;
}

.style-clone-results-section {
  grid-column: 1 / -1;
  grid-row: 3;
}

.style-clone-upload {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px dashed #91aaa5;
  border-radius: 8px;
  background: #f9fbfa;
  cursor: pointer;
  overflow: hidden;
  max-width: min(420px, 100%);
  margin: 0 auto;
}

.style-clone-upload.dragover {
  border-color: var(--accent);
  background: #edf7f5;
}

.style-clone-upload img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.style-clone-upload span {
  display: grid;
  gap: 8px;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.style-clone-upload strong {
  color: var(--ink);
  font-size: 18px;
}

.style-clone-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.style-clone-form label:first-child {
  grid-column: 1 / -1;
}

.style-clone-form label,
.style-clone-scene-text,
.style-clone-prompt-panel label {
  display: grid;
  gap: 6px;
}

.style-clone-form input,
.style-clone-form textarea,
.style-clone-scene-text textarea,
.style-clone-prompt-text {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

.style-clone-form label span,
.style-clone-scene-text span,
.style-clone-prompt-panel label span {
  font-size: 13px;
  color: var(--muted);
}

.style-clone-ref-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  align-content: start;
}

.style-clone-ref-slot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 104px;
  padding: 0;
  border: 1px dashed #bdd7d2;
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--accent);
  overflow: hidden;
}

.style-clone-ref-slot strong {
  font-size: 24px;
  line-height: 1;
}

.style-clone-ref-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-clone-ref-slot span {
  position: absolute;
  right: 5px;
  bottom: 4px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(20, 61, 58, 0.74);
  color: #fff;
  font-size: 12px;
}

.style-clone-ref-slot i {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--danger);
  font-style: normal;
}

.style-clone-scene-text textarea {
  min-height: 260px;
  resize: vertical;
}

.style-clone-scene-text {
  flex: 1;
  grid-template-rows: auto minmax(220px, 1fr);
}

.style-clone-scene-text textarea {
  height: 100%;
}

.style-clone-prompt-text {
  min-height: 570px;
  resize: vertical;
}

.style-clone-private-note {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #cfe3de;
  border-radius: 8px;
  background: #f2faf7;
  color: #315b53;
}

.style-clone-private-note strong {
  color: #123d35;
}

.style-clone-trigger-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.style-clone-trigger-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  margin-top: 0;
  padding: 0 10px;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.style-clone-prompt-panel .manual-prompt-field textarea {
  min-height: 190px;
  resize: vertical;
}

.style-clone-prompt-panel .mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.style-clone-prompt-panel .mode-grid select {
  min-height: 38px;
  height: 38px;
  padding: 0 10px;
}

.style-clone-prompt-panel .progress-wrap {
  margin-top: auto;
}

.style-clone-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.style-clone-result-card {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.style-clone-result-image {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 6px;
  background: #f5f3ed;
  color: var(--muted);
  overflow: hidden;
}

.style-clone-result-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  cursor: zoom-in;
}

.style-clone-result-card .result-title {
  align-self: start;
}

.style-clone-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.style-clone-result-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.style-clone-result-card p {
  max-height: 96px;
  margin: 0;
  overflow-y: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

body[data-page="prompt-lab"] .preset-manager {
  height: auto;
  min-height: 1080px;
}

body[data-page="prompt-lab"] .preset-detail-panel,
body[data-page="prompt-lab"] .prompt-lab-panel {
  height: auto;
  overflow: visible;
}

body[data-page="prompt-lab"] .prompt-lab-products {
  grid-template-columns: repeat(auto-fill, minmax(190px, 220px));
  justify-content: start;
  align-items: start;
  align-content: start;
  gap: 14px;
  max-height: none;
  min-height: 500px;
  overflow: visible;
  padding: 10px;
}

body[data-page="prompt-lab"] .prompt-lab-products .product-item {
  grid-template-rows: auto auto;
  gap: 10px;
  min-height: 248px;
  padding: 10px;
  border-radius: 9px;
  align-self: start;
}

body[data-page="prompt-lab"] .prompt-lab-products .product-thumb {
  height: auto;
  aspect-ratio: 1;
  border-radius: 8px;
}

body[data-page="prompt-lab"] .prompt-lab-products .product-thumb img {
  padding: 6px;
}

body[data-page="prompt-lab"] .prompt-lab-products .product-meta {
  gap: 6px;
  text-align: center;
}

body[data-page="prompt-lab"] .prompt-lab-products .product-meta strong {
  min-height: 44px;
  font-size: 14px;
  line-height: 1.45;
}

body[data-page="prompt-lab"] .prompt-lab-products .product-meta small {
  color: var(--muted);
  font-size: 13px;
}

body[data-page="prompt-lab"] #promptLabSelected {
  display: grid;
  align-items: stretch;
  justify-content: stretch;
  gap: 10px;
}

body[data-page="prompt-lab"] #promptLabSelected[hidden] {
  display: none;
}

body[data-page="prompt-lab"] #promptLabSelected .selected-product-chip {
  grid-template-columns: 64px minmax(0, 1fr) auto;
  background: #fff;
}

body[data-page="prompt-lab"] #promptLabSelected .selected-product-chip img {
  width: 64px;
  height: 64px;
}

body[data-page="prompt-lab"] .prompt-lab-editor-grid {
  grid-template-columns: 1fr;
}

body[data-page="prompt-lab"] .prompt-lab-scene-panel {
  grid-template-rows: auto auto minmax(360px, auto);
  padding: 16px;
}

body[data-page="prompt-lab"] .prompt-lab-scene-slots {
  gap: 10px;
}

body[data-page="prompt-lab"] .prompt-lab-scene-prompt-box {
  min-height: 360px;
}

body[data-page="prompt-lab"] .prompt-lab-textarea textarea {
  min-height: 520px;
}

@media (max-width: 1280px) {
  .style-clone-product-panel {
    grid-column: 1 / span 6;
    grid-row: 2;
  }

  .style-clone-reference-panel {
    grid-column: 7 / span 6;
    grid-row: 2;
  }

  .style-clone-prompt-panel {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .style-clone-results-section {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .style-clone-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .style-clone-result-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto minmax(72px, auto);
  }

  .style-clone-result-image {
    grid-row: auto;
  }
}

.product-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.product-pager span {
  color: var(--muted);
  min-width: 180px;
  text-align: center;
}

.product-item {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 230px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}

.product-item.selected {
  border-color: var(--accent);
  background: #eef9f6;
}

.product-item.queued::after {
  content: "已加入批量，可再次勾选生成另一套风格";
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 14px;
  border-radius: 8px;
  background: rgba(16, 56, 50, 0.48);
  color: #fff;
  font-weight: 800;
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
}

.product-item.queued.selected::after {
  opacity: 0.32;
}

.product-item:hover {
  border-color: var(--accent);
  background: #f4fbf9;
}

.product-selected-placeholder {
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
}

.product-no-image {
  display: grid;
  place-items: center;
  min-height: 132px;
  color: var(--muted);
}

.product-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
}

.product-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.product-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  height: 150px;
  border-radius: 6px;
  background: #f2f1ed;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-thumb.selected-thumb {
  width: 72px;
  height: 72px;
}

.product-meta {
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}

.product-meta strong {
  min-height: 40px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-detail-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #b8d9d1;
  border-radius: 6px;
  background: #f1faf7;
}

.product-detail-panel[hidden] {
  display: none;
}

.product-detail-panel strong,
.product-detail-panel span {
  display: block;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px 14px;
  color: var(--muted);
}

.product-context-menu {
  position: fixed;
  z-index: 260;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.product-context-menu[hidden] {
  display: none;
}

.product-context-menu button {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
}

.product-context-menu button:hover {
  background: #eef9f6;
  color: var(--accent);
}

.regen-choice-dialog {
  max-width: 520px;
}

.regen-choice-dialog p {
  margin: 0 0 16px;
  line-height: 1.6;
}

.regen-choice-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.regen-choice-actions button {
  min-height: 46px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
}

.selected-product-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.selected-product-list[hidden] {
  display: none;
}

.selected-products-title {
  font-weight: 700;
  color: #39413f;
}

.selected-product-chip {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf7;
}

.selected-product-chip.active {
  border-color: var(--accent);
  background: #eef9f6;
  box-shadow: inset 3px 0 0 var(--accent);
}

.selected-product-preview-btn {
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.selected-product-preview-btn .selected-thumb {
  width: 100%;
  height: 100%;
}

.selected-product-preview-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.selected-product-chip strong,
.selected-product-chip small {
  display: block;
}

.selected-product-chip small {
  margin-top: 3px;
  color: var(--muted);
}

.merge-sku-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.merge-sku-panel label {
  display: grid;
  gap: 8px;
}

.merge-sku-panel span {
  color: #39413f;
  font-weight: 700;
}

.merge-sku-panel textarea {
  width: 100%;
  min-height: 82px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
  font: inherit;
  line-height: 1.5;
}

.merge-sku-panel button {
  min-height: 44px;
  white-space: nowrap;
}

.product-item strong,
.product-item small {
  display: block;
}

.product-item small {
  margin-top: 4px;
  color: var(--muted);
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fbfaf7;
}

.module-kicker {
  color: var(--accent-dark);
  font-weight: 700;
}

.panel,
.results-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel h2,
.results-section h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 420px);
  aspect-ratio: 1;
  min-height: 0;
  margin: 0 auto;
  border: 2px dashed #91aaa5;
  border-radius: 8px;
  background: #f9fbfa;
  cursor: pointer;
  overflow: hidden;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #edf7f5;
}

.drop-empty {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.drop-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.main-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.upload-actions button {
  min-height: 34px;
}

.clear-preview {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-color: rgba(180, 35, 24, 0.28);
  background: rgba(255, 255, 255, 0.94);
  color: var(--danger);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.clear-preview:hover {
  background: #fff1f0;
}

.reference-head,
.section-title,
.generate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reference-head {
  margin: 18px 0 10px;
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}

.ref-item {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.ref-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ref-item i {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  cursor: pointer;
  font-style: normal;
  line-height: 26px;
  text-align: center;
}

.ref-item span {
  font-size: 12px;
}

.ref-slot {
  border-style: dashed;
  background: #fbfaf7;
}

.ref-slot strong {
  color: var(--accent);
  font-size: 34px;
  line-height: 1;
}

.reference-scene-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.reference-scene-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reference-scene-panel textarea {
  width: 100%;
  min-height: 128px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  line-height: 1.55;
  resize: vertical;
}

.muted {
  color: var(--muted);
  margin: 10px 0 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: #39413f;
  font-weight: 600;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

select {
  min-height: 112px;
  padding: 8px;
}

textarea {
  min-height: 118px;
  resize: vertical;
  padding: 10px;
  line-height: 1.55;
}

.task-control-panel {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

.task-control-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.generate-row {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
}

.task-mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f1ea;
}

.task-mode-btn {
  min-height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.task-mode-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(27, 121, 106, 0.14);
}

.task-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  grid-auto-rows: 1fr;
  gap: 8px;
  margin: 0;
}

.task-action-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  min-height: 74px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  transition: opacity .16s ease, background-color .16s ease, border-color .16s ease;
}

.task-action-panel.active {
  border-color: rgba(27, 121, 106, 0.42);
  background: #eef8f5;
  box-shadow: inset 2px 0 0 var(--accent);
}

.task-action-panel.disabled-panel {
  opacity: 0.48;
  background: #f3f3f1;
}

.task-action-panel > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.task-action-panel strong {
  display: block;
  margin-bottom: 0;
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
}

.task-action-panel span {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-action-buttons {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-self: end;
}

.task-action-buttons button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  font-size: 14px;
}

.check input {
  width: 18px;
  height: 18px;
}

button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  margin-top: 16px;
  background: var(--warm);
  color: #fff;
}

.inline-secondary {
  margin-top: 0;
}

.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--accent-dark);
}

.batch-queue {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf7;
}

.batch-queue[hidden] {
  display: none;
}

.batch-title {
  font-weight: 700;
  color: #39413f;
}

.batch-task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.batch-task strong,
.batch-task small {
  display: block;
}

.batch-task small {
  margin-top: 3px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-status {
  color: var(--accent-dark);
  white-space: nowrap;
}

.batch-task-modal {
  position: fixed;
  inset: 0;
  z-index: 52;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.42);
}

.batch-task-modal[hidden] {
  display: none;
}

.batch-task-dialog {
  width: min(720px, 94vw);
  max-height: 78vh;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
}

.batch-task-dialog .batch-queue {
  max-height: 56vh;
  margin: 0;
  overflow: auto;
}

.batch-config-dialog {
  width: min(820px, 96vw);
}

.batch-config-dialog .field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.batch-config-dialog select {
  min-height: 138px;
}

/* 批量弹窗风格预览：只显示首图、小卡片、限高滚动，避免顶掉「确认加入」按钮 */
.batch-config-dialog {
  overflow-y: auto;
}
.batch-config-dialog .style-preview-strip {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  max-height: 180px;
  overflow-y: auto;
}
.batch-config-dialog .style-preview-card {
  padding: 4px;
  gap: 3px;
}
.batch-config-dialog .style-preview-card small {
  display: none;
}
.batch-config-dialog .prompt-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 8px;
}

.progress-wrap {
  display: grid;
  gap: 8px;
}

.manual-prompt-field {
  display: block;
  margin-top: 10px;
}

.manual-prompt-field textarea {
  min-height: 96px;
}

.scene-variable-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.scene-variable-grid label,
.compact-mode-grid label {
  gap: 4px;
}

.scene-variable-grid span,
.compact-mode-grid span {
  font-size: 12px;
}

.scene-variable-grid select,
.compact-mode-grid select {
  min-height: 34px;
  padding: 6px 10px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.compact-mode-grid {
  gap: 8px;
  margin-top: 8px;
}

.main-edit-panel {
  display: grid;
  gap: 16px;
}

.edit-tool-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.edit-tool-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  border-radius: 6px;
  padding: 9px 16px;
  cursor: pointer;
}

.edit-tool-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.main-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.edit-workspace,
.edit-side {
  display: grid;
  gap: 12px;
}

.canvas-shell {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f4ef;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.canvas-shell canvas {
  max-width: 100%;
  height: auto;
  background: #fff;
  border-radius: 4px;
}

.file-button {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  background: #fff;
  cursor: pointer;
}

.file-button.ghost-file {
  border-color: var(--line);
}

.edit-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.edit-result-image {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.main-edit-page {
  width: min(1480px, calc(100% - 32px));
  margin: 22px auto 40px;
}

.compact-heading {
  margin-bottom: 16px;
}

.editor-shell {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(520px, 1.55fr) minmax(300px, 0.78fr);
  gap: 16px;
  align-items: stretch;
}

.editor-canvas-col {
  display: grid;
  grid-template-rows: auto minmax(520px, 1fr) auto auto;
  gap: 10px;
  min-width: 0;
  height: 100%;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-file {
  display: inline-grid;
  min-height: 38px;
  padding: 0 14px;
}

.editor-canvas-shell {
  min-height: 640px;
  background: #202020;
}

.editor-canvas-shell canvas {
  background: #202020;
}

.editor-side {
  display: grid;
  gap: 12px;
  align-content: stretch;
  height: 100%;
}

.editor-left {
  grid-template-rows: minmax(180px, auto) minmax(0, 1fr);
}

.editor-right {
  grid-template-rows: 1fr;
}

.editor-right .edit-card {
  align-content: start;
}

.edit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.edit-card h2 {
  font-size: calc(15px * var(--font-scale));
  margin: 0;
}

.tight-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.dense-ref-grid,
.scene-product-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ref-item {
  position: relative;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px;
  background: #fbfaf7;
}

.ref-item img {
  width: 100%;
  aspect-ratio: 1 / 0.78;
  object-fit: cover;
  border-radius: 4px;
  background: #fff;
}

.ref-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.9);
  color: #9b1c1c;
}

.ref-item small {
  color: var(--muted);
  font-size: 12px;
}

.upload-panel .reference-grid {
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
}

.upload-panel .ref-item {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 0;
  aspect-ratio: 1;
  overflow: hidden;
  text-align: center;
}

.upload-panel .ref-item img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.upload-panel .ref-item i {
  position: absolute;
  top: 5px;
  right: 5px;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

.color-chip {
  min-height: 34px;
  border: 2px solid transparent;
  color: #fff;
  font-weight: 700;
  padding: 0;
}

.color-chip.active {
  border-color: #111;
  box-shadow: 0 0 0 2px #fff inset;
}

.region-prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.region-prompt {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
}

.region-prompt span {
  color: #fff;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 0;
}

.region-prompt input {
  min-height: 32px;
  padding: 6px 8px;
}

.edit-result-box {
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f4ef;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.edit-result-box img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #fff;
}

.local-result-card {
  align-self: stretch;
}

.scene-tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  align-items: start;
}

.scene-settings-card {
  align-content: start;
}

.scene-output {
  display: grid;
  gap: 14px;
}

.scene-prompt-list {
  display: grid;
  gap: 8px;
}

.scene-prompt-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfaf7;
}

.scene-prompt-item p {
  margin: 5px 0 0;
  color: var(--muted);
}

.scene-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.scene-result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.scene-result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #f6f4ef;
  border-radius: 6px;
}

@media (max-width: 1100px) {
  .editor-shell,
  .scene-tool-grid {
    grid-template-columns: 1fr;
  }

  .editor-canvas-shell {
    min-height: 420px;
  }

  .scene-result-grid {
    grid-template-columns: 1fr;
  }

  .task-action-grid,
  .task-action-panel {
    grid-template-columns: 1fr;
  }

  .task-action-buttons {
    justify-content: flex-start;
  }

  .preset-manager {
    grid-template-columns: 1fr;
  }

  .prompt-lab-tool-row {
    grid-template-columns: 1fr;
  }
  .prompt-lab-editor-grid {
    grid-template-columns: 1fr;
  }

  .prompt-lab-effect-panel,
  .prompt-lab-results-panel {
    position: static;
    height: auto;
  }
  .prompt-lab-results-panel .prompt-lab-results {
    max-height: 600px;
  }
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e6e1d7;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #5fa89f);
  transition: width 0.25s ease, background 0.2s ease;
}

.progress-bar.running,
.progress-bar.done {
  background: linear-gradient(90deg, var(--accent), #5fa89f);
}

.progress-bar.failed {
  background: linear-gradient(90deg, #b42318, #d75f54);
}

.status {
  min-height: 24px;
  color: var(--muted);
}

.results-section {
  grid-column: 1 / -1;
}

.combo-final-section {
  border: 1px solid rgba(28, 128, 119, 0.22);
  border-radius: 10px;
  padding: 16px;
  background: #fffdf8;
}

.combo-final-results {
  display: grid;
  gap: 14px;
}

.combo-final-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(34, 43, 48, 0.06);
}

.combo-final-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.combo-final-card h3 {
  margin: 2px 0 4px;
  font-size: 18px;
}

.combo-final-card p {
  margin: 0;
}

.combo-final-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.combo-final-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.combo-final-group {
  display: grid;
  gap: 8px;
}

.combo-final-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}

.combo-final-image {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf8f2;
}

.combo-final-image.selected {
  border-color: var(--brand);
  background: rgba(28, 128, 119, 0.08);
  box-shadow: 0 0 0 2px rgba(28, 128, 119, 0.12);
}

.combo-final-image .image-box {
  min-height: 116px;
  aspect-ratio: 1 / 1;
}

.combo-final-image .image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.combo-pick-output {
  min-height: 32px;
  border: 1px solid rgba(28, 128, 119, 0.3);
  border-radius: 7px;
  background: #fff;
  color: var(--brand);
  font-weight: 700;
}

.combo-final-image.selected .combo-pick-output {
  background: var(--brand);
  color: #fff;
}

.small-empty {
  min-height: 116px;
  display: grid;
  place-items: center;
}

.result-preview-tabs {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #fff, #f9f7f1);
}

.result-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
}

.result-preview-head span {
  color: var(--muted);
  font-size: 13px;
}

.bookmark-tabs {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.bookmark-tab {
  position: relative;
  min-height: 36px;
  max-width: 260px;
  padding: 8px 14px 7px;
  border: 1px solid var(--line);
  border-bottom-color: #d8d2c3;
  border-radius: 8px 8px 0 0;
  background: #f3efe6;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bookmark-tab.active {
  background: #fff;
  color: var(--brand);
  border-color: rgba(28, 128, 119, 0.35);
  border-bottom-color: #fff;
  box-shadow: 0 -1px 0 #fff inset, 0 6px 16px rgba(22, 84, 76, 0.08);
}

.section-title {
  margin-bottom: 14px;
}

.section-title span {
  color: var(--muted);
}

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.section-actions .ghost {
  min-height: 34px;
}

.account-menu {
  position: relative;
}

.account-menu-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 72px;
  max-width: 160px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.account-menu-button .user-badge {
  min-height: auto;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 132px;
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: transparent;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  min-width: 160px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
}

.account-dropdown a,
.account-dropdown button,
.account-dropdown label {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.account-dropdown a:hover,
.account-dropdown button:hover,
.account-dropdown label:hover {
  background: #f4f6f5;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 12px;
}

.title-results-section {
  grid-column: 1 / -1;
}

.title-results {
  display: grid;
  gap: 10px;
}

.title-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.title-result-card p {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}

.title-result-card button {
  flex: 0 0 auto;
}

.size-result-grid {
  grid-template-columns: minmax(220px, 360px);
}

.size-export-layout {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(320px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.taobao-export-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 210px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.taobao-export-panel h3 {
  margin: 4px 0 6px;
  font-size: 18px;
}

.taobao-export-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.taobao-export-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.taobao-export-meta div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.taobao-export-meta dt {
  color: var(--muted);
  font-size: 12px;
}

.taobao-export-meta dd {
  margin: 4px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
}

.taobao-export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.taobao-export-actions button {
  min-height: 34px;
}

.result-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  overflow: hidden;
}

.result-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.result-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.delete-result {
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b42318;
  font-size: 13px;
  line-height: 1;
  text-decoration: underline;
}

.result-progress {
  height: 4px;
  background: #e8eee9;
  overflow: hidden;
}

.result-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: #2f8f6b;
  transition: width 0.25s ease, background 0.2s ease;
}

.result-progress.running span {
  background: linear-gradient(90deg, #2f8f6b, #6dbf95);
}

.result-progress.done span {
  background: #2f8f6b;
}

.result-progress.failed span {
  background: #c9433a;
}

.image-box {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: inherit;
}

.image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.image-box:disabled {
  cursor: default;
  opacity: 1;
}

.placeholder {
  color: #8b8f8d;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}

.regen-one,
.view-prompt {
  min-height: 36px;
  border-radius: 0;
  background: #fff;
  color: var(--accent-dark);
}

.view-prompt {
  border-right: 1px solid var(--line);
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.76);
}

.image-viewer[hidden] {
  display: none;
}

.image-viewer img {
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  object-fit: contain;
  background: #fff;
}

.viewer-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 28px;
}

.prompt-editor {
  position: fixed;
  inset: 0;
  z-index: 52;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.48);
}

.prompt-editor[hidden] {
  display: none;
}

.prompt-dialog {
  width: min(760px, 96vw);
  max-height: 88vh;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
}

.prompt-dialog textarea {
  min-height: 320px;
}

.prompt-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1100px) {
  .layout,
  .admin-layout,
  .admin-users-grid,
  .style-workbench,
  .product-writeback-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .brand-logo {
    width: 50px;
    height: 50px;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .module-nav {
    padding: 10px 16px;
  }

  .admin-nav {
    flex-wrap: wrap;
    padding: 0 12px;
  }

  .admin-nav button {
    flex: 1 1 50%;
    padding: 0 10px;
  }

  .layout {
    padding: 16px;
  }

  .product-search,
  .selected-product {
    align-items: stretch;
    flex-direction: column;
  }

  .module-heading {
    align-items: flex-start;
    flex-direction: column;
  }

}

.assistant-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 300;
  font-size: 14px;
}

.assistant-widget.dragging {
  user-select: none;
}

.assistant-widget.holding .assistant-toggle,
.assistant-widget.holding .assistant-head {
  filter: brightness(1.04);
  transform: scale(1.02);
}

.assistant-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 14px 6px 7px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  font-weight: 700;
  cursor: grab;
  touch-action: none;
}

.assistant-widget.dragging .assistant-toggle,
.assistant-widget.dragging .assistant-head {
  cursor: grabbing;
}

.assistant-mascot {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.88);
}

.assistant-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(380px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.assistant-widget.panel-below .assistant-panel {
  top: 76px;
  bottom: auto;
}

.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7f6f1;
  cursor: grab;
  touch-action: none;
}

.assistant-head button {
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 20px;
}

.assistant-hint-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.assistant-hint-toggle input {
  width: 36px;
  height: 20px;
  accent-color: var(--accent);
}

.assistant-messages {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  background: #fbfaf7;
}

.assistant-message {
  white-space: pre-wrap;
  line-height: 1.55;
  padding: 9px 11px;
  border-radius: 8px;
}

.assistant-message.bot {
  background: #fff;
  border: 1px solid var(--line);
}

.assistant-message.typing::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1em;
  margin-left: 3px;
  border-right: 2px solid var(--accent);
  vertical-align: -2px;
  animation: assistant-caret 0.8s steps(1) infinite;
}

@keyframes assistant-caret {
  50% {
    opacity: 0;
  }
}

.assistant-message.user {
  justify-self: end;
  max-width: 88%;
  background: #e5f4f0;
  color: #123d35;
}

.assistant-action-card {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid #b7d8d0;
  border-radius: 8px;
  background: #f2faf7;
}

.assistant-action-card strong {
  color: #123d35;
}

.assistant-action-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.assistant-action-detail {
  color: #315b53;
  font-size: 13px;
}

.assistant-action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.assistant-action-buttons button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
}

.assistant-confirm-action {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.assistant-cancel-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.assistant-quick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px 0;
}

.assistant-quick button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
}

.assistant-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 8px;
  padding: 12px;
}

.assistant-input-row textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
}

.assistant-input-row button {
  min-height: 42px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  border: 0;
}

/* ═══ Toast 通知 ═══ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #143d3a;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  pointer-events: auto;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  cursor: pointer;
}

.toast.error {
  background: #b42318;
}

.toast.warning {
  background: #b76738;
}

.toast.success {
  background: #176453;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ═══ 全局过渡动画 ═══ */
button, a, input, select, textarea {
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

button:active {
  transform: scale(0.97);
}

.panel {
  transition: box-shadow 0.2s;
}

.panel:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.product-item {
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s;
}

.product-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.product-item:active {
  transform: scale(0.98);
}

.admin-nav button {
  transition: color 0.15s, border-color 0.15s;
}

.module-tab {
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.result-grid img {
  transition: transform 0.2s, box-shadow 0.2s;
}

.result-grid img:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.progress-bar {
  transition: width 0.4s ease;
}

.preset-title-item {
  transition: border-color 0.15s, background 0.15s;
}

.prompt-lab-card {
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

/* ═══ 图片加载骨架屏 ═══ */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f2f0ea 25%, #e8e5dc 50%, #f2f0ea 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

/* ═══ 空状态优化 ═══ */
.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state::before {
  content: "📭";
  font-size: 40px;
}

/* ═══ 响应式增强 ═══ */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr !important;
    padding: 12px 10px 24px;
  }
  .style-clone-page {
    grid-template-columns: 1fr;
    padding: 12px 10px 24px;
  }
  .style-clone-product-panel,
  .style-clone-reference-panel,
  .style-clone-prompt-panel,
  .style-clone-results-section {
    grid-column: 1 / -1;
    grid-row: auto;
    position: static;
    max-height: none;
    overflow: visible;
  }
  .admin-layout {
    grid-template-columns: 1fr;
    padding: 12px 10px 24px;
  }
  .topbar {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .topbar h1 {
    font-size: 20px;
  }
  .product-search {
    flex-wrap: wrap;
  }
  .product-search select {
    flex: 1 1 100%;
  }
  .product-writeback-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .panel {
    padding: 16px;
  }
  .dropzone {
    width: min(100%, 340px);
  }
  .style-workbench,
  .task-action-grid,
  .mode-grid,
  .prompt-lab-editor-grid {
    grid-template-columns: 1fr;
  }
  .style-preview-panel {
    min-height: 320px;
  }
  .generate-row,
  .task-mode-switch,
  .task-action-buttons,
  .section-actions {
    flex-wrap: wrap;
  }
  .task-action-panel {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .task-action-buttons button,
  .upload-actions button {
    flex: 1 1 132px;
  }
  .product-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .style-clone-ref-slots {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .style-clone-form {
    grid-template-columns: 1fr;
  }
  .style-clone-prompt-text {
    min-height: 360px;
  }
  .style-clone-results {
    grid-template-columns: 1fr;
  }
  .style-clone-result-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto minmax(72px, auto);
  }
  .style-clone-result-image {
    grid-row: auto;
  }
  .product-item img {
    height: 132px;
  }
  .preset-manager {
    grid-template-columns: 1fr;
  }
  .prompt-lab-tool-row {
    grid-template-columns: 1fr;
  }
  .prompt-lab-editor-grid {
    grid-template-columns: 1fr;
  }
  .prompt-lab-effect-panel,
  .prompt-lab-results-panel {
    position: static;
    height: auto;
  }
  .prompt-lab-results-panel .prompt-lab-results {
    max-height: 600px;
  }
  .admin-filter-row {
    flex-direction: column;
  }
  .admin-filter-row input,
  .admin-filter-row select {
    max-width: none;
  }
  .toast-container {
    left: 10px;
    right: 10px;
    top: 10px;
  }
  .toast {
    min-width: 0;
    max-width: none;
  }
}
.trophy-page {
  width: min(1880px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.trophy-workbench {
  display: grid;
  grid-template-columns: 340px minmax(820px, 1fr) 360px;
  gap: 16px;
  align-items: stretch;
}

.trophy-product-panel,
.trophy-preview-panel,
.trophy-control-panel {
  min-height: 0;
}

.trophy-product-panel,
.trophy-control-panel {
  height: auto;
  overflow-y: auto;
}

.trophy-product-panel {
  display: flex;
  flex-direction: column;
}

.trophy-search {
  display: grid;
  grid-template-columns: 1fr 108px 74px;
  gap: 8px;
  margin-bottom: 12px;
}

.trophy-search input,
.trophy-search select,
.trophy-control-panel input,
.trophy-control-panel select,
.trophy-control-panel textarea {
  width: 100%;
}

.trophy-selected-product {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(36, 130, 117, 0.25);
  border-radius: 8px;
  background: #eefaf6;
}

.trophy-selected-product span {
  color: #5f6b72;
  font-size: 13px;
}

.trophy-selected-product button {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.trophy-product-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  align-content: start;
}

.product-dev-page {
  width: min(1880px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.product-dev-layout {
  display: none;
}

.product-dev-row {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.product-dev-row-full {
  grid-template-columns: 1fr;
}

.product-dev-row .panel,
.product-dev-row-full .panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.product-dev-pipeline { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; margin-bottom: 16px; }
.product-dev-pipeline .section-title { grid-column: 1 / -1; }
.product-dev-pipeline-steps { display: flex; flex-wrap: wrap; gap: 10px; }
.product-dev-pipeline-steps label { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 10px; border: 1px solid #ded8cd; border-radius: 8px; background: #fbfaf7; color: #344047; font-size: 13px; }

.product-dev-design-panel textarea,
.product-dev-multiview-panel textarea { width: 100%; resize: vertical; }
.product-dev-design-panel,
.product-dev-multiview-panel,
.product-dev-3d-panel,
.product-dev-results-panel,
.product-dev-editor-panel { display: flex; flex-direction: column; gap: 12px; }

.product-dev-actions { display: flex; align-items: center; gap: 10px; }
.product-dev-actions label { display: flex; align-items: center; gap: 4px; font-size: 13px; }

.product-dev-ref-head { display: flex; align-items: center; gap: 8px; }
.product-dev-ref-grid { display: flex; flex-wrap: wrap; gap: 8px; min-height: 80px; padding: 8px; border: 2px dashed #d5cebe; border-radius: 8px; background: #fdfcf7; }
.ref-thumb-wrap { position: relative; }
.ref-thumb-wrap .ref-thumb { width: 72px; height: 72px; border-radius: 6px; border: 1px solid #ddd; object-fit: cover; }
.ref-delete { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: #e74c3c; color: #fff; border: none; font-size: 12px; cursor: pointer; display: none; }
.ref-thumb-wrap:hover .ref-delete { display: block; }

.product-dev-upload { display: flex; align-items: center; justify-content: center; min-height: 140px; border: 2px dashed #d5cebe; border-radius: 10px; background: #fdfcf7; cursor: pointer; text-align: center; }
.product-dev-upload img { max-width: 100%; max-height: 100%; object-fit: contain; }

.product-dev-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; min-height: 320px; }
.product-dev-empty { grid-column: 1/-1; display: flex; align-items: center; justify-content: center; min-height: 300px; color: #999; font-size: 14px; border: 2px dashed #e0dbce; border-radius: 8px; background: #fdfdfa; }
.result-card { display: grid; gap: 6px; padding: 10px; border: 1px solid #e8e3d5; border-radius: 8px; background: #fff; }
.result-card .result-title { font-size: 12px; color: #666; display: flex; justify-content: space-between; }
.result-card .result-image { aspect-ratio: 1; border-radius: 6px; background: #f5f3ed; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.result-card .result-image img { width: 100%; height: 100%; object-fit: contain; }
.result-card .result-actions { display: flex; gap: 6px; }
.result-card .result-actions button { flex: 1; font-size: 12px; min-height: 28px; }

.product-dev-result { padding: 14px; background: #fafaf7; border: 1px solid #e8e3d5; border-radius: 8px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; max-height: 400px; overflow-y: auto; }

.product-dev-3d-stage { height: 1000px; position: relative; border: 2px dashed #d5cebe; border-radius: 10px; background: #1a1a2e; overflow: hidden; }
.product-dev-3d-stage.painting canvas { cursor: crosshair; }
.product-dev-3d-stage.erasing canvas { cursor: none; }
.product-dev-3d-stage canvas { display: block; width: 100%; height: 100%; }
.product-dev-3d-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #889; font-size: 14px; pointer-events: none; }
.product-dev-right-stack { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.product-dev-cube { font-size: 48px; opacity: 0.3; }
.product-dev-editor-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tool-sep { color: #ccc; margin: 0 2px; }
.mat-preset.active { background: #5a7d5a; color: #fff; border-color: #4a6d4a; }
.product-dev-provider-note { font-size: 12px; color: #888; padding: 8px 10px; background: #fdfcf7; border-radius: 6px; }

@media (max-width: 1280px) {
  .product-dev-layout { grid-template-columns: 1fr; }
  .product-dev-right { position: static; }
}
@media (max-width: 760px) {
  .product-dev-page { width: min(100vw - 20px, 100%); }
  .product-dev-layout { grid-template-columns: 1fr; }
}
}

.trophy-product-card {
  display: grid;
  gap: 6px;
  min-height: 184px;
  padding: 10px;
  border: 1px solid #ded8cd;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.trophy-product-card:hover,
.trophy-product-card.active {
  border-color: #248275;
  background: #f0fbf7;
}

.trophy-product-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 96px;
  border-radius: 6px;
  background: #f8f7f2;
  color: #8a8174;
  overflow: hidden;
}

.trophy-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.trophy-product-card strong {
  min-height: 40px;
  font-size: 14px;
  line-height: 1.35;
}

.trophy-product-card small {
  color: #69747b;
  font-size: 12px;
}

.trophy-pager {
  margin-top: 12px;
}

.trophy-product-hero {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.trophy-product-image-wrap {
  display: grid;
  gap: 10px;
}

.trophy-product-image,
.trophy-preview-area {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(36, 130, 117, 0.35);
  border-radius: 10px;
  background: #fbfbf8;
  color: #707b83;
  overflow: hidden;
}

.trophy-product-image {
  aspect-ratio: 1 / 1;
  min-height: 380px;
}

.trophy-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.trophy-image-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.trophy-image-actions .small-button {
  min-height: 36px;
}

.trophy-product-meta {
  display: grid;
  gap: 10px;
  align-content: center;
  padding: 16px;
  border-radius: 10px;
  background: #f7f4ed;
}

.trophy-product-meta strong {
  font-size: 22px;
  line-height: 1.3;
}

.trophy-product-meta span {
  color: #5f6b72;
}

.trophy-preview-area {
  min-height: 560px;
}

.trophy-canvas-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(5, auto);
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.trophy-canvas-toolbar span {
  min-width: 0;
  color: #5f6b72;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trophy-design-area {
  min-height: 860px;
  padding: 10px;
}

#trophyDesignCanvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  border-radius: 8px;
  background: #f8f6f1;
  cursor: move;
}

.trophy-preview-area img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.trophy-download-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #eefaf6;
}

.trophy-dxf-preview-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #ded8cd;
  border-radius: 10px;
  background: #fff;
}

.trophy-dxf-preview-panel iframe {
  display: block;
  width: 100%;
  height: 360px;
  border: 1px solid #e4ded3;
  border-radius: 8px;
  background: #fbfaf7;
}

.trophy-control-panel label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.trophy-control-panel {
  overflow-y: auto;
}

.trophy-control-panel textarea {
  min-height: 190px;
  resize: vertical;
}

.trophy-two-col,
.trophy-dimension-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.trophy-check-row {
  grid-template-columns: auto 1fr !important;
  align-items: center;
  align-content: center;
  padding-top: 24px;
}

.trophy-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 1480px) {
  .trophy-workbench {
    grid-template-columns: 360px minmax(460px, 1fr) 360px;
  }
}

@media (max-width: 1180px) {
  .trophy-workbench {
    grid-template-columns: 1fr;
  }

  .trophy-product-panel,
  .trophy-preview-panel,
  .trophy-control-panel {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .trophy-product-results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: auto;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .trophy-page {
    width: min(100vw - 20px, 100%);
    padding-top: 12px;
  }

  .trophy-search,
  .trophy-product-hero,
  .trophy-canvas-toolbar,
  .trophy-two-col,
  .trophy-dimension-grid,
  .trophy-action-grid {
    grid-template-columns: 1fr;
  }

  .trophy-product-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Combo image generation */
.combo-builder-panel,
.combo-plan-panel {
  grid-column: 1 / -1;
}

body[data-page="combo-image"] .upload-panel,
body[data-page="combo-image"] .product-readonly,
body[data-page="combo-image"] .product-writeback-grid,
body[data-page="combo-image"] .product-detail-panel,
body[data-page="combo-image"] .product-panel > .muted,
body[data-page="combo-image"] .task-mode-switch,
body[data-page="combo-image"] .task-action-grid {
  display: none;
}

body[data-page="combo-image"] .controls-panel {
  grid-column: 1 / -1;
}

body[data-page="combo-image"] .product-results {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  max-height: 430px;
  overflow-y: auto;
  padding: 3px 6px 3px 3px;
  scrollbar-gutter: stable;
}

.combo-pool-summary {
  padding: 7px 11px;
  border: 1px solid #a9d0c8;
  border-radius: 6px;
  background: #edf8f5;
  color: #176453;
  font-weight: 700;
}

.combo-config-grid {
  display: grid;
  grid-template-columns: minmax(320px, 2fr) minmax(190px, 0.8fr) minmax(190px, 0.8fr) minmax(250px, 1fr);
  gap: 12px;
  align-items: end;
}

.combo-config-grid label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.combo-config-grid input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.combo-config-grid small,
.combo-plan-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.combo-build-action {
  display: grid;
  gap: 8px;
  align-content: end;
}

.combo-build-action button {
  min-height: 44px;
}

/* 组合生图双模式 */
.combo-mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: #eef2f0;
  margin-bottom: 10px;
}

.combo-mode-btn {
  min-height: 34px;
  padding: 0 20px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.combo-mode-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(27, 121, 106, 0.14);
}

.combo-mode-hint {
  margin: 0 0 12px;
}

.combo-mode-panel {
  margin-top: 12px;
}

.combo-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
}

.combo-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.combo-block-head strong {
  font-size: 15px;
}

.combo-manual-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.combo-pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.combo-pick-item .combo-pick-info {
  flex: 1 1 auto;
}

.combo-pick-item .product-thumb {
  flex: 0 0 48px;
}

.combo-pick-item.checked {
  border-color: var(--accent);
  background: #edf8f5;
}

.combo-pick-item.must {
  box-shadow: inset 0 0 0 1px #e0a93b;
}

.combo-pick-item .product-thumb,
.combo-core-chip .product-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f4f3;
  font-size: 12px;
  color: var(--muted);
}

.combo-pick-item .product-thumb img,
.combo-core-chip .product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.combo-pick-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.combo-pick-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-must-toggle {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #c7ccca;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.combo-must-toggle.active {
  border-color: #e0a93b;
  background: #fdf4e3;
  color: #e0a93b;
}

.combo-manual-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.combo-core-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.combo-core-chip {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.combo-row-remove {
  display: block;
  margin-top: 6px;
  padding: 0;
  font-size: 12px;
}

/* 组合三模式 Tab */
.combo-tab-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.combo-tab-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: #eef2f0;
}

.combo-tab-btn {
  min-height: 36px;
  padding: 0 20px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.combo-tab-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(27, 121, 106, 0.14);
}

.combo-task-name-row {
  display: grid;
  gap: 7px;
  max-width: 520px;
  margin-bottom: 12px;
}

.combo-task-name-row input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.combo-tab-panel {
  display: grid;
  gap: 14px;
}

/* 组合规格多行表 */
.combo-spec-rows {
  display: grid;
  gap: 8px;
}

.combo-spec-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.combo-spec-row label {
  display: grid;
  gap: 4px;
}

.combo-spec-row label span {
  font-size: 12px;
  color: var(--muted);
}

.combo-spec-row input {
  width: 110px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.combo-spec-x {
  align-self: center;
  padding-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.combo-spec-del {
  padding-bottom: 8px;
  font-size: 13px;
}

.combo-inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.combo-inline-field span {
  font-size: 13px;
  color: var(--muted);
}

.combo-inline-field input {
  width: 90px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.combo-pick-remove {
  font-size: 12px;
}

.combo-plan-head .section-actions {
  flex-wrap: wrap;
}

.combo-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.combo-plan-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  table-layout: auto;
  background: #fff;
}

.combo-plan-table th,
.combo-plan-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

.combo-plan-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f8f7;
  color: #40504d;
  white-space: nowrap;
}

.combo-plan-table tr:last-child td {
  border-bottom: 0;
}

.combo-plan-table code,
.combo-row-status {
  white-space: nowrap;
}

.combo-row-status {
  color: #176453;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .combo-config-grid {
    grid-template-columns: 1fr 1fr;
  }

  .combo-task-name-field,
  .combo-build-action {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .combo-config-grid {
    grid-template-columns: 1fr;
  }

  .combo-task-name-field,
  .combo-build-action {
    grid-column: auto;
  }
}

@media (max-width: 1100px) {
  .combo-product-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  body[data-page="combo-image"] .product-item {
    min-height: 260px;
  }

  body[data-page="combo-image"] .product-thumb {
    height: 170px;
  }

  .combo-pool-actions {
    width: 100%;
    justify-content: space-between;
  }

  .combo-product-detail-dialog {
    width: calc(100vw - 20px);
  }

  .combo-product-detail-grid {
    grid-template-columns: 1fr;
  }
}

.combo-page {
  max-width: 1720px;
  margin: 0 auto;
  padding: 22px;
}

.combo-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.4fr);
  gap: 16px;
  align-items: stretch;
}

.combo-left {
  display: grid;
  gap: 16px;
}

.combo-upload-panel,
.combo-reference-panel,
.combo-control-panel,
.combo-results-section {
  min-width: 0;
}

.combo-dropzone {
  min-height: 150px;
  border: 1px dashed #8bb8b0;
  border-radius: 8px;
  background: #f7fbfa;
  display: grid;
  place-items: center;
  text-align: center;
  color: #50605e;
  cursor: pointer;
  padding: 22px;
}

.combo-dropzone strong {
  display: block;
  margin-bottom: 8px;
  color: #1f2a2a;
  font-size: 18px;
}

.combo-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.combo-thumb-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}

.combo-thumb {
  position: relative;
  min-height: 136px;
  border: 1px solid #ded8ce;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.combo-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 6px;
  background: #f5f3ee;
}

.combo-thumb button {
  position: absolute;
  top: 7px;
  right: 7px;
  border: 1px solid rgba(218, 99, 91, 0.35);
  color: #cc5149;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  padding: 3px 7px;
}

.combo-thumb span {
  color: #60706e;
  font-size: 13px;
  text-align: center;
}

.combo-form-grid,
.combo-prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.combo-form-grid label,
.combo-prompt-grid label,
.combo-options label {
  display: grid;
  gap: 6px;
  color: #2d3837;
  font-weight: 700;
}

.combo-form-grid textarea,
.combo-prompt-grid textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
}

.combo-prompt-grid {
  margin-top: 12px;
}

.combo-prompt-grid textarea {
  min-height: 180px;
}

.combo-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: end;
  margin: 14px 0;
}

.combo-options label {
  grid-auto-flow: column;
  align-items: center;
  font-weight: 500;
}

.combo-options label:has(select) {
  grid-auto-flow: row;
  min-width: 150px;
}

.combo-options select {
  min-height: 42px;
}

.combo-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.combo-actions button {
  min-width: 140px;
}

.combo-result-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.combo-result-tabs button {
  border: 1px solid #d8d2c8;
  background: #fff;
  border-radius: 7px;
  padding: 8px 18px;
  color: #245f58;
}

.combo-result-tabs button.active {
  background: #24877d;
  color: #fff;
  border-color: #24877d;
}

.combo-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  min-height: 220px;
}

.combo-result-card,
.combo-title-card {
  border: 1px solid #ded8ce;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.combo-result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #f5f3ee;
  border-radius: 6px;
}

.combo-result-card div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.combo-result-card a {
  color: #0d6f65;
  white-space: nowrap;
}

.combo-title-card {
  grid-column: 1 / -1;
}

@media (max-width: 980px) {
  .combo-layout,
  .combo-form-grid,
  .combo-prompt-grid {
    grid-template-columns: 1fr;
  }

  .combo-page {
    padding: 12px;
  }
}

/* 单品生图·主图风格标签（文件夹标签样式） */
.mstyle-tag-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0 2px; position: relative; z-index: 2; }
.mstyle-tag { padding: 9px 20px; border: 1px solid var(--line, #d9d2c6); border-bottom: none; border-radius: 10px 10px 0 0; background: #efeae0; color: #6a6354; font-size: 14px; font-weight: 500; cursor: pointer; margin-bottom: -1px; transition: background .15s, color .15s; }
.mstyle-tag:hover { color: var(--accent, #237b73); background: #f6f2ea; }
.mstyle-tag.active { background: #fff; color: var(--accent, #237b73); border-top: 3px solid var(--accent, #237b73); padding-top: 7px; font-weight: 600; }
.mstyle-preset-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mstyle-preset { padding: 5px 11px; border: 1px solid #e0d9cc; border-radius: 6px; background: #faf8f3; color: #5b5346; font-size: 12px; cursor: pointer; transition: all .15s; }
.mstyle-preset:hover { border-color: var(--accent,#237b73); }
.mstyle-preset.active { background: #eef9f6; border-color: var(--accent,#237b73); color: var(--accent,#237b73); font-weight: 600; }

/* 单品生图·单列整行卡片布局 */
body[data-page="single-product"] .layout { grid-template-columns: 1fr; }
/* 风格图卡选择 */
.style-pick-block { margin-top: 10px; }
.style-pick-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
/* 文件夹「内容区」：风格效果图大图网格 */
.style-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 0; border: 1px solid var(--line,#d9d2c6); border-radius: 0 12px 12px 12px; padding: 16px; background: #fafafa; position: relative; z-index: 1; min-height: 80px; }
#detailStyleCards.style-card-grid { border-radius: 12px; margin-top: 8px; }
.style-card { border: 2px solid var(--line,#e6e0d6); border-radius: 12px; overflow: hidden; background: #fff; cursor: pointer; padding: 0; text-align: left; transition: border-color .15s, box-shadow .15s; }
.style-card:hover { border-color: var(--accent,#237b73); box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.style-card.active { border-color: var(--accent,#237b73); box-shadow: 0 0 0 3px rgba(35,123,115,.2); }
.style-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: #f4f1ea; }
.style-card .sc-cap { display: block; padding: 8px 10px; font-size: 13px; color: #4a4338; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.style-card .sc-noimg { width: 100%; aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center; color: #b3a994; font-size: 13px; background: #f4f1ea; }
/* 7张预览弹窗 */
.style-shots-modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.style-shots-modal[hidden] { display: none !important; }
.style-shots-dialog { background: #fff; border-radius: 12px; width: 920px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); overflow: auto; padding: 16px; }
.style-shots-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.style-shots-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.style-shots-grid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; background: #f4f1ea; }

/* 单品·上传素材 + SKU合并 左右两栏 */
body[data-page="single-product"] .upload-merge-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: stretch; }
/* 左列：上传素材卡片内嵌「SKU 合并」（素材下方） */
body[data-page="single-product"] .sku-merge-inline { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line,#d9d2c6); }
body[data-page="single-product"] .sku-merge-inline h3 { margin: 0 0 8px; font-size: 16px; }

/* 右列：参考图卡片 = 参考图上传 + 缩略图 + 场景解析 一体，且与上传素材卡片等高 */
body[data-page="single-product"] .reference-card { display: flex; flex-direction: column; }
body[data-page="single-product"] .reference-card .reference-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
body[data-page="single-product"] .reference-card .reference-scene-panel { margin-top: 14px; flex: 1 1 auto; display: flex; flex-direction: column; }
body[data-page="single-product"] .reference-card .reference-scene-panel textarea { flex: 1 1 auto; min-height: 220px; resize: vertical; }
@media (max-width: 900px) { body[data-page="single-product"] .upload-merge-row { grid-template-columns: 1fr; } }

/* 上传素材：多素材缩略图网格 */
.material-thumbs{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:10px;margin-top:10px}
.material-thumbs .material-thumb-tip{grid-column:1/-1;font-size:12px;color:#8a94a6;margin:2px 0 0}
.material-thumb{position:relative;border:1px solid #e3e7ee;border-radius:10px;overflow:hidden;aspect-ratio:1/1;background:#f6f8fb}
.material-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.material-thumb-idx{position:absolute;left:4px;bottom:4px;font-size:11px;line-height:1;padding:2px 6px;border-radius:6px;background:rgba(0,0,0,.55);color:#fff}
.material-thumb-remove{position:absolute;top:4px;right:4px;width:20px;height:20px;border:none;border-radius:6px;background:rgba(0,0,0,.55);color:#fff;font-size:15px;line-height:18px;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center}
.material-thumb-remove:hover{background:#e5484d}

/* 上传素材：大框并排（替代空 dropzone），含「+添加素材」方块 */
.material-thumbs.grid-main{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:14px;margin-top:0}
.material-thumbs.grid-main .material-thumb{aspect-ratio:1/1;border-radius:14px}
.material-thumbs.grid-main .material-thumb-idx{font-size:13px;padding:3px 8px}
.material-thumbs.grid-main .material-thumb-remove{width:26px;height:26px;font-size:18px;border-radius:8px}
.material-add{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;border:2px dashed #cfd6e0;background:#fafbfc;color:#7a8699;cursor:pointer;font-size:14px}
.material-add:hover{border-color:#1f9d78;color:#1f9d78;background:#f3faf7}
.material-add-plus{font-size:40px;line-height:1;font-weight:300}

/* 合并后：素材 + 竖线 + 合并图 同排（不撑高） */
.material-thumbs.merged-row{display:flex;flex-wrap:wrap;align-items:flex-start;gap:12px;margin-top:0}
.material-thumbs.merged-row .material-thumb{flex:0 0 auto;width:150px;height:150px;aspect-ratio:auto;border-radius:12px}
.material-thumbs.merged-row .material-merged{width:184px;height:184px;border:2px solid var(--accent,#237b73)}
.material-thumbs.merged-row .material-merged .material-thumb-idx{background:var(--accent,#237b73)}
.material-sep{flex:0 0 1px;align-self:stretch;min-height:150px;background:var(--line,#d9d2c6);margin:0 6px}
.material-merged-acts{position:absolute;top:5px;right:5px;display:flex;gap:5px}
.material-merged-acts .material-thumb-remove,.material-merged-regen{position:static;width:26px;height:26px;border:none;border-radius:8px;background:rgba(0,0,0,.55);color:#fff;font-size:15px;line-height:1;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center}
.material-merged-regen:hover{background:#237b73}
.material-merged-acts .material-thumb-remove:hover{background:#e5484d}

/* 商品库切换拨杆开关（聚水潭/PNG库） */
.lib-switch{display:inline-flex;align-items:center;gap:8px;cursor:pointer;user-select:none;margin-left:4px}
.lib-switch .lib-switch-cap{font-size:13px;color:#8a8275}
.lib-switch input{position:absolute;opacity:0;width:0;height:0}
.lib-switch .lib-switch-slider{position:relative;width:42px;height:22px;border-radius:999px;background:#cfd6e0;transition:background .15s;flex:0 0 auto}
.lib-switch .lib-switch-slider::after{content:"";position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:transform .15s}
.lib-switch input:checked + .lib-switch-slider{background:var(--accent,#237b73)}
.lib-switch input:checked + .lib-switch-slider::after{transform:translateX(20px)}
.lib-switch .lib-switch-text{font-size:13px;font-weight:600;color:#4a4338;min-width:48px}

/* ═══ 自主批量任务 ═══ */
.self-batch-dialog { width: min(1080px, 96vw); overflow-y: auto; }
.self-batch-toolbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:6px; }
.self-batch-table-wrap { overflow:auto; max-height:58vh; }
.self-batch-table { width:100%; border-collapse:collapse; font-size:13px; }
.self-batch-table th, .self-batch-table td { border:1px solid var(--line,#eee); padding:6px 8px; text-align:left; vertical-align:middle; }
.self-batch-table th { background:#faf9f6; position:sticky; top:0; z-index:1; }
.self-batch-table img { width:56px; height:56px; object-fit:cover; border-radius:6px; }
.self-batch-table select { min-width:130px; max-width:190px; }
.self-batch-row-done td { opacity:.55; }
.self-batch-table .sb-res { width:44px; height:44px; object-fit:cover; border-radius:4px; margin:2px; cursor:zoom-in; border:1px solid var(--line,#eee); }
.self-batch-table td.sb-result { min-width:180px; }

/* 自建风格：主图风格来源切换 + 检验工作台（移植自 20260716 设计稿） */
.custom-style-source-tabs{display:flex;align-items:center;gap:8px;margin:0 0 10px}
.custom-style-scope-inline{display:flex;align-items:center;gap:7px;font-size:12px;color:#6f685d}
.custom-style-scope-inline select{min-width:110px;padding:7px 9px;border:1px solid var(--line,#d9d2c6);border-radius:8px;background:#fff}
.custom-style-scene-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:14px;margin-top:16px}
.custom-style-scene-empty{grid-column:1/-1;padding:24px;border:1px dashed var(--line,#d9d2c6);border-radius:12px;text-align:center;color:#8a8275;background:#faf9f6}
.custom-style-scene-card{border:1px solid var(--line,#d9d2c6);border-radius:14px;padding:12px;background:#fff;box-shadow:0 4px 14px rgba(39,34,27,.05)}
.custom-style-scene-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.custom-style-scene-head img{width:64px;height:64px;object-fit:cover;border-radius:10px;background:#f2efe9}
.custom-style-scene-head div{display:flex;flex-direction:column;gap:4px;min-width:0}
.custom-style-scene-head strong{font-size:14px;color:#332f28}
.custom-style-scene-head small{font-size:12px;color:#8a8275}
.custom-style-scene-card textarea{width:100%;box-sizing:border-box;resize:vertical;min-height:150px;border:1px solid #ddd6ca;border-radius:10px;padding:11px;line-height:1.65;background:#fcfbf8}
.custom-style-save-dialog{max-width:560px}
.custom-style-save-dialog input{width:100%;box-sizing:border-box;padding:11px;border:1px solid var(--line,#d9d2c6);border-radius:9px}
@media(max-width:720px){.custom-style-scene-grid{grid-template-columns:1fr}.custom-style-scope-inline{width:100%;justify-content:space-between}}

/* 自建风格检验工作台 */
.custom-style-verify-head .custom-style-meta{display:flex;gap:14px;margin-top:7px;color:#7c7467;font-size:13px}
.custom-style-test-product{display:flex;align-items:center;gap:12px;min-height:88px;padding:12px;border:1px dashed var(--line,#d9d2c6);border-radius:12px;color:#8a8275;background:#faf9f6}
.custom-style-test-product img{width:82px;height:82px;object-fit:contain;border-radius:10px;background:#fff}
.custom-style-verify-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px}
.custom-style-verify-card{border:1px solid var(--line,#d9d2c6);border-radius:14px;padding:12px;background:#fff;box-shadow:0 5px 18px rgba(39,34,27,.06)}
.custom-style-verify-image{display:flex;align-items:center;justify-content:center;aspect-ratio:1/1;border-radius:11px;overflow:hidden;background:#f3f1ec;color:#958c7d}
.custom-style-verify-image img{width:100%;height:100%;object-fit:contain;cursor:zoom-in}
.custom-style-scene-preview{margin:10px 0;padding:10px;max-height:150px;overflow:auto;border:1px solid #eee8df;border-radius:9px;background:#fcfbf8;color:#574f43;font-size:12px;line-height:1.6;white-space:pre-wrap}
.custom-style-verify-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.custom-style-edit-dialog{max-width:720px}
.custom-style-edit-dialog textarea{width:100%;box-sizing:border-box;padding:12px;border:1px solid var(--line,#d9d2c6);border-radius:10px;line-height:1.65;resize:vertical}
@media(max-width:720px){.custom-style-verify-grid{grid-template-columns:1fr}.custom-style-verify-actions{grid-template-columns:1fr}}

/* 提示词研发V2：结构化输入 + 85分审计 */
.prompt-lab-auto-research{margin:0 0 20px;padding:18px;border:1px solid #d9d2c6;border-radius:14px;background:linear-gradient(180deg,#fffdfa 0%,#f8f6f1 100%);box-shadow:0 5px 18px rgba(39,34,27,.05)}
.prompt-lab-research-toolbar{display:grid;grid-template-columns:minmax(150px,.8fr) minmax(190px,1.2fr) auto auto auto minmax(170px,1fr);gap:12px;align-items:end;margin:12px 0 16px}
.prompt-lab-research-toolbar label{display:flex;flex-direction:column;gap:6px;color:#625b50;font-size:12px;font-weight:650}
.prompt-lab-research-toolbar select{min-height:40px;border:1px solid var(--line,#d9d2c6);border-radius:9px;background:#fff;padding:8px 10px}
.prompt-lab-research-toolbar .prompt-lab-inline-check{flex-direction:row;align-items:center;align-self:center;padding-top:18px;white-space:nowrap}
.prompt-lab-research-toolbar .prompt-lab-inline-check input{width:17px;height:17px}
.prompt-lab-structured-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.prompt-lab-structured-field{display:flex;flex-direction:column;gap:6px;padding:11px;border:1px solid #e4ded3;border-radius:10px;background:#fff}
.prompt-lab-structured-field.wide{grid-column:1/-1}
.prompt-lab-structured-field>span{font-size:13px;font-weight:700;color:#4a4338}
.prompt-lab-structured-field small{font-size:11px;color:#8a8275;line-height:1.45}
.prompt-lab-structured-field input[type=text],.prompt-lab-structured-field input[type=number],.prompt-lab-structured-field select,.prompt-lab-structured-field textarea{width:100%;box-sizing:border-box;border:1px solid #ddd6ca;border-radius:8px;background:#fdfcf9;padding:9px 10px;line-height:1.55}
.prompt-lab-structured-field textarea{resize:vertical;min-height:68px}
.prompt-lab-structured-field.boolean{flex-direction:row;align-items:center;min-height:42px}
.prompt-lab-structured-field.boolean input{width:17px;height:17px;margin-right:3px}
.prompt-lab-advanced-console{margin-top:16px;padding:16px;border:1px solid #b9d6cf;border-radius:14px;background:linear-gradient(150deg,#f6fbf9 0%,#fffdfa 62%,#f8f3e9 100%);box-shadow:inset 0 1px 0 rgba(255,255,255,.75)}
.prompt-lab-advanced-console[hidden]{display:none}
.prompt-lab-advanced-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:14px}
.prompt-lab-advanced-head h4{margin:3px 0 6px;color:#244d47;font-size:18px}.prompt-lab-advanced-head p{max-width:850px;margin:0;color:#6e766f;font-size:12px;line-height:1.65}
.prompt-lab-advanced-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.prompt-lab-advanced-group{padding:14px;border:1px solid #d9e5e1;border-radius:12px;background:rgba(255,255,255,.9)}
.prompt-lab-advanced-group.runtime{border-color:#e4d7bd;background:#fffaf0}
.prompt-lab-advanced-group h5{display:flex;align-items:center;gap:8px;margin:0 0 11px;color:#2f5f58;font-size:14px}.prompt-lab-advanced-group.runtime h5{color:#816126}
.prompt-lab-advanced-group h5 span{display:inline-flex;min-width:22px;height:22px;align-items:center;justify-content:center;border-radius:7px;background:#e0f1ec;font-size:11px}.prompt-lab-advanced-group.runtime h5 span{background:#f7e9c8}
.prompt-lab-advanced-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.prompt-lab-advanced-fields .prompt-lab-structured-field{padding:9px;background:#fff}.prompt-lab-advanced-fields .prompt-lab-structured-field.wide{grid-column:1/-1}
.prompt-lab-advanced-effective{margin-top:12px;padding:10px 12px;border-radius:9px;background:rgba(31,122,109,.08);line-height:1.6}
.prompt-lab-advanced-effective.applied{color:#176b61;background:#dcf1eb;font-weight:650}
.prompt-lab-gate-badge{display:inline-flex;align-items:center;justify-content:center;min-height:26px;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:800;white-space:nowrap}
.prompt-lab-gate-badge.neutral{background:#ebe7df;color:#6d6558}.prompt-lab-gate-badge.pass{background:#dff5e8;color:#16673d}.prompt-lab-gate-badge.fail{background:#fde6e2;color:#9c2d22}.prompt-lab-gate-badge.running{background:#e3efff;color:#215ea8}
.prompt-lab-research-inline-status{display:flex;align-items:center;min-height:40px;padding:8px 12px;border:1px solid transparent;border-radius:9px;font-size:12px;font-weight:700;line-height:1.35}
.prompt-lab-research-inline-status.neutral{background:#f2f0eb;color:#6d6558}.prompt-lab-research-inline-status.running{background:#e3efff;border-color:#c8dcf8;color:#215ea8}.prompt-lab-research-inline-status.pass{background:#dff5e8;border-color:#bde7cd;color:#16673d}.prompt-lab-research-inline-status.fail{background:#fde6e2;border-color:#f4c7c0;color:#9c2d22}
.prompt-lab-audit-box{margin-top:16px;padding:14px;border:1px solid #ddd6ca;border-radius:12px;background:#fff}
.prompt-lab-audit-box[hidden]{display:none}
.prompt-lab-audit-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.prompt-lab-audit-head>div{display:flex;flex-direction:column;gap:4px}
.prompt-lab-audit-iterations{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}.prompt-lab-audit-iterations span{padding:5px 9px;border-radius:8px;background:#f1eee8;font-size:12px}.prompt-lab-audit-iterations span.pass{background:#dff5e8;color:#16673d}.prompt-lab-audit-iterations span.fail{background:#fde6e2;color:#9c2d22}
.prompt-lab-audit-dimensions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.prompt-lab-audit-dimension{display:grid;grid-template-columns:minmax(0,1fr) 42px;gap:8px;align-items:center;font-size:12px}.prompt-lab-audit-dimension i{height:7px;grid-column:1/-1;border-radius:999px;background:#ebe7df;overflow:hidden}.prompt-lab-audit-dimension i b{display:block;height:100%;background:#237b73;border-radius:999px}.prompt-lab-audit-dimension.weak i b{background:#d15a4a}
@media(max-width:900px){.prompt-lab-research-toolbar{grid-template-columns:1fr 1fr}.prompt-lab-structured-fields,.prompt-lab-audit-dimensions,.prompt-lab-advanced-groups{grid-template-columns:1fr}}
@media(max-width:620px){.prompt-lab-research-toolbar{grid-template-columns:1fr}.prompt-lab-research-toolbar .prompt-lab-inline-check{padding-top:0}.prompt-lab-advanced-head{flex-direction:column}.prompt-lab-advanced-fields{grid-template-columns:1fr}}
