.has-stub-image-generate {
    position: relative;
}
.has-stub-image-generate > .label {
    box-sizing: border-box;
    max-width: calc(100% - 42px);
    overflow: hidden;
    text-overflow: ellipsis;
}
.has-stub-image-generate > .stub-image-generate {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.stub-image-generate:not(:disabled):hover {
    background: var(--inputBackground, #25252b);
}
.stub-image-generate:focus-visible {
    outline: 2px solid var(--activeLabelColor, #9297ff);
    outline-offset: 2px;
}
.stub-image-creator {
    --stub-image-border: var(--layoutBorderColor, #28282b);
    --stub-image-muted: var(--subColor, #9297a0);
    position: fixed;
    z-index: 2147482900;
    box-sizing: border-box;
    width: min(540px, calc(100vw - 16px));
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--stub-image-border);
    border-radius: 16px;
    background: var(--frameBackground, #111112);
    color: var(--foreColor, #eee);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
}
.stub-image-creator header,
.stub-image-creator footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.stub-image-creator header {
    margin: 0 2px 10px;
}
.stub-image-creator h2 {
    margin: 0;
    font-size: 1rem;
}
.stub-image-composer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--stub-image-border);
    border-radius: 18px;
    background: var(--inputBackground, #161617);
}
.stub-image-composer:focus-within {
    border-color: color-mix(in srgb, var(--stub-image-border) 70%, var(--stub-image-muted));
}
.stub-image-composer.is-dragover {
    border-color: var(--activeLabelColor, #9297ff);
}
.stub-image-creator textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 105px;
    padding: 1px 0;
    resize: vertical;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 1.02rem;
    line-height: 1.55;
    cursor: text;
    user-select: text;
}
.stub-image-creator textarea::placeholder {
    color: var(--stub-image-muted);
    font-style: italic;
}
.stub-image-creator .stub-image-references {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}
.stub-image-creator .stub-image-references li {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: min(225px, 100%);
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid var(--stub-image-border);
    border-radius: 12px;
}
.stub-image-creator .stub-image-references img {
    width: 42px;
    height: 42px;
    border-radius: 7px;
    object-fit: cover;
}
.stub-image-reference-details {
    min-width: 0;
}
.stub-image-reference-details > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stub-image-creator > p {
    margin: 10px 2px 0;
    color: var(--stub-image-muted);
}
.stub-image-creator .stub-image-creator-close,
.stub-image-creator .stub-image-add-reference,
.stub-image-creator .stub-image-remove-reference,
.stub-image-creator .stub-image-submit {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--stub-image-muted);
    background: transparent;
    font: inherit;
    cursor: pointer;
}
.stub-image-creator .stub-image-add-reference {
    width: 38px;
    height: 38px;
    margin-inline-end: auto;
    font-size: 1.3rem;
}
.stub-image-creator .stub-image-submit {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.1rem;
}
.stub-image-creator button:focus-visible {
    outline: 2px solid var(--activeLabelColor, #9297ff);
    outline-offset: 2px;
}
.stub-image-creator button:not(:disabled):hover {
    filter: brightness(1.2);
}
.stub-image-creator .stub-image-submit {
    background: var(--buttonBackground, #414bde);
    color: #fff;
}
.stub-image-creator button:disabled {
    opacity: .48;
    cursor: default;
}
.stub-image-creator [hidden] {
    display: none !important;
}

.stub-image-generate:disabled {
    opacity: .48;
    cursor: default;
}
.data-type-image .value.is-stub-image-generating > :is(.img, .remove, .edit, .trim) {
    display: none !important;
}
.stub-image-generating {
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: min(400px, 100%);
    min-height: clamp(150px, 34vw, 260px);
    padding: 16px;
    border-radius: 12px;
    background: var(--inputBackground, #161617);
    text-align: center;
}
.stub-image-generating > .thinking {
    inset: 0;
    width: 100%;
    height: 100%;
    --radius: 12px;
    --border-width: 2px;
}
.stub-image-generating > i {
    color: var(--activeLabelColor, #9297ff);
    font-size: 1.4rem;
}
.stub-image-generating time {
    color: var(--subColor, #9297a0);
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
}
.stub-image-error {
    margin: 4px 10px 8px;
    color: var(--errorColor, #ff8585);
}
@media (prefers-reduced-motion: reduce) {
    .stub-image-generating > i,
    .stub-image-generating > .thinking::before {
        animation: none;
    }
}
