body {
  overflow: hidden;
}

* {
  min-width: 0;
}

.nav-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.nav-copy small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.nav-item.active .nav-copy small {
  color: rgba(255,255,255,0.6);
}

.status-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 4px;
}

.systems-group {
  display: none;
}

.provider-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--steel);
}

.provider-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--muted);
  flex-shrink: 0;
}

.provider-status.ok::before { background: var(--teal-deep); }
.provider-status.off::before { background: #ff6b5f; }
.provider-status b { color: var(--ink); font-weight: 700; }
.provider-status small { margin-left: auto; color: var(--stone); font-size: 10px; }

.inline-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-width: 2px;
  margin-right: 8px;
  vertical-align: -2px;
}

.error-state {
  background: #fff0ec;
  color: #9e3025;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  align-items: center;
}

.upload-field {
  cursor: pointer;
}

.upload-field > input {
  display: none;
}

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

.field-note {
  color: var(--stone);
  font-size: 11px;
  font-weight: 700;
}

.live-divider {
  margin-top: 34px;
}

.image-grid[data-ratio="1:1"] { --tile-ar: 1/1; }
.image-grid[data-ratio="9:16"] { --tile-ar: 9/16; }
.image-grid[data-ratio="4:5"] { --tile-ar: 4/5; }

.poster-layout {
  align-items: start;
}

.poster-config {
  margin: 12px 0;
}

.poster-ref-box {
  margin-top: 12px;
}

.poster-output-card {
  margin-top: 18px;
}

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

.poster-result {
  cursor: default;
}

.insight-layout {
  align-items: start;
}

.insight-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.insight-section {
  border-top: 1px solid var(--hairline-soft);
  padding-top: 12px;
  margin-top: 12px;
}

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

.insight-card,
.insight-row,
.copy-block {
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 12px;
}

.insight-card b,
.insight-row b,
.copy-block b {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 6px;
}

.insight-card p,
.insight-row p,
.copy-block p {
  color: var(--steel);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
}

.insight-card small,
.insight-row small {
  display: block;
  color: var(--stone);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.4;
  margin-top: 8px;
  text-transform: uppercase;
}

.insight-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.insight-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
}

.insight-row > span {
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.insight-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.copy-block ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--steel);
  font-size: 12px;
  line-height: 1.5;
}

.check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.check-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 10px;
  color: var(--steel);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.img-cell.selected {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.img-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-select {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  border-radius: var(--r-full);
  padding: 4px 8px;
  background: rgba(28,28,30,0.82);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.img-cell.selected .img-select {
  background: var(--yellow);
  color: var(--ink);
}

.img-cell.has-warning {
  outline: 2px solid #ff8a6b;
  outline-offset: 1px;
}

.qa-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  border-radius: var(--r-full);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.qa-badge.pass {
  background: rgba(25, 112, 88, 0.88);
  color: #fff;
}

.qa-badge.warn {
  background: #ffeadf;
  color: #9e3025;
}

.warn {
  margin-top: 8px;
  border-radius: var(--r-md);
  background: #fff0ec;
  color: #9e3025;
  padding: 8px 10px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
}

.sample-warn {
  max-height: 84px;
  overflow: auto;
}

.video-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline-soft);
}

.video-controls .config-group {
  justify-content: space-between;
  gap: 12px;
}

.video-controls .config-opts {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.video-controls .prompt-group {
  display: block;
}

.video-controls .prompt-group .config-l {
  display: block;
  margin-bottom: 8px;
}

#videoPrompt {
  width: 100%;
  min-height: 126px;
  resize: vertical;
  line-height: 1.45;
}

select {
  min-height: 32px;
  max-width: 220px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
}

.selected-preview {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--hairline-soft);
  background: var(--surface-2);
  margin-bottom: 12px;
  max-width: 420px;
}

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

.selected-preview[data-ratio="9:16"] img { aspect-ratio: 9/16; max-height: 360px; }
.selected-preview[data-ratio="4:5"] img { aspect-ratio: 4/5; }

.selected-meta p {
  margin-top: 8px;
  color: var(--steel);
  font-size: 12px;
  line-height: 1.55;
  max-height: 140px;
  overflow: auto;
}

.video-player {
  width: min(100%, 440px);
  border-radius: var(--r-xl);
  background: #000;
  box-shadow: var(--shadow-3);
}

.video-player[data-ratio="1:1"] { aspect-ratio: 1/1; }
.video-player[data-ratio="9:16"] { aspect-ratio: 9/16; max-width: 300px; }
.video-player[data-ratio="4:5"] { aspect-ratio: 4/5; max-width: 360px; }

.mock-result {
  width: 100%;
  border-radius: var(--r-xl);
  background: var(--surface-2);
  padding: 18px;
}

.mock-result p,
.mock-result details {
  margin-top: 8px;
  color: var(--steel);
  font-size: 12px;
  line-height: 1.55;
}

.session-assets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.session-assets .meta-cell {
  min-width: 0;
}

.session-assets .meta-v {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vto-layout {
  margin-top: 18px;
}

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

.tryon-step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-md);
  background: var(--surface);
}

.tryon-step b {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--yellow);
  color: var(--ink);
  font-size: 12px;
}

