/* ============================================================
   PRODUTOSHOW - Estilos dos Modais de Prompt / Referencias / Resultado
   Tema claro (laranja + branco) alinhado a styles.css:
     --ps-primary: #ff6b35 / --ps-primary-dark: #e85520
     --ps-surface: #ffffff / --ps-bg: #f7f7f9
     --ps-text: #1f2937 / --ps-muted: #6b7280 / --ps-border: #e5e7eb
   Origem: app_phj/app/tori-ia/modulo/design (paleta escura, re-tematizada)
   ============================================================ */

:root,
.modal-prompt-overlay,
.modal-resultado-overlay {
    --pm-primary: #ff6b35;
    --pm-primary-dark: #e85520;
    --pm-primary-soft: #fff5f0;
    --pm-primary-border: #ffd9cc;
    --pm-surface: #ffffff;
    --pm-bg: #f7f7f9;
    --pm-text: #1f2937;
    --pm-muted: #6b7280;
    --pm-placeholder: #9ca3af;
    --pm-border: #e5e7eb;
    --pm-border-soft: #f0f0f2;
    --pm-danger: #ef4444;
    --pm-success: #22c55e;
}

/* SweetAlert2 deve ficar acima de todos os modais */
.swal2-container {
    z-index: 20050 !important;
}

/* ============================================
   MODAL DE PROMPT & REFERÊNCIAS
   ============================================ */
.modal-prompt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 41, 55, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10050;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px 30px 16px;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-prompt-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-prompt-card {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: 24px;
    width: 100%;
    max-width: 820px;
    box-shadow: 0 25px 60px rgba(31, 41, 55, 0.35);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px 24px;
    margin: 10px auto 25px auto;
    transform: scale(0.96);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--pm-text);
}

.modal-prompt-overlay.active .modal-prompt-card {
    transform: scale(1);
}

.modal-prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--pm-border);
    padding-bottom: 12px;
}

.modal-prompt-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--pm-text);
}

.modal-prompt-title i {
    color: var(--pm-primary);
    font-size: 26px;
}

