:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --surface-3: #f8fbfa;
  --ink: #20232a;
  --muted: #667085;
  --line: #d9dee7;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --accent: #d94f45;
  --focus: #2563eb;
  --shadow: 0 18px 50px rgba(24, 34, 52, 0.12);
  --soft-shadow: 0 10px 30px rgba(24, 34, 52, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.preview-open {
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  min-height: 42px;
  padding: 0 14px;
  cursor: pointer;
}

button:focus {
  outline: none;
}

button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

button:hover {
  border-color: #aeb8c7;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

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

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

.ghost {
  background: transparent;
}

.danger {
  color: #b42318;
}

.small-action {
  min-height: 32px;
  min-width: 48px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.large {
  min-height: 46px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
  resize: vertical;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

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

.auth-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stack {
  display: grid;
  gap: 14px;
}

.auth-panel .stack {
  margin-top: 24px;
}

.auth-switch {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.auth-switch button {
  min-height: auto;
  border: 0;
  padding: 0;
  color: var(--primary);
  background: transparent;
  font-weight: 700;
}

.app {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 16px 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.topbar h1 {
  font-size: 24px;
}

.topbar .eyebrow {
  margin-bottom: 4px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.mobile-tabs {
  display: none;
}

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

.section {
  padding: 18px;
  margin-bottom: 18px;
}

.section-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.panel-head h2,
.section-head h2 {
  flex: 0 0 auto;
  white-space: nowrap;
}

.panel-head p {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.mode-block,
.selection-tray,
.ambience-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  padding: 12px;
}

.mode-block + .mode-block,
.selection-tray,
.ambience-block {
  margin-top: 12px;
}

.mode-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.25;
}

.selection-tray {
  display: grid;
  gap: 10px;
}

.selection-tray > div:first-child,
.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selection-tray strong,
.summary-head strong {
  font-size: 15px;
}

.selection-tray span,
.summary-head span {
  color: var(--muted);
  font-size: 13px;
}

.thumb-strip {
  display: flex;
  gap: 8px;
  min-height: 58px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.empty-inline {
  display: inline-flex;
  align-items: center;
  min-height: 58px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 0 12px;
}

.thumb-chip {
  position: relative;
  flex: 0 0 auto;
  width: 54px;
}

.thumb-chip img {
  display: block;
  width: 54px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
}

.thumb-chip span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumb-chip button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  border-radius: 999px;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

.thumb-chip.text-scene-chip > div {
  display: grid;
  place-items: center;
  width: 54px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7f4;
  color: var(--primary);
  font-weight: 900;
}

.admin-only.hidden {
  display: none !important;
}

.admin-settings {
  position: absolute;
  top: 78px;
  right: 24px;
  z-index: 25;
  width: min(760px, calc(100vw - 48px));
  padding: 0;
  box-shadow: var(--shadow);
}

.app:not(.settings-open) .admin-settings {
  width: 1px;
  height: 1px;
  margin: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.admin-settings details {
  padding: 16px 18px;
}

.admin-settings summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.admin-settings summary::-webkit-details-marker {
  display: none;
}

.admin-settings summary span {
  font-size: 18px;
  font-weight: 800;
}

.admin-settings summary small {
  color: var(--muted);
  font-size: 13px;
}

.admin-settings form {
  margin-top: 14px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
}

.provider-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.checkline {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 12px;
}

.checkline input {
  width: auto;
}

.checkline span {
  font-weight: 800;
}

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

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

.provider-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.provider-card.active-provider {
  border-color: #7fc8bd;
  background: #f1fbf8;
}

.provider-card strong,
.provider-card span,
.provider-card small {
  display: block;
}

.provider-card span {
  margin-top: 4px;
  color: var(--ink);
  font-size: 13px;
}

.provider-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.provider-card-actions {
  display: flex;
  gap: 8px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(300px, 0.82fr);
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

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

.workflow-shell {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}

.workflow-sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px;
}

.workflow-step,
.workflow-result {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.workflow-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
}

.workflow-step span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workflow-step strong {
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
}

.workflow-step.active {
  background: #e9f6f3;
  color: var(--primary);
}

.workflow-step.active span {
  background: var(--primary);
  color: #fff;
}

.workflow-result {
  min-height: 40px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 10px 0;
  font-size: 13px;
  font-weight: 800;
}

.workflow-result.active {
  color: var(--primary);
}

.workflow-main {
  min-width: 0;
}

.mobile-stepper {
  display: none;
}

.mobile-section {
  display: none;
}

.mobile-section.active-mobile {
  display: block;
}

.step-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.product-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 14px;
  align-items: start;
}

.product-workspace {
  position: relative;
}

.product-workspace.uploading .product-browse-view {
  display: none;
}

.product-workspace:not(.uploading) .product-upload-view {
  display: none;
}

.product-browse-view {
  position: relative;
}

.model-workspace {
  position: relative;
}

.model-workspace.creating .model-browse-view {
  display: none;
}

.model-workspace:not(.creating) .model-create-view {
  display: none;
}

.model-browse-view {
  position: relative;
}

.scene-workspace {
  position: relative;
}

.scene-workspace.creating .scene-browse-view {
  display: none;
}

.scene-workspace:not(.creating) .scene-create-view {
  display: none;
}

.scene-browse-view {
  position: relative;
}

.product-library,
.model-library,
.scene-library,
.model-layout,
.scene-layout {
  min-width: 0;
}

.product-library {
  grid-column: 1;
}

.product-tray-panel {
  grid-column: 2;
  grid-row: 1;
}

.product-toolbar {
  position: sticky;
  top: 18px;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(10px);
  padding: 10px;
}

.product-search {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
}

.product-search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-add-inline {
  min-height: 40px;
  white-space: nowrap;
}

.floating-add-product {
  display: none;
}

.product-tray-panel {
  position: sticky;
  top: 18px;
  margin-top: 0;
}

.product-upload-view {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  padding: 12px;
}

.upload-view-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.upload-view-head strong,
.upload-view-head span {
  display: block;
  min-width: 0;
}

.upload-view-head strong {
  font-size: 16px;
}

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

.model-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 14px;
  align-items: start;
}

.model-library {
  grid-column: 1;
}

.model-tray-panel {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 18px;
  margin-top: 0;
}

.model-toolbar {
  position: sticky;
  top: 18px;
  z-index: 8;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(10px);
  padding: 10px;
}

.model-create-view {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  padding: 12px;
}

.model-create-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.model-create-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.model-create-tabs button.active {
  background: var(--primary);
  color: #fff;
}

.model-create-pane {
  display: none;
}

.model-create-pane.active {
  display: block;
}

.scene-library {
  grid-column: 1;
}

.scene-tray-panel {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 18px;
  margin-top: 0;
}

.scene-tray-panel #selected-ambience {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-toolbar {
  position: sticky;
  top: 18px;
  z-index: 8;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(10px);
  padding: 10px;
}

.scene-create-view {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  padding: 12px;
}

.scene-create-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.scene-create-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.scene-create-tabs button.active {
  background: var(--primary);
  color: #fff;
}

.scene-create-pane {
  display: none;
}

.scene-create-pane.active {
  display: block;
}

.scene-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
  gap: 14px;
}

.scene-summary {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  padding: 11px;
}

.scene-summary strong {
  font-size: 14px;
}

.scene-summary span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.selected-scene-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.selected-scene-card img,
.selected-scene-text-preview,
.selected-scene-placeholder {
  width: 56px;
  height: 72px;
  border-radius: 7px;
  background: #fff;
}

.selected-scene-card img {
  object-fit: cover;
}

.selected-scene-text-preview,
.selected-scene-placeholder {
  display: grid;
  place-items: center;
  border: 1px solid rgba(47, 126, 116, 0.18);
  background: #eef7f4;
  color: var(--primary);
}

.selected-scene-placeholder {
  background: #fff;
}

.selected-scene-text-preview strong {
  font-size: 14px;
}

.selected-scene-card span,
.selected-scene-card strong,
.selected-scene-card p {
  display: block;
  min-width: 0;
}

.selected-scene-card span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.selected-scene-card strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.selected-scene-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.selected-scene-card .small-action {
  justify-self: end;
}

.generate-confirm-column .scene-summary {
  margin-bottom: 14px;
}

.result-section {
  display: none;
}

.result-section.active-mobile {
  display: block;
}

.generate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.generate-confirm-column {
  min-width: 0;
}

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

.desktop-showcase-preview {
  display: grid;
  gap: 10px;
}

.desktop-result-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-3);
}

.desktop-result-row .product-mini img {
  aspect-ratio: 4 / 5;
}

.desktop-result-row strong,
.desktop-result-row span,
.desktop-result-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-result-row strong {
  font-size: 13px;
}

.desktop-result-row span,
.desktop-result-row small {
  color: var(--muted);
  font-size: 12px;
}

.desktop-result-row a {
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
}

.upload-row,
.generate-row,
.edit-form {
  display: grid;
  gap: 10px;
}

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

.product-upload-form {
  gap: 10px;
}

.product-upload-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.product-upload-details summary {
  cursor: pointer;
  padding: 10px 11px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  list-style-position: inside;
}

.product-upload-details[open] {
  padding-bottom: 12px;
}

.product-upload-details[open] summary {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.product-upload-details .product-meta-grid,
.product-upload-details > label {
  margin-inline: 12px;
}

.product-upload-details > label {
  display: block;
  margin-top: 10px;
}

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

.upload-queue {
  display: grid;
  gap: 8px;
}

.upload-queue-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(120px, 0.4fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.upload-queue-item > span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.upload-queue-item strong {
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-queue-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.upload-queue-item select,
.upload-queue-item button {
  min-height: 34px;
}

.file-picker {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 5px;
  cursor: pointer;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  padding: 0 12px;
}

.file-picker small {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.generate-row {
  grid-template-columns: minmax(135px, 0.8fr) 1fr auto;
  margin-top: 10px;
}

.ambience-block {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.edit-form {
  grid-template-columns: minmax(160px, 0.45fr) minmax(240px, 1fr) auto;
  width: min(740px, 100%);
}

.task-section {
  margin-top: 18px;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-group {
  display: grid;
  gap: 10px;
}

.task-group-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.task-empty-inline {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 0;
}

.task-history {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-history-toggle {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  text-align: left;
}

.task-history-toggle small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.task-history-list {
  display: grid;
  gap: 10px;
  padding: 0 10px 10px;
}

.task-history-list .task-item {
  border-color: var(--line);
  background: var(--bg);
}

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

.task-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.task-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.task-title strong,
.task-message,
.task-meta,
.task-error {
  overflow-wrap: anywhere;
}

.task-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.task-status[data-status="completed"] {
  color: var(--success);
}

.task-status[data-status="failed"] {
  color: var(--danger);
}

.task-message {
  color: var(--text);
}

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

.task-error {
  color: var(--danger);
  font-size: 13px;
}

.task-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.asset-grid {
  display: grid;
  gap: 12px;
}

.empty-state {
  display: grid;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 18px;
}

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

.empty-state span {
  font-size: 13px;
  line-height: 1.5;
}

.compact {
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  align-items: start;
  align-content: start;
  grid-auto-rows: max-content;
  margin-top: 14px;
  max-height: none;
  overflow: visible;
  padding-right: 2px;
}

.compact.ambience-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  max-height: 340px;
  margin-top: 0;
  overflow: auto;
}

.showcase-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.asset-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.asset-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.asset-card.selected::before {
  content: "已选择";
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.text-scene-card {
  display: grid;
}

.text-scene-preview {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 146px;
  background: #eef7f4;
  color: var(--primary);
  padding: 14px;
}

.text-scene-preview strong {
  font-size: 15px;
}

.text-scene-preview span {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.asset-preview {
  display: block;
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.asset-preview:hover {
  border-color: transparent;
}

.asset-preview:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: -3px;
}

.asset-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--surface-2);
}

.showcase-grid .asset-preview img {
  aspect-ratio: 4 / 5;
}

.asset-body {
  display: grid;
  gap: 8px;
  padding: 9px;
}

.asset-name {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.asset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.asset-actions.product-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact .asset-actions {
  grid-template-columns: 1fr;
}

.product-group-card .asset-actions.product-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-group-card [data-product-select] {
  grid-column: 1 / -1;
}

.product-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.product-mini {
  display: block;
  overflow: hidden;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  padding: 0;
  cursor: zoom-in;
}

.product-mini img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.showcase-group-card {
  overflow: visible;
}

.showcase-shot-list {
  display: grid;
  gap: 8px;
}

.showcase-shot {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px;
}

.showcase-shot .product-mini img {
  aspect-ratio: 4 / 5;
}

.showcase-shot strong,
.showcase-shot span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.showcase-shot span {
  color: var(--muted);
  font-size: 12px;
}

.showcase-shot-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.showcase-shot-actions a,
.showcase-shot-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.asset-actions a,
.asset-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.product-edit-images {
  display: grid;
  gap: 9px;
}

.edit-images-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.edit-images-head strong {
  color: var(--ink);
}

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

.product-edit-image-row > button:first-child {
  overflow: hidden;
  min-height: 0;
  border: 0;
  border-radius: 7px;
  background: var(--surface-2);
  padding: 0;
  cursor: zoom-in;
}

.product-edit-image-row img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
}

.product-edit-image-row > div {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.product-edit-image-row strong {
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-edit-add {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.selected-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.selected-pair > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}

.selected-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.selected-card img {
  grid-row: span 3;
  width: 56px;
  height: 72px;
  border-radius: 7px;
  background: #fff;
  object-fit: cover;
}

.selected-card img:not([src]),
.selected-card img[src=""] {
  display: none;
}

.selected-pair span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.selected-pair strong {
  display: block;
  font-size: 14px;
  min-width: 0;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.selected-card .small-action {
  justify-self: start;
}

.selected-products-card {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.selected-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selected-card-head span {
  margin-bottom: 0;
}

.selected-products-card > strong {
  -webkit-line-clamp: 1;
}

.selected-product-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

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

.selected-product-item img {
  grid-row: auto;
  width: 44px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
}

.selected-product-item strong,
.selected-product-item span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-product-item strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.selected-product-item span {
  margin-top: 3px;
  margin-bottom: 0;
  font-size: 12px;
}

.hint {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
}

.busy-panel {
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}

.busy-panel h2 {
  margin-top: 14px;
}

.busy-panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 4px solid #d5ece8;
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  border-radius: 8px;
  background: #20232a;
  color: #fff;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 14px;
  z-index: 30;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 18, 28, 0.42);
  backdrop-filter: blur(8px);
}

.confirm-panel {
  display: grid;
  gap: 10px;
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.confirm-panel strong {
  font-size: 16px;
}

.confirm-panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.billing-panel {
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.billing-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.billing-head .step-kicker {
  display: block;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.billing-balance {
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background: #eef7f4;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 800;
  padding: 11px 12px;
}

.billing-package-list {
  display: grid;
  gap: 10px;
}

.billing-package {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
}

.billing-package span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.billing-package strong,
.billing-package small,
.billing-package b {
  display: block;
}

.billing-package strong {
  font-size: 15px;
}

.billing-package small {
  color: var(--muted);
  font-size: 13px;
}

.billing-package b {
  color: var(--accent);
  font-size: 16px;
  white-space: nowrap;
}

.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 18, 28, 0.78);
  backdrop-filter: blur(12px);
}

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1040px, 100%);
  height: min(92vh, 920px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #111827;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.preview-head span {
  display: block;
  margin-bottom: 3px;
  color: #9ca3af;
  font-size: 12px;
}

.preview-head h2 {
  max-width: min(720px, calc(100vw - 136px));
  color: #fff;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-head button {
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.preview-canvas {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.preview-canvas img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
}

.preview-actions {
  display: flex;
  justify-content: center;
  padding: 10px 14px 14px;
}

.preview-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  color: #fff;
  text-decoration: none;
  padding: 0 16px;
}

.metadata-overlay {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 18, 28, 0.62);
  backdrop-filter: blur(10px);
}

.metadata-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(720px, 100%);
  max-height: min(92vh, 820px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.metadata-head,
.metadata-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.metadata-head {
  border-bottom: 1px solid var(--line);
}

.metadata-head span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
}

.metadata-head h2 {
  max-width: min(520px, calc(100vw - 128px));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metadata-body {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
}

.metadata-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.metadata-actions button {
  min-width: 96px;
}

@media (max-width: 1100px) {
  .workflow-shell {
    grid-template-columns: 138px minmax(0, 1fr);
  }

  .product-layout,
  .model-layout,
  .scene-layout,
  .generate-layout {
    grid-template-columns: 1fr;
  }

  .product-tray-panel,
  .workflow-sidebar {
    position: static;
  }

  .product-library,
  .product-tray-panel,
  .model-library,
  .model-tray-panel {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--bg);
  }

  body[data-mobile-section="product"],
  body[data-mobile-section="model"],
  body[data-mobile-section="scene"] {
    overflow: auto;
  }

  .app {
    padding: 12px 12px 118px;
  }

  body[data-mobile-section="product"] .app,
  body[data-mobile-section="model"] .app,
  body[data-mobile-section="scene"] .app {
    min-height: 100vh;
    overflow: visible;
    padding-bottom: 118px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    align-items: center;
    gap: 8px;
    margin: -12px -12px 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }

  .topbar h1 {
    font-size: 19px;
  }

  .eyebrow {
    font-size: 10px;
    margin-bottom: 3px;
  }

  .top-actions {
    gap: 5px;
  }

  .top-actions .chip {
    max-width: 82px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
  }

  .top-actions button {
    min-height: 34px;
    padding: 0 9px;
    white-space: nowrap;
  }

  .mobile-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
  }

  .mobile-stepper {
    display: none;
  }

  .mobile-stepper button {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 5px;
    min-height: 48px;
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0 4px;
  }

  .mobile-stepper button + button::before {
    content: "";
    position: absolute;
    top: 13px;
    left: -50%;
    width: 100%;
    height: 1px;
    background: var(--line);
  }

  .mobile-stepper span {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-stepper small {
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  .mobile-stepper button.active {
    color: var(--primary);
  }

  .mobile-stepper button.active span {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
  }

  .mobile-tabs button {
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    padding: 0 6px;
  }

  .mobile-tabs button.active {
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
  }

  .mobile-section {
    display: none;
  }

  .mobile-section.active-mobile {
    display: block;
  }

  .composer,
  .workflow-shell,
  .inline-form,
  .provider-form,
  .generate-row,
  .edit-form {
    grid-template-columns: 1fr;
  }

  .workflow-sidebar {
    display: none;
  }

  .workflow-main {
    display: block;
  }

  .result-shortcut {
    min-height: 34px;
    padding: 0 9px;
    font-size: 13px;
  }

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

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

  .upload-queue-item {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .upload-queue-item small {
    grid-column: 2;
  }

  .upload-queue-item select,
  .upload-queue-item button {
    grid-column: 2;
  }

  .product-edit-image-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .product-edit-image-row img {
    width: 64px;
    height: 64px;
  }

  .product-edit-image-row > button:last-child {
    grid-column: 2;
  }

  .file-picker {
    min-height: 46px;
  }

  .section,
  .panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface);
    box-shadow: var(--soft-shadow);
  }

  .section {
    margin-bottom: 0;
  }

  .admin-settings {
    top: 70px;
    right: 10px;
    width: min(360px, calc(100vw - 20px));
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .admin-settings details {
    padding: 12px;
  }

  .admin-settings summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .admin-settings summary span {
    font-size: 16px;
  }

  .admin-settings:not([data-open="true"]) summary span {
    font-size: 14px;
  }

  .provider-card {
    grid-template-columns: 1fr;
  }

  .provider-card-actions,
  .provider-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .panel-head,
  .section-head {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 12px;
  }

  .panel-head h2,
  .section-head h2 {
    font-size: 19px;
  }

  .composer {
    display: block;
    margin-bottom: 0;
  }

  .workflow-shell {
    display: block;
    margin-bottom: 0;
  }

  .product-layout,
  .model-layout,
  .scene-layout,
  .generate-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .desktop-results-preview {
    display: none;
  }

  .product-tray-panel {
    position: sticky;
    top: 76px;
    order: -1;
  }

  .model-tray-panel {
    position: sticky;
    top: 76px;
    order: -1;
  }

  .scene-tray-panel {
    position: sticky;
    top: 76px;
    order: -1;
  }

  [data-mobile-section="product"].active-mobile {
    overflow: visible;
  }

  [data-mobile-section="model"].active-mobile {
    overflow: visible;
  }

  [data-mobile-section="scene"].active-mobile {
    overflow: visible;
  }

  [data-mobile-section="product"].active-mobile .panel-head,
  [data-mobile-section="model"].active-mobile .panel-head,
  [data-mobile-section="scene"].active-mobile .panel-head {
    margin-bottom: 8px;
  }

  .product-workspace,
  .model-workspace,
  .scene-workspace {
    min-height: 0;
  }

  .product-workspace:not(.uploading) {
    height: auto;
    min-height: 0;
  }

  .model-workspace:not(.creating) {
    height: auto;
    min-height: 0;
  }

  .scene-workspace:not(.creating) {
    height: auto;
    min-height: 0;
  }

  .product-browse-view,
  .product-layout,
  .product-library,
  .model-browse-view,
  .model-layout,
  .model-library,
  .scene-browse-view,
  .scene-layout,
  .scene-library {
    min-height: 0;
  }

  .product-browse-view,
  .product-library,
  .model-browse-view,
  .model-library,
  .scene-browse-view,
  .scene-library {
    display: grid;
  }

  .product-browse-view,
  .model-browse-view,
  .scene-browse-view {
    height: auto;
  }

  .product-layout,
  .model-layout,
  .scene-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    height: auto;
    overflow: visible;
  }

  .product-library,
  .product-tray-panel,
  .model-library,
  .model-tray-panel,
  .scene-library,
  .scene-tray-panel {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .product-tray-panel,
  .model-tray-panel,
  .scene-tray-panel {
    z-index: 12;
    display: grid;
    grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    border-color: rgba(180, 186, 196, 0.78);
    background: #fff;
    box-shadow: var(--soft-shadow);
    backdrop-filter: blur(12px);
    padding: 8px 10px;
  }

  .product-tray-panel > div:first-child,
  .model-tray-panel > div:first-child,
  .scene-tray-panel > div:first-child {
    display: grid;
    gap: 2px;
  }

  .product-tray-panel strong,
  .model-tray-panel strong,
  .scene-tray-panel strong {
    font-size: 14px;
    line-height: 1.1;
  }

  .product-tray-panel span,
  .model-tray-panel span,
  .scene-tray-panel span {
    font-size: 12px;
  }

  .product-tray-panel .thumb-strip,
  .model-tray-panel .thumb-strip,
  .scene-tray-panel .thumb-strip {
    min-height: 38px;
    justify-content: flex-end;
    padding-bottom: 0;
  }

  .product-tray-panel .empty-inline,
  .model-tray-panel .empty-inline,
  .scene-tray-panel .empty-inline {
    display: none;
  }

  .product-tray-panel .thumb-chip,
  .model-tray-panel .thumb-chip,
  .scene-tray-panel .thumb-chip {
    width: 36px;
  }

  .product-tray-panel .thumb-chip img,
  .model-tray-panel .thumb-chip img,
  .scene-tray-panel .thumb-chip img,
  .scene-tray-panel .thumb-chip.text-scene-chip > div {
    width: 36px;
    height: 38px;
    border-radius: 7px;
  }

  .product-tray-panel .thumb-chip span,
  .model-tray-panel .thumb-chip span,
  .scene-tray-panel .thumb-chip span {
    display: none;
  }

  .product-tray-panel .thumb-chip button,
  .model-tray-panel .thumb-chip button,
  .scene-tray-panel .thumb-chip button {
    top: -5px;
    right: -5px;
    width: 19px;
    min-width: 19px;
    height: 19px;
    min-height: 19px;
    font-size: 13px;
  }

  .product-tray-panel #product-next,
  .model-tray-panel #model-next {
    display: none;
  }

  .product-library,
  .model-library,
  .scene-library {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    height: 100%;
    overflow: hidden;
  }

  .product-toolbar {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 0;
    padding: 9px;
  }

  .product-add-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 41px;
    align-self: end;
    padding: 0 12px;
  }

  .model-toolbar {
    position: static;
    display: flex;
    justify-content: stretch;
    margin-bottom: 0;
    padding: 9px;
  }

  .scene-toolbar {
    position: static;
    display: flex;
    justify-content: stretch;
    margin-bottom: 0;
    padding: 9px;
  }

  .scene-toolbar button {
    width: 100%;
    min-height: 41px;
  }

  .model-toolbar button {
    width: 100%;
    min-height: 41px;
  }

  .floating-add-product {
    display: none;
  }

  .product-library-scroll,
  .model-library-scroll,
  .scene-library-scroll {
    height: auto;
    min-height: 0;
    overflow: visible;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .product-upload-view {
    margin-top: 12px;
    max-height: none;
    overflow: visible;
    padding: 12px;
  }

  .model-create-view {
    max-height: none;
    overflow: visible;
    margin-top: 0;
    padding: 12px;
  }

  .scene-create-view {
    max-height: none;
    overflow: visible;
    margin-top: 0;
    padding: 12px;
  }

  .model-create-view .generate-row {
    grid-template-columns: 1fr;
  }

  .upload-view-head {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    gap: 10px;
    margin-top: 12px;
  }

  #product-grid.compact {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 0;
  }

  #model-grid.compact {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 0;
  }

  #ambience-grid.compact {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 0;
    max-height: none;
  }

  #product-grid .product-group-card,
  #model-grid .asset-card,
  #ambience-grid .asset-card {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    min-height: 168px;
  }

  #product-grid .product-group-card > .asset-preview,
  #model-grid .asset-card > .asset-preview,
  #ambience-grid .asset-card > .asset-preview,
  #ambience-grid .asset-card > .text-scene-preview {
    height: 100%;
  }

  #product-grid .product-group-card > .asset-preview img,
  #model-grid .asset-card > .asset-preview img,
  #ambience-grid .asset-card > .asset-preview img {
    height: 100%;
    min-height: 168px;
    aspect-ratio: auto;
  }

  #ambience-grid .asset-card > .text-scene-preview {
    min-height: 168px;
    padding: 12px;
  }

  #product-grid .product-group-card .asset-body,
  #model-grid .asset-card .asset-body,
  #ambience-grid .asset-card .asset-body {
    align-content: start;
    min-width: 0;
    padding: 10px;
  }

  #product-grid .product-group-card .product-mini-grid {
    display: none;
  }

  #product-grid .product-group-card .asset-actions.product-actions {
    grid-template-columns: 1fr 1fr;
  }

  #model-grid .asset-card .asset-actions {
    grid-template-columns: 1fr;
  }

  #ambience-grid .asset-card .asset-actions {
    grid-template-columns: 1fr;
  }

  #product-grid .product-group-card [data-product-select] {
    grid-column: 1 / -1;
  }

  .showcase-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-bottom: 96px;
  }

  .showcase-grid .asset-preview img {
    aspect-ratio: 4 / 5;
  }

  .showcase-grid .asset-actions {
    grid-template-columns: 1fr 1fr;
  }

  .asset-body {
    padding: 8px;
  }

  .asset-actions {
    grid-template-columns: 1fr;
  }

  .asset-actions.product-actions {
    grid-template-columns: 1fr;
  }

  .asset-actions a,
  .asset-actions button {
    min-height: 34px;
  }

  .selected-pair {
    grid-template-columns: 1fr;
  }

  .selected-pair > div {
    background: var(--surface-3);
  }

  .selected-card {
    grid-template-columns: 68px 1fr auto;
    min-height: 88px;
  }

  .selected-card img {
    width: 68px;
    height: 88px;
  }

  .selected-products-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .selected-product-item img {
    width: 44px;
    height: 54px;
  }

  textarea {
    min-height: 132px;
  }

  .toast {
    top: 72px;
    bottom: auto;
  }

  .preview-overlay {
    padding: 0;
  }

  .preview-panel {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .preview-head {
    padding: 12px;
  }

  .preview-head h2 {
    max-width: calc(100vw - 108px);
    font-size: 15px;
  }

  .preview-canvas {
    padding: 10px;
  }

  .preview-actions {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}
