/* oMATIC Minds v0.6.8.68 Image Studio mobile reference pills/button separation.
   Mobile-only fix: keep reference status pills above the Add reference button,
   then keep thumbnails below. Prevents overlap in narrow/mobile view. */

@media (max-width: 640px) {
  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage.om-image-reference-stage-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 10px !important;
    overflow: visible !important;
  }

  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage .om-image-reference-stage-head {
    order: 1 !important;
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage .om-image-reference-stage-head > div:first-child {
    order: 1 !important;
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage .om-image-reference-session-review {
    position: static !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage .om-image-reference-session-review span,
  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage .status-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 23px !important;
    min-height: 23px !important;
    max-height: 23px !important;
    margin: 0 !important;
    padding: 0 7px !important;
    border-radius: 999px !important;
    font-size: .64rem !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
  }

  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage .om-image-reference-stage-actions {
    order: 2 !important;
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage .om-image-reference-stage-actions button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    font-size: .78rem !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
  }

  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage .om-image-reference-grid {
    order: 2 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 74px !important;
    min-height: 74px !important;
    max-height: 74px !important;
    margin: 0 !important;
    padding: 8px 4px 4px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    box-sizing: border-box !important;
  }

  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage .eyebrow,
  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage h2,
  body.om-image-studio-route .om-image-studio-composer-shell.has-image-references #image-reference-stage p:not(.om-image-reference-session-review *) {
    display: none !important;
  }
}