.modal-prompt-close {
    background: transparent;
    border: none;
    color: var(--pm-placeholder);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.modal-prompt-close:hover {
    color: var(--pm-primary-dark);
}

/* === ABAS DO MODAL DE PROMPT (STEPPER) === */
.prompt-tabs-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2px solid var(--pm-border-soft, #f0f0f2);
    padding-bottom: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.prompt-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border: none;
    background: transparent;
    color: var(--pm-muted, #6b7280);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.prompt-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #4b5563;
    font-size: 0.72rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.prompt-tab-btn:hover {
    color: var(--pm-text, #1f2937);
    background: var(--pm-bg, #f7f7f9);
}

.prompt-tab-btn.active {
    color: var(--pm-primary, #ff6b35);
    background: var(--pm-primary-soft, #fff5f0);
    font-weight: 600;
}

.prompt-tab-btn.active .prompt-step-num {
    background: var(--pm-primary, #ff6b35);
    color: #ffffff;
}

.prompt-tab-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.prompt-tab-pane:not(.active) {
    display: none !important;
}

.prompt-step-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--pm-border-soft, #f0f0f2);
}

.prompt-step-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--pm-border-soft, #e5e7eb);
    background: #ffffff;
    color: var(--pm-text, #374151);
    cursor: pointer;
    transition: all 0.15s ease;
}

.prompt-step-nav-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.prompt-step-nav-btn-next {
    background: var(--pm-primary, #ff6b35);
    border-color: var(--pm-primary, #ff6b35);
    color: #ffffff;
    margin-left: auto;
}

.prompt-step-nav-btn-next:hover {
    background: var(--pm-primary-dark, #e05520);
    border-color: var(--pm-primary-dark, #e05520);
    color: #ffffff;
}

/* === RESUMO VISUAL DA COMPOSIÇÃO (PASSO 4) === */
.prompt-summary-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prompt-summary-title {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.prompt-summary-hint {
    font-size: 0.72rem;
    color: #94a3b8;
}

.prompt-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

@media (max-width: 768px) {
    .prompt-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .prompt-summary-grid {
        grid-template-columns: 1fr;
    }
}

.prompt-summary-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.prompt-summary-card:hover {
    border-color: var(--pm-primary, #ff6b35);
    background: #fffcfb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.prompt-summary-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 16px;
    flex-shrink: 0;
}

.prompt-summary-card.has-items .prompt-summary-card-icon {
    background: var(--pm-primary-soft, #fff5f0);
    color: var(--pm-primary, #ff6b35);
}

.prompt-summary-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.prompt-summary-card-label {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
    line-height: 1.1;
}

.prompt-summary-card-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.prompt-summary-card-thumbs {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.prompt-summary-thumb {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
}

.prompt-summary-thumb-more {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Container Retangular de Referências */
.prompt-refs-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Seção de Comando Selecionado (mutuamente exclusiva com referências) */
.prompt-comando-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0.25rem;
}

.prompt-comando-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prompt-comando-label {
    font-size: 0.85rem;
    color: var(--pm-muted, #6c757d);
    font-weight: 600;
    margin: 0;
}

.prompt-comando-remove-btn {
    background: transparent;
    border: none;
    color: #dc3545;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.prompt-comando-remove-btn:hover {
    background: rgba(220, 53, 69, 0.1);
}

.prompt-comando-remove-btn .material-icons {
    font-size: 0.95rem;
}

.prompt-comando-card-display {
    background: #fffaf7;
    border: 1.5px solid rgba(255, 107, 53, 0.35);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.06);
}

.prompt-comando-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: #f8f9fa;
    border: 1px solid var(--pm-border, #e9ecef);
    flex-shrink: 0;
}

.prompt-comando-info {
    flex-grow: 1;
    min-width: 0;
}

.prompt-comando-info-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.prompt-comando-info-nome {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--pm-text, #212529);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prompt-comando-info-badge {
    display: none !important;
}

.prompt-comando-info-desc {
    font-size: 0.8rem;
    color: var(--pm-muted, #6c757d);
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prompt-refs-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--pm-muted);
    font-weight: 500;
}

.prompt-refs-counter {
    font-size: 0.8rem;
    color: var(--pm-placeholder);
}

.prompt-refs-container {
    background: var(--pm-bg);
    border: 1px dashed var(--pm-border);
    border-radius: 16px;
    min-height: 100px;
    max-height: 150px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

.prompt-refs-container::-webkit-scrollbar {
    height: 6px;
}

.prompt-refs-container::-webkit-scrollbar-thumb {
    background: var(--pm-border);
    border-radius: 3px;
}

.prompt-refs-empty {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--pm-placeholder);
    font-size: 0.85rem;
    gap: 6px;
    padding: 12px;
    text-align: center;
    white-space: normal;
    line-height: 1.4;
}

.prompt-refs-empty span {
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
}

.prompt-refs-empty i {
    font-size: 28px;
    color: var(--pm-primary-border);
}

.prompt-ref-card {
    position: relative;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--pm-border);
    background: var(--pm-surface);
}

.prompt-ref-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prompt-ref-card .prompt-ref-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(31, 41, 55, 0.75);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.prompt-ref-card .prompt-ref-remove:hover {
    background: var(--pm-danger);
}

.prompt-ref-card .prompt-ref-tag {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    font-size: 9px;
    background: rgba(31, 41, 55, 0.7);
    color: #f3f4f6;
    padding: 1px 4px;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* Seção do Produto Associado */
.prompt-product-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.prompt-product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.prompt-product-label-wrap {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.prompt-product-label {
    font-size: 0.85rem;
    color: var(--pm-text);
    font-weight: 600;
    margin: 0;
}

.prompt-product-hint {
    font-size: 0.75rem;
    color: var(--pm-muted);
    font-weight: 400;
}

.prompt-product-field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--pm-bg);
    border: 1px solid var(--pm-border);
    border-radius: 12px;
    padding: 2px 10px 2px 14px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.prompt-product-field-wrapper:focus-within {
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.18);
    background: var(--pm-surface);
}

.prompt-product-input {
    flex: 1;
    width: 100%;
    min-width: 0;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: var(--pm-text) !important;
    font-size: 0.95rem;
    padding: 8px 4px;
    font-family: inherit;
    box-sizing: border-box;
}

.prompt-product-input::placeholder {
    color: var(--pm-placeholder);
}

.prompt-product-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    color: var(--pm-muted);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: 8px;
    flex-shrink: 0;
}

.prompt-product-clear-btn:hover {
    background: var(--pm-primary-soft);
    color: var(--pm-primary-dark);
    border-color: var(--pm-primary-border);
}

.prompt-product-clear-btn i {
    font-size: 14px;
    line-height: 1;
}

.prompt-product-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--pm-primary);
    border: none;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.prompt-product-add-btn:hover {
    background: var(--pm-primary-dark);
    transform: scale(1.08);
}

.prompt-product-add-btn:active {
    transform: scale(0.95);
}

.prompt-product-card {
    border-color: var(--pm-primary-border);
}

.prompt-product-no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pm-primary-soft);
    color: var(--pm-primary);
}

.prompt-product-no-img i {
    font-size: 32px;
}

.prompt-product-dropdown-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 107, 53, 0.12);
    border: 1px solid rgba(255, 107, 53, 0.35);
    color: var(--pm-primary-dark);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 8px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.prompt-product-dropdown-add-btn:hover {
    background: var(--pm-primary);
    color: #ffffff;
    border-color: var(--pm-primary);
    transform: scale(1.1);
}

/* Dropdown Customizado de Sugestões de Produtos */
.prompt-product-dropdown {
    position: relative;
    width: 100%;
    margin-top: 6px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(31, 41, 55, 0.14);
    max-height: 230px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.prompt-product-dropdown::-webkit-scrollbar {
    width: 6px;
}

.prompt-product-dropdown::-webkit-scrollbar-thumb {
    background: var(--pm-border);
    border-radius: 3px;
}

.prompt-product-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--pm-border-soft);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    color: var(--pm-text);
    font-size: 0.9rem;
    gap: 12px;
}

.prompt-product-dropdown-item:last-child {
    border-bottom: none;
}

.prompt-product-dropdown-item.sem-imagem {
    opacity: 0.85;
}

.prompt-product-dropdown-item.sem-imagem:hover {
    background: #fff5f5;
    border-left-color: var(--pm-danger);
}

.prompt-product-item-no-img-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--pm-danger);
    background: #fee2e2;
    padding: 2px 7px;
    border-radius: 6px;
    flex-shrink: 0;
    font-weight: 500;
}

.prompt-product-item-no-img-badge i {
    font-size: 13px;
    line-height: 1;
}

.prompt-product-dropdown-item:hover,
.prompt-product-dropdown-item.active {
    background: var(--pm-primary-soft);
    color: var(--pm-text);
    border-left: 3px solid var(--pm-primary);
    padding-left: 11px;
}

.prompt-product-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.prompt-product-item-code {
    font-size: 0.75rem;
    color: var(--pm-primary-dark);
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.3);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

.prompt-product-item-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.prompt-product-item-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.prompt-prod-attr-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.prod-attr-tam {
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.prod-attr-cor {
    background: #fdf2f8;
    color: #be185d;
    border: 1px solid #fbcfe8;
}

.prompt-product-dropdown-item.item-variacao {
    border-left: 2px solid transparent;
}

.prompt-product-dropdown-empty {
    padding: 12px 14px;
    color: var(--pm-muted);
    font-size: 0.85rem;
    text-align: center;
    font-style: italic;
}

/* Seção de Formato da Imagem */
.prompt-format-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.prompt-format-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.prompt-format-label {
    font-size: 0.85rem;
    color: var(--pm-text);
    font-weight: 600;
    margin: 0;
}

.prompt-format-hint {
    font-size: 0.75rem;
    color: var(--pm-muted);
    font-weight: 400;
}

.prompt-format-field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--pm-bg);
    border: 1px solid var(--pm-border);
    border-radius: 12px;
    padding: 2px 10px 2px 14px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.prompt-format-field-wrapper:focus-within {
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.18);
    background: var(--pm-surface);
}

.prompt-format-select {
    flex: 1;
    width: 100%;
    min-width: 0;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: var(--pm-text) !important;
    font-size: 0.95rem;
    padding: 8px 4px;
    font-family: inherit;
    box-sizing: border-box;
    cursor: pointer;
}

.prompt-format-select option {
    background: var(--pm-surface);
    color: var(--pm-text);
    padding: 8px;
}

/* Área de Input do Prompt */
.prompt-input-wrapper {
    background: var(--pm-bg);
    border: 1px solid var(--pm-border);
    border-radius: 20px;
    padding: 14px 16px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(31, 41, 55, 0.08);
    transition: border-color 0.2s;
}

.prompt-input-wrapper:focus-within {
    border-color: var(--pm-primary-border);
}

.prompt-input-field {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--pm-text);
    font-size: 0.95rem;
    resize: none;
    line-height: 1.5;
    font-family: inherit;
    min-height: 40px;
    max-height: 140px;
}

.prompt-input-field::placeholder {
    color: var(--pm-placeholder);
}

.prompt-input-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.prompt-actions-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prompt-round-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    color: var(--pm-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.prompt-round-btn:hover {
    background: var(--pm-primary-soft);
    color: var(--pm-primary-dark);
    border-color: var(--pm-primary-border);
}

.prompt-round-btn i {
    font-size: 20px;
}

.prompt-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prompt-submit-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pm-border);
    border: 1px solid var(--pm-border);
    color: var(--pm-placeholder);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.prompt-submit-btn.ready {
    background: var(--pm-primary);
    color: #ffffff;
    border-color: var(--pm-primary);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

.prompt-submit-btn:hover {
    transform: scale(1.05);
    background: var(--pm-primary-soft);
    color: var(--pm-primary-dark);
    border-color: var(--pm-primary-border);
}

.prompt-submit-btn.ready:hover {
    background: var(--pm-primary-dark);
    border-color: var(--pm-primary-dark);
    color: #ffffff;
}

.prompt-submit-btn i {
    font-size: 20px;
}

/* ============================================
   MODAL DE RESULTADO DA IMAGEM (SEGUNDO MODAL)
   ============================================ */
.modal-resultado-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 41, 55, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px 30px 16px;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-resultado-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-resultado-card {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: 24px;
    width: 100%;
    max-width: 680px;
    box-shadow: 0 30px 70px rgba(31, 41, 55, 0.4);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 24px;
    margin: 15px auto 30px auto;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--pm-text);
}

.modal-resultado-overlay.active .modal-resultado-card {
    transform: scale(1);
}

.modal-resultado-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--pm-border);
    padding-bottom: 12px;
}

.modal-resultado-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--pm-text);
}

.modal-resultado-title i {
    color: var(--pm-primary);
    font-size: 26px;
}

.modal-resultado-preview-container {
    width: 100%;
    min-height: 380px;
    max-height: 520px;
    background: var(--pm-bg);
    border: 1px dashed var(--pm-border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.modal-resultado-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--pm-muted);
    gap: 12px;
    padding: 30px;
    text-align: center;
}

.modal-resultado-placeholder i {
    font-size: 54px;
    color: var(--pm-primary-border);
}

.modal-resultado-placeholder span {
    font-size: 0.95rem;
    max-width: 320px;
    line-height: 1.4;
}

.modal-resultado-spinner {
    width: 50px;
    height: 50px;
    border: 3.5px solid rgba(255, 107, 53, 0.2);
    border-top: 3.5px solid var(--pm-primary);
    border-radius: 50%;
    animation: spinModalResultado 0.9s linear infinite;
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.35);
    margin-bottom: 8px;
}

