:root {
  --bg: #f7f2ef;
  --surface: #fffaf7;
  --surface-strong: #ffffff;
  --ink: #201a18;
  --muted: #766b66;
  --line: #e7dcd6;
  --accent: #a33c54;
  --accent-2: #c99755;
  --shadow: 0 18px 44px rgba(38, 26, 20, 0.12);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(520px, 1fr) minmax(340px, 380px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 100vh;
  padding: 14px;
}

.sidebar,
.preview-panel,
.library-panel,
.prompt-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar {
  grid-row: 1 / 3;
  padding: 16px;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.brand p,
.eyebrow {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.brand p {
  max-width: 150px;
  line-height: 1.45;
}

.category-nav {
  display: grid;
  gap: 14px;
}

.category-group {
  display: grid;
  gap: 7px;
}

.category-group h2 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.category-group > div {
  display: grid;
  gap: 6px;
}

.category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  color: var(--ink);
}

.category-button small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.category-button.active {
  border-color: rgba(163, 60, 84, 0.28);
  background: rgba(163, 60, 84, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.category-button.active small {
  color: var(--accent);
}

.preview-panel {
  padding: 18px;
  overflow: auto;
}

.workbench-panel {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(120px, 1fr) auto auto;
  gap: 12px;
}

.panel-header h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

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

.workbench-stats div {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 9px 10px;
}

.workbench-stats strong {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.workbench-stats span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.mannequin-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0%, #f4ece6 100%);
  border: 1px solid var(--line);
  overflow: hidden;
}

.mannequin {
  width: min(70%, 230px);
  height: auto;
  opacity: 0.82;
}

.selection-badges {
  position: absolute;
  inset: 16px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  pointer-events: none;
}

.badge,
.selected-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 247, 0.9);
  padding: 6px 10px;
  font-size: 12px;
}

.selected-list {
  display: grid;
  gap: 8px;
  margin-top: 0;
  max-height: none;
  overflow: auto;
}

.selected-group {
  display: grid;
  gap: 7px;
}

.selected-group + .selected-group {
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.selected-group-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.selected-group-title strong {
  font-size: 12px;
}

.selected-group-title span {
  color: var(--muted);
  font-size: 11px;
}

.selected-chip-rich {
  display: grid;
  gap: 8px;
  max-width: 100%;
  border-radius: 8px;
  padding: 8px 10px;
}

.selected-chip-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.selected-chip-title img,
.selected-chip img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.selected-chip-title small {
  grid-column: 2 / 3;
  color: var(--accent);
  font-size: 11px;
}

.selected-list-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.selected-list-header strong {
  font-size: 13px;
}

.selected-list-header span {
  color: var(--muted);
  font-size: 12px;
}

.selected-list-empty {
  display: grid;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  padding: 14px;
}

.selected-list-empty strong {
  font-size: 13px;
}

.selected-list-empty span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.remove-selected {
  grid-column: 3;
  grid-row: 1;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(32, 26, 24, 0.1);
  color: var(--muted);
  line-height: 1;
  padding: 0;
}

.remove-selected:hover {
  background: var(--accent);
  color: #fff;
}

.variant-controls {
  display: grid;
  gap: 7px;
}

.variant-group {
  display: grid;
  gap: 5px;
}

.variant-group > span {
  color: var(--muted);
  font-size: 11px;
}

.variant-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.variant-options button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
}

.variant-options button.active {
  border-color: rgba(163, 60, 84, 0.38);
  background: rgba(163, 60, 84, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.library-panel {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 14px;
  overflow: hidden;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar input {
  flex: 1 1 240px;
  min-width: min(100%, 220px);
}

.toolbar input,
.toolbar select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 10px 12px;
}

.toolbar select {
  min-width: 116px;
  color: var(--ink);
}

.toolbar button,
.prompt-actions button,
.prompt-drawer-header button,
.card-actions button,
.look-tools button,
.manager-actions button,
.candidate-actions button {
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 12px;
}

.toolbar button.active {
  background: var(--accent);
}

.toolbar .manage-toggle.subtle {
  border: 1px solid rgba(98, 83, 77, 0.18);
  background: rgba(98, 83, 77, 0.06);
  color: var(--muted);
  font-size: 12px;
}

.toolbar .manage-toggle.subtle.active,
.toolbar .manage-toggle.hidden-review.active {
  border-color: rgba(163, 60, 84, 0.26);
  background: rgba(163, 60, 84, 0.1);
  color: var(--accent);
}

.toolbar .manage-toggle.hidden-review {
  border: 1px solid rgba(98, 83, 77, 0.18);
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  font-size: 12px;
}

.hidden-count {
  align-self: center;
  min-width: 58px;
  color: var(--muted);
  font-size: 12px;
}

.image-import-panel,
.element-manager {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 12px;
  max-height: 420px;
  overflow: auto;
}

.image-import-panel[hidden],
.element-manager[hidden] {
  display: none;
}

.import-grid,
.manager-grid,
.candidate-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.import-grid label,
.manager-grid label,
.candidate-edit-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.import-grid input,
.import-grid select,
.import-grid textarea,
.manager-grid input,
.manager-grid select,
.manager-grid textarea,
.candidate-edit-grid input,
.candidate-edit-grid select,
.candidate-edit-grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 9px 10px;
  color: var(--ink);
}

.import-grid textarea,
.manager-grid textarea,
.candidate-edit-grid textarea {
  resize: vertical;
}

.import-grid .wide,
.manager-grid .wide,
.candidate-edit-grid .wide {
  grid-column: 1 / -1;
}

.manager-actions,
.candidate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

#managerStatus,
#importStatus,
#copyStatus {
  color: var(--accent);
  font-size: 13px;
  line-height: 1.45;
}

.image-preview {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 247, 0.72);
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.image-preview img {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.import-candidates {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 360px;
  overflow: auto;
}

.import-candidate {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
}

.candidate-head,
.muted-candidate,
.saved-candidate {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.candidate-status,
.custom-mark {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: rgba(32, 26, 24, 0.08);
  color: var(--ink);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
}

.candidate-status.new,
.custom-mark {
  background: rgba(163, 60, 84, 0.1);
  color: var(--accent);
}

.custom-mark.warning {
  background: rgba(201, 151, 85, 0.18);
  color: #8a5c18;
}

.element-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding-right: 2px;
}

.card {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  overflow: hidden;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.card:hover {
  border-color: rgba(163, 60, 84, 0.32);
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(38, 26, 20, 0.1);
}

.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(163, 60, 84, 0.16);
}

.thumb {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 130px;
  place-items: center;
  padding: 14px;
  background: linear-gradient(135deg, #f5e4e8, #f7efe3);
  color: var(--accent);
  font-weight: 700;
  text-align: center;
}

.thumb-button {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #f2ece8;
  color: var(--accent);
  cursor: zoom-in;
  font: inherit;
}

.thumb-button:hover img {
  transform: scale(1.025);
}

.thumb.has-image {
  min-height: 230px;
  grid-template-rows: 190px auto;
  padding: 8px;
  background: #f2ece8;
}

.thumb.has-image img {
  width: 100%;
  height: 190px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
  transition: transform 160ms ease;
}

.thumb strong {
  font-size: 13px;
}

.card-body {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  padding: 12px;
}

.card h3 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 6px;
  font-size: 15px;
}

.card p {
  display: -webkit-box;
  min-height: 34px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.tag {
  border-radius: 999px;
  background: #f4ece6;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 11px;
}

.card-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  color: #51695d;
  font-size: 11px;
}

.variant-hint {
  color: #51695d;
  font-size: 12px;
  margin-top: 8px;
}

.card-actions {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 8px;
  margin-top: 12px;
}

.card-quick-actions {
  grid-template-columns: minmax(72px, 1fr) repeat(2, 56px);
  align-items: center;
  margin-top: 10px;
}

.library-panel.manage-mode .card-quick-actions {
  grid-template-columns: minmax(72px, 1fr) repeat(4, 56px);
}

.danger-action,
.mark-action {
  display: none;
}

.library-panel.manage-mode .mark-action,
.library-panel.manage-mode .danger-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(138, 92, 24, 0.22);
  background: rgba(201, 151, 85, 0.12);
  color: #7a571d;
}

.library-panel.manage-mode .mark-action.active {
  border-color: rgba(163, 60, 84, 0.22);
  background: rgba(163, 60, 84, 0.1);
  color: var(--accent);
}

.library-panel.manage-mode .restore-action {
  border-color: rgba(163, 60, 84, 0.2);
  background: rgba(163, 60, 84, 0.08);
  color: var(--accent);
}

.card-quick-actions button {
  min-height: 38px;
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 700;
}

.card-actions .primary-action {
  background: var(--accent);
}

.card-actions button:not(.primary-action) {
  border: 1px solid rgba(98, 83, 77, 0.22);
  background: rgba(98, 83, 77, 0.08);
  color: #62534d;
}

.prompt-panel {
  grid-column: 2 / 4;
  grid-row: 2;
  display: grid;
  grid-template-rows: auto auto;
  padding: 14px;
}

.prompt-drawer-header {
  display: grid;
  grid-template-columns: auto auto auto minmax(90px, 1fr);
  gap: 10px;
  align-items: center;
}

.prompt-drawer-header #copyStatus {
  justify-self: start;
}

.prompt-tabs {
  display: flex;
  gap: 8px;
}

.prompt-tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 8px 12px;
}

