.composer-model {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #777a80;
  font-size: 9px;
  white-space: nowrap;
}

.composer-model::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2d7f56;
  content: "";
}

.image-edit-reference {
  order: -2;
  display: flex;
  width: min(100%, 360px);
  min-height: 48px;
  align-items: center;
  gap: 9px;
  margin: 6px 7px 1px;
  padding: 6px;
  border: 1px solid #d8d9dc;
  border-radius: 12px;
  background: #f8f8f9;
}

.image-edit-reference img {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 9px;
  object-fit: cover;
}

.image-edit-reference span {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.image-edit-reference strong { color: #383a3f; font-size: 10px; font-weight: 650; }
.image-edit-reference small { overflow: hidden; color: #84868c; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.image-edit-reference button,
.ai-image-actions button,
.ai-image-actions a,
.ai-image-failure button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #d5d6d9;
  border-radius: 8px;
  background: #fff;
  color: #4e5055;
  font: inherit;
  font-size: 9px;
  text-decoration: none;
  cursor: pointer;
}

.image-edit-reference button:hover,
.ai-image-actions button:hover,
.ai-image-actions a:hover,
.ai-image-failure button:hover { border-color: #aeb0b5; color: #202124; }

.image-results {
  display: grid;
  width: min(720px, 100%);
  gap: 14px;
  margin-top: 14px;
}

.ai-image-card {
  display: grid;
  grid-template-columns: minmax(180px, 300px) minmax(190px, 1fr);
  overflow: hidden;
  border: 1px solid #dedfe2;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(21, 22, 25, .06);
}

.ai-image-preview {
  display: grid;
  min-height: 210px;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-right: 1px solid #e4e4e6;
  background:
    linear-gradient(45deg, #f1f1f2 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, #f1f1f2 25%, transparent 25%) 0 8px / 16px 16px,
    linear-gradient(45deg, transparent 75%, #f1f1f2 75%) 8px -8px / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #f1f1f2 75%) -8px 0 / 16px 16px,
    #fafafa;
  cursor: zoom-in;
}

.ai-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: contain;
}

.ai-image-card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 18px;
}

.ai-image-card-body > strong { color: #2f3034; font-size: 13px; font-weight: 680; }
.ai-image-card-body > p { margin: 0; color: #7b7e84; font-size: 9px; line-height: 1.6; }
.ai-image-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.ai-image-actions button,
.ai-image-actions a { display: inline-flex; align-items: center; justify-content: center; }
.ai-image-card.is-error .ai-image-preview { cursor: default; opacity: .42; }

.ai-image-failure {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid #e2c1c1;
  border-radius: 13px;
  background: #fffafa;
}

.ai-image-failure > span {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border-radius: 50%;
  background: #8f4c4c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.ai-image-failure > div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ai-image-failure strong { color: #4b3030; font-size: 11px; }
.ai-image-failure p { margin: 0; color: #785b5b; font-size: 9px; line-height: 1.6; }
.ai-image-failure button[disabled] { cursor: wait; opacity: .62; }

.image-lightbox {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 34px;
}

.image-lightbox-scrim { position: absolute; inset: 0; border: 0; background: rgba(15, 16, 18, .78); cursor: zoom-out; }
.image-lightbox-dialog {
  position: relative;
  display: grid;
  width: min(1120px, 100%);
  max-height: calc(100vh - 68px);
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 18px;
  background: #17181b;
  box-shadow: 0 24px 90px rgba(0, 0, 0, .45);
}

.image-lightbox-dialog img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  max-height: calc(100vh - 132px);
  object-fit: contain;
}

.image-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  color: #f4f4f5;
  font-size: 10px;
}

.image-lightbox-bar div { display: flex; gap: 7px; }
.image-lightbox-bar button,
.image-lightbox-bar a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 9px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

@media (max-width: 760px) {
  .composer-model { display: none; }
  .ai-image-card { grid-template-columns: 1fr; }
  .ai-image-preview { min-height: 240px; border-right: 0; border-bottom: 1px solid #e4e4e6; }
  .image-lightbox { align-items: end; padding: 0; }
  .image-lightbox-dialog { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .image-lightbox-dialog img { min-height: 260px; max-height: calc(92vh - 58px); }
  .image-lightbox-bar > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-image-card { scroll-behavior: auto; }
}