.tryon-step span {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.vto-upload {
  margin-top: 12px;
  cursor: pointer;
}

.vto-hand-preview {
  min-height: 180px;
  margin-top: 12px;
  border: 1px dashed var(--hairline);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
}

.vto-hand-preview img {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  background: #111;
}

.vto-hand-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: var(--r-full);
  padding: 4px 9px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.vto-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline-soft);
}

.vto-controls .config-group {
  justify-content: space-between;
}

.vto-controls .config-opts {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.vto-color {
  width: 56px;
  min-width: 56px;
  height: 32px;
  padding: 3px;
}

.vto-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--steel);
  font-weight: 600;
}

.vto-check input {
  width: auto;
}

.advanced-panel {
  margin-top: 14px;
  border-top: 1px solid var(--hairline-soft);
  padding-top: 12px;
}

.advanced-panel summary {
  cursor: pointer;
  color: var(--steel);
  font-size: 12px;
  font-weight: 800;
}

.advanced-panel[open] summary {
  color: var(--ink);
}

.camera-kit-mount {
  margin-top: 12px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
}

.native-camera {
  margin-top: 10px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}

.native-camera video {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  background: #111;
}

.lucy-output-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  margin-top: 12px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg);
  background: #111;
  overflow: hidden;
}

.lucy-output-wrap video {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: contain;
}

.lucy-output-wrap .empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(0,0,0,0.35);
}

.lucy-output-wrap.has-video .empty-state {
  display: none;
}

.native-camera-actions {
  display: flex;
  gap: 8px;
  padding: 8px;
}

.native-camera-actions .btn {
  flex: 1;
}

.product-strip {
  margin-top: 12px;
}

.collect-meta {
  font-size: 10.5px;
  color: var(--stone);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.creative-step-panel {
  display: none;
}

.creative-step-panel.active {
  display: block;
}

.hidden {
  display: none !important;
}

.stepper .step {
  border: 0;
  appearance: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.nav-item[type="button"] {
  width: 100%;
  border: 0;
  appearance: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.step1-grid,
.card,
.analysis {
  min-width: 0;
}

.analysis.tight {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

.an-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline-soft);
}

.an-row:last-child {
  border-bottom: 0;
}

.an-key {
  color: var(--stone);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.an-value {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.an-value.color-value {
  display: inline-block;
  justify-self: start;
  border-radius: var(--r-full);
  background: var(--yellow);
  padding: 3px 8px;
  line-height: 1.2;
}

.ref-locks {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--hairline-soft);
}

.ref-lock-grid {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  max-width: 100%;
}

.ref-lock-grid img {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--hairline-soft);
}

.reference-picker {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 10px;
}

.ref-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.ref-picker-sub {
  color: var(--stone);
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}

.creative-ref-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 330px;
  overflow: auto;
  padding-right: 2px;
}

.creative-ref {
  position: relative;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-2);
  aspect-ratio: 1/1;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
}

.creative-ref.selected {
  border-color: var(--yellow);
}

.creative-ref img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ref-kind,
.ref-check {
  position: absolute;
  z-index: 2;
  background: rgba(28,28,30,0.82);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
}

.ref-kind {
  left: 6px;
  bottom: 6px;
  border-radius: var(--r-full);
  padding: 3px 6px;
  text-transform: uppercase;
}

.ref-check {
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
}

.product-tile {
  position: relative;
  aspect-ratio: 1/1;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}

.product-tile.selected {
  border-color: var(--yellow);
}

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

.product-tile span {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border-radius: var(--r-full);
  padding: 3px 6px;
  background: rgba(28,28,30,0.72);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-tile::after {
  content: attr(title);
  position: absolute;
  inset: auto 6px 28px 6px;
  border-radius: var(--r-md);
  padding: 4px 6px;
  background: rgba(255,255,255,0.86);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  transition: opacity 120ms;
  pointer-events: none;
  word-break: break-all;
}

.product-tile:hover::after {
  opacity: 1;
}

.vto-state {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

#vtoStatusBox details {
  margin-top: 14px;
  color: var(--steel);
  font-size: 12px;
}

#vtoStatusBox pre {
  max-height: 280px;
  overflow: auto;
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.vto-result {
  display: grid;
  place-items: center;
  min-height: 320px;
}

.vto-output {
  max-width: 100%;
  max-height: 560px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.library-card {
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
}

.library-media {
  aspect-ratio: 1/1;
  background: var(--surface-2);
  overflow: hidden;
}

.library-media img,
.library-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
}

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

.library-meta small,
.library-type {
  color: var(--stone);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.btn.danger {
  color: #9e3025;
  border-color: rgba(158, 48, 37, 0.28);
  background: rgba(158, 48, 37, 0.06);
}

.btn.danger:hover {
  background: rgba(158, 48, 37, 0.12);
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 36px));
}

.toast {
  border-radius: var(--r-md);
  padding: 10px 12px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  box-shadow: var(--shadow-3);
}

.toast.warn {
  background: #8a5d12;
}

.toast.error {
  background: #9e3025;
}

@media (max-width: 1100px) {
  .header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .session-assets {
    grid-template-columns: 1fr;
  }

  .product-grid,
  .tryon-steps,
  .vto-state,
  .library-grid,
  .insight-summary,
  .insight-grid,
  .check-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .insight-summary,
  .insight-grid,
  .check-list {
    grid-template-columns: 1fr;
  }
}