.prompt-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.workbench-panel .look-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 0;
}

.look-tools input,
.look-tools select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 9px 10px;
  color: var(--ink);
}

.look-tools button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.generated-archive-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

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

.archive-head > div:first-child {
  display: grid;
  gap: 3px;
}

.archive-head strong {
  font-size: 13px;
}

.archive-head span {
  color: var(--muted);
  font-size: 11px;
}

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

.archive-actions button,
.archive-form button {
  border: 0;
  border-radius: 8px;
  background: #62534d;
  color: #fff;
  padding: 8px 10px;
  font-size: 12px;
}

.archive-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.archive-form input,
.archive-form select,
.archive-form textarea,
.archive-search {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 9px 10px;
  color: var(--ink);
}

.archive-upload-label {
  display: grid;
  gap: 3px;
  border: 1px dashed rgba(163, 60, 84, 0.36);
  border-radius: 8px;
  background: rgba(163, 60, 84, 0.07);
  color: var(--accent);
  padding: 10px 12px;
  cursor: pointer;
}

.archive-upload-label span {
  font-size: 13px;
  font-weight: 800;
}

.archive-upload-label small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.archive-search {
  width: 100%;
}

.archive-form textarea,
.archive-image-preview,
.archive-upload-label,
#saveGeneratedBtn {
  grid-column: 1 / -1;
}