@keyframes spinModalResultado {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal-resultado-placeholder .modal-resultado-subtext {
    font-size: 0.84rem;
    color: var(--pm-muted);
    max-width: 340px;
    line-height: 1.4;
    margin-top: 4px;
}

.modal-resultado-img {
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    border-radius: 14px;
}

.btn-resultado-action:disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.modal-resultado-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid var(--pm-border-soft);
    flex-wrap: nowrap;
}

.btn-resultado-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
    white-space: nowrap;
}

.btn-resultado-action i {
    font-size: 18px;
    flex-shrink: 0;
}

.rotating {
    animation: spinIcon 1s linear infinite;
    display: inline-block;
}

@keyframes spinIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsividade Mobile: 3 botões na mesma linha + prompt modal */
@media (max-width: 576px) {
    .modal-resultado-card {
        padding: 18px 12px;
        border-radius: 18px;
        gap: 14px;
    }

    .modal-resultado-actions {
        justify-content: space-between;
        gap: 6px;
        flex-wrap: nowrap;
        width: 100%;
    }

    .btn-resultado-action {
        flex: 1 1 0;
        min-width: 0;
        padding: 9px 4px;
        font-size: 0.82rem;
        gap: 4px;
    }

    .btn-resultado-action i {
        font-size: 16px;
    }

    .modal-prompt-overlay {
        padding: 14px 8px 24px 8px;
    }

    /* Prompt Modal Mobile */
    .modal-prompt-card {
        padding: 16px 14px;
        border-radius: 18px;
        gap: 12px;
    }

    .prompt-product-field-wrapper,
    .prompt-format-field-wrapper,
    .prompt-input-wrapper {
        padding: 10px 12px;
    }

    .prompt-product-input,
    .prompt-format-select,
    .prompt-input-field {
        font-size: 1rem; /* prevent zoom on iOS */
    }

    .prompt-product-input::placeholder {
        font-size: 0.88rem;
    }

    .prompt-actions-right {
        gap: 8px;
    }

    .prompt-round-btn,
    .prompt-submit-btn {
        width: 32px;
        height: 32px;
    }

    .prompt-round-btn i,
    .prompt-submit-btn i {
        font-size: 18px;
    }
}

