.image-source, .image-form-block, .image-batch, .image-group-content {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}
.image-source { background: var(--teal-pale); border-color: #c9dfd7; }
.image-source p, .image-source small { margin-top: 4px; }
.image-form-block { margin-top: 13px; }
.image-form-block > h3 { margin-bottom: 10px; }
.scope-buttons, .image-card-actions, .photo-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.scope-buttons { margin-bottom: 10px; }
.slot-grid, .reference-grid, .image-card-grid {
  display: grid;
  gap: 9px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 213px), 1fr));
}
.image-choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.image-choice:has(input:checked) { border-color: #8cbeb0; background: #f0f8f5; }
.image-choice input[type="checkbox"] { width: 16px; height: 16px; min-height: 16px; padding: 0; margin: 3px 0 0; accent-color: var(--teal); flex: none; }
.image-choice span { min-width: 0; overflow-wrap: anywhere; }
.image-choice small { display: block; margin-top: 2px; }
.image-drop { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px dashed #9dbbb8; border-radius: 8px; background: #f2f9f7; padding: 12px; }
.image-drop.over { background: var(--teal-pale); }
.image-drop small { display: block; }
.image-drop:focus-within { outline: 2px solid var(--teal); }
.reference-grid { margin-top: 9px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 132px), 1fr)); }
.reference-card { min-width: 0; }
.reference-card img { display: block; width: 100%; height: 57px; object-fit: contain; }
.reference-card .quiet { min-height: 28px; font-size: .84rem; padding: 2px 5px; color: var(--muted); }

.image-gallery-heading, .image-batch header, .image-add { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.image-gallery-heading { margin-bottom: 12px; }
.image-gallery-heading h3, .image-batch h3 { font-size: 16px; }
.image-batch + .image-batch { margin-top: 10px; }
.image-batch header { margin-bottom: 10px; }
.competitor-prep { padding: 9px 11px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 7px; background: #f4f8f7; }
.competitor-prep h4 { margin: 0 0 4px; font-size: .95rem; }
.competitor-prep p { margin: 4px 0; }
.competitor-prep ul { margin: 5px 0; padding: 0; list-style: none; }
.competitor-sources { display: flex; flex-wrap: wrap; column-gap: 16px; row-gap: 3px; }
.competitor-sources a { color: var(--teal-dark); }
.competitor-prep .actions { margin-top: 8px; flex-wrap: wrap; }
.image-failures { padding-left: 18px; color: var(--warn); }
.image-notice { padding: 7px 9px; margin: 0 0 10px; background: #e9f2fd; border-radius: 6px; }
.image-card-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 178px), 1fr)); }
.generated-card { overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.generated-art { position: relative; background: #f4f7f7; }
.photo-open { display: block; width: 100%; padding: 0; border: 0; border-radius: 0; }
.photo-open img { display: block; width: 100%; aspect-ratio: 5 / 4; object-fit: contain; }
.image-order { position: absolute; top: 5px; left: 5px; padding: 2px 5px; background: var(--teal-pale); color: var(--teal-dark); border-radius: 4px; font-size: .82rem; pointer-events: none; }
.generated-meta { padding: 6px 9px; overflow-wrap: anywhere; }
.generated-meta small { display: block; }
.generated-meta .image-warning { color: var(--warn); }
.image-card-actions { padding: 0 7px 7px; }
.image-card-actions :is(button,a) { min-height: 30px; padding: 4px 6px; font-size: .84rem; }

.image-review-layout { display: grid; gap: 10px; grid-template-columns: 155px minmax(0,1fr); align-items: start; }
.image-group-nav { display: grid; min-width: 0; gap: 6px; }
.image-group-nav button { justify-content: space-between; padding-inline: 7px; white-space: normal; }
.image-group-nav button[aria-current] { border-color: #8cbeb0; background: var(--teal-pale); }
.image-group-content > p { margin-bottom: 8px; }
.image-add { margin-top: 9px; }
.image-add select { flex: 1 1 190px; width: auto; min-width: 0; }
.image-group-save { justify-content: flex-end; margin-top: 11px; }

.photo-viewer { width: min(1200px, calc(100vw - 20px)); }
.photo-tools { padding: 8px 13px; border-bottom: 1px solid var(--line); flex: none; }
.photo-view { min-height: min(280px, 43vh); max-height: min(690px, 68dvh); padding: 10px; background: #e7ecee; text-align: center; }
.photo-view img { max-width: 100%; max-height: min(665px, 64dvh); object-fit: contain; transform-origin: top center; }

@media (max-width: 680px) {
  .image-review-layout { grid-template-columns: minmax(0,1fr); }
  .image-group-nav { display: flex; flex-wrap: wrap; align-items: center; }
  .image-group-nav strong { width: 100%; }
  .image-gallery-heading .actions, .image-drop { flex-wrap: wrap; }
  .image-card-actions :is(button,a), .reference-card .quiet { min-height: 44px; }
  .image-card-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 132px), 1fr)); }
}

.copy-image-settings { margin-bottom: 12px; }
.copy-image-settings details { margin-top: 8px; }
.copy-image-settings summary { cursor: pointer; font-weight: 650; }
.image-approval-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.image-approval-options .image-choice { background: var(--paper); }