.archive-image-preview {
  display: grid;
  height: 180px;
  align-items: center;
  justify-items: center;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-align: center;
}

.archive-image-preview strong {
  color: var(--ink);
  font-size: 13px;
}

.archive-image-preview span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-image-preview img {
  max-width: 100%;
  max-height: 138px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.generated-archive-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.generated-archive-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 8px;
}

.generated-archive-card img {
  width: 58px;
  height: 74px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.generated-archive-card div {
  min-width: 0;
}

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

.generated-archive-card strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generated-archive-card span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.generated-archive-card small {
  margin-top: 4px;
  color: var(--accent);
  font-size: 10px;
}

.archive-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.archive-card-actions button {
  border: 1px solid rgba(163, 60, 84, 0.22);
  border-radius: 8px;
  background: rgba(163, 60, 84, 0.08);
  color: var(--accent);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
}

.prompt-drawer-body {
  display: grid;
  margin-top: 10px;
}

.prompt-panel-collapsed #promptDrawerBody {
  display: none;
}

#promptOutput {
  width: 100%;
  min-height: 94px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
  line-height: 1.55;
}

.prompt-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  max-height: 164px;
  overflow: auto;
  margin-top: 10px;
}

.prompt-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 10px;
}

.prompt-section strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.prompt-section p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.prompt-section button {
  border: 1px solid rgba(163, 60, 84, 0.2);
  border-radius: 8px;
  background: rgba(163, 60, 84, 0.1);
  color: var(--accent);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
}

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

.visual-stack {
  position: absolute;
  inset: 18px 26px 18px 26px;
  pointer-events: none;
}

.preview-layer {
  position: absolute;
  display: grid;
  place-items: center;
  width: 86px;
  min-height: 54px;
  border: 1px solid rgba(32, 26, 24, 0.24);
  border-radius: 8px;
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(32, 26, 24, 0.12);
}

.preview-layer span {
  font-weight: 800;
  font-size: 20px;
}