.btn-resultado-salvar {
    background: var(--pm-success);
    color: #ffffff;
}
.btn-resultado-salvar:hover {
    background: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.btn-resultado-descartar {
    background: var(--pm-danger);
    color: #ffffff;
}
.btn-resultado-descartar:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-resultado-editar {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    color: var(--pm-muted);
}
.btn-resultado-editar:hover {
    background: var(--pm-primary-soft);
    border-color: var(--pm-primary);
    color: var(--pm-primary-dark);
    transform: translateY(-1px);
}
.btn-resultado-editar.active {
    background: var(--pm-primary);
    border-color: var(--pm-primary);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.4);
}

/* Estado desabilitado do wrapper de ajuste */
.prompt-input-wrapper.prompt-input-disabled {
    background: var(--pm-bg) !important;
    border: 1px dashed var(--pm-border) !important;
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.prompt-input-wrapper.prompt-input-disabled textarea {
    cursor: not-allowed;
    color: var(--pm-placeholder) !important;
    pointer-events: none;
}
.prompt-input-wrapper.prompt-input-disabled .prompt-submit-btn {
    background: var(--pm-border) !important;
    color: var(--pm-placeholder) !important;
    border-color: var(--pm-border) !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* Estado habilitado do wrapper de ajuste */
.prompt-input-wrapper.prompt-input-enabled {
    background: var(--pm-surface) !important;
    border: 1px solid var(--pm-primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2), 0 8px 25px rgba(31, 41, 55, 0.12) !important;
    opacity: 1 !important;
    cursor: auto;
    animation: pulseHighlight 0.4s ease;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.prompt-input-wrapper.prompt-input-enabled textarea {
    color: var(--pm-text) !important;
    cursor: text;
    pointer-events: auto;
}
.prompt-input-wrapper.prompt-input-enabled textarea::placeholder {
    color: var(--pm-placeholder) !important;
}
.prompt-input-wrapper.prompt-input-enabled .prompt-submit-btn.ready {
    background: var(--pm-primary) !important;
    color: #ffffff !important;
    border-color: var(--pm-primary) !important;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4) !important;
}
.prompt-input-wrapper.prompt-input-enabled .prompt-submit-btn.ready:hover {
    background: var(--pm-primary-dark) !important;
    transform: scale(1.08) !important;
}

@keyframes pulseHighlight {
    0% {
        transform: scale(0.98);
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.5);
    }
    50% {
        transform: scale(1.01);
        box-shadow: 0 0 0 6px rgba(255, 107, 53, 0.22);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
    }
}