.preview-layer small {
  max-width: 76px;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-background { inset: 16px 14px auto auto; width: 118px; min-height: 72px; }
.preview-lighting { inset: 96px 14px auto auto; }
.preview-person { left: 50%; top: 26px; transform: translateX(-50%); }
.preview-hair { left: 50%; top: 72px; transform: translateX(-50%); }
.preview-makeup { left: calc(50% + 76px); top: 88px; }
.preview-top { left: 50%; top: 168px; transform: translateX(-50%); width: 106px; }
.preview-dress { left: 50%; top: 158px; transform: translateX(-50%); width: 118px; min-height: 122px; }
.preview-outerwear { left: calc(50% - 138px); top: 160px; width: 98px; min-height: 100px; }
.preview-bottom { left: 50%; top: 244px; transform: translateX(-50%); width: 100px; }
.preview-hosiery { left: 50%; top: 318px; transform: translateX(-50%); width: 92px; min-height: 84px; }
.preview-shoes { left: 50%; bottom: 8px; transform: translateX(-50%); width: 118px; }
.preview-accessory { left: calc(50% + 108px); top: 188px; }
.preview-pose { left: 14px; bottom: 90px; }
.preview-style { left: 14px; top: 16px; }
.preview-output { left: 14px; top: 96px; }

.item-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 2px solid rgba(32, 26, 24, 0.32);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font-size: 22px;
}

.item-art span {
  position: relative;
  z-index: 2;
  font-weight: 800;
}

.item-hair { border-radius: 50% 50% 42% 42%; border-width: 5px 5px 2px; }
.item-makeup { border-radius: 50%; }
.item-top { width: 86px; height: 58px; border-radius: 18px 18px 10px 10px; }
.item-bottom { width: 78px; height: 64px; clip-path: polygon(22% 0, 78% 0, 96% 100%, 4% 100%); }
.item-dress { height: 86px; clip-path: polygon(32% 0, 68% 0, 94% 100%, 6% 100%); }
.item-outerwear { width: 88px; height: 82px; border-radius: 18px 18px 6px 6px; border-style: double; }
.item-hosiery { width: 62px; height: 88px; border-radius: 24px 24px 12px 12px; }
.item-shoes { width: 86px; height: 38px; border-radius: 999px 999px 16px 16px; }
.item-accessory { border-radius: 50%; border-style: dotted; }
.item-background,
.item-lighting,
.item-style,
.item-output,
.item-pose,
.item-portrait {
  border-radius: 18px;
}

.tone-rose { background: linear-gradient(135deg, #f8dce2, #fff6f3); }
.tone-red { background: linear-gradient(135deg, #b73447, #f3b1b8); color: #581521; }
.tone-ink,
.tone-black { background: linear-gradient(135deg, #24201f, #857a75); color: #fff; }
.tone-cream { background: linear-gradient(135deg, #fff7ea, #ead8bf); }
.tone-camel { background: linear-gradient(135deg, #d6a96f, #f3e0c1); }
.tone-champagne { background: linear-gradient(135deg, #f6dfae, #fff8df); }
.tone-gold { background: linear-gradient(135deg, #d1a23b, #fff0b8); }
.tone-sky { background: linear-gradient(135deg, #dcecff, #f8fbff); }
.tone-violet { background: linear-gradient(135deg, #d8d0ff, #f4edff); }
.tone-mauve { background: linear-gradient(135deg, #d9b5c1, #f8eef2); }
.tone-brown { background: linear-gradient(135deg, #7a4e39, #d1a789); color: #fff; }
.tone-peach { background: linear-gradient(135deg, #ffd8c7, #fff3eb); }
.tone-navy { background: linear-gradient(135deg, #1c3154, #9caecb); color: #fff; }
.tone-sage { background: linear-gradient(135deg, #cfdfcf, #f5fbf2); }
.tone-light { background: linear-gradient(135deg, #ffffff, #edf0f4); }

.empty-state,
.fatal-error {
  color: var(--muted);
  padding: 16px;
}

.fatal-error {
  white-space: pre-wrap;
  color: #9c263f;
}

.image-lightbox {
  width: min(92vw, 980px);
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
}

.image-lightbox::backdrop {
  background: rgba(20, 16, 14, 0.72);
}

.lightbox-inner {
  position: relative;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 14px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.38);
}

.lightbox-inner img {
  width: 100%;
  max-height: 76vh;
  border-radius: 6px;
  object-fit: contain;
  background: #f5f0ec;
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(32, 26, 24, 0.88);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.lightbox-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
}

.lightbox-caption strong {
  font-size: 18px;
}

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

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }

  .sidebar,
  .prompt-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .element-grid {
    max-height: none;
  }

  .import-grid,
  .candidate-edit-grid,
  .manager-grid,
  .look-tools,
  .prompt-drawer-header {
    grid-template-columns: 1fr;
  }

  .workbench-panel {
    grid-template-rows: auto auto auto auto;
  }

  .thumb.has-image {
    grid-template-rows: 190px auto;
  }

  .thumb.has-image img {
    height: 190px;
  }
}
