/* Explicitly marked legacy modals share the simulator palette without changing
   form ownership, Turbo frames, wizard grids or scrolling containers. */
.modal-content:has(.fundup-modal-header) {
    --fundup-modal-accent: #61CB89;
    --fundup-modal-tint: #edf7f4;
    --fundup-modal-border: var(--bs-border-color, #e1e7ed);
    background: var(--bs-tertiary-bg, #f5f7fa);
    color: var(--bs-body-color);
    border-radius: 18px;
}
.fundup-modal-header {
    flex-shrink: 0;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem !important;
    background: var(--bs-body-bg, #fff);
    border-bottom: 1px solid var(--fundup-modal-border, #e1e7ed) !important;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
}
.fundup-modal-header > :is(h2, h3, h4, h5, h6, div) { min-width: 0; flex: 1 1 auto; }
.fundup-modal-header :is(.modal-title, h2, h3, h4, h5) { font-size: 1.3rem; font-weight: 700; line-height: 1.35; margin-bottom: 0; }
.fundup-modal-header .btn-close { flex-shrink: 0; margin-left: auto; }
.fundup-modal-icon {
    display: grid;
    place-items: center;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--fundup-modal-tint, #edf7f4);
    color: var(--fundup-modal-accent, #61CB89);
    font-size: 1.65rem;
}
.fundup-modal-body {
    min-width: 0;
    margin: 1.25rem;
    padding: 1.5rem !important;
    border: 1px solid var(--fundup-modal-border, #e1e7ed);
    border-radius: 14px;
    background: var(--bs-body-bg, #fff);
}
.fundup-modal-footer {
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: .75rem;
    padding: 1rem 1.5rem !important;
    background: var(--bs-body-bg, #fff);
    border-top: 1px solid var(--fundup-modal-border, #e1e7ed) !important;
    box-shadow: 0 -6px 20px rgba(20, 45, 40, .05);
}
.fundup-modal-footer .btn { border-radius: 10px; padding: .7rem 1.15rem; font-weight: 600; }
.modal-content:has(.fundup-modal-header) :is(.form-control, .form-select) { border-radius: 9px; min-height: 42px; }
.modal-content:has(.fundup-modal-header) .input-group > :is(.form-control, .form-select):not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.modal-content:has(.fundup-modal-header) .input-group > :is(.form-control, .form-select):not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.modal-content:has(.fundup-modal-header) :is(.partner-wizard, .partner-wizard-main, .wizard-main, .task-modal-content) { background: var(--bs-tertiary-bg, #f5f7fa); }
.modal-content:has(.fundup-modal-header) :is(.partner-wizard-sidebar, .wizard-sidebar) { background: var(--bs-tertiary-bg, #f5f7fa); border-color: var(--fundup-modal-border); }
.modal-content:has(.fundup-modal-header) :is(.partner-wizard-project-card, .partner-wizard-selected-card, .partner-wizard-progress-card) { background: var(--bs-body-bg, #fff); border: 1px solid var(--fundup-modal-border); border-radius: 14px; padding: 1.25rem; }
.modal-content:has(.fundup-modal-header) .partner-wizard-step { background: var(--bs-body-bg, #fff); border: 1px solid var(--fundup-modal-border); border-radius: 14px; margin: 1.25rem; }
.modal-content:has(.fundup-modal-header) .partner-wizard-step-header { margin: 0 0 1.25rem; padding: 0 0 1.25rem; }
.modal-content:has(.fundup-modal-header) .partner-wizard-step-header h3 { font-size: 1.2rem; }
.modal-content:has(.fundup-modal-header) .partner-wizard-step-icon { background: var(--fundup-modal-tint); color: var(--fundup-modal-accent); border-radius: 12px; }
@media (max-width: 767.98px) {
    .fundup-modal-header { padding: 1rem !important; gap: .75rem; }
    .fundup-modal-header :is(.modal-title, h2, h3, h4, h5) { font-size: 1.1rem; }
    .fundup-modal-icon { flex-basis: 44px; width: 44px; height: 44px; border-radius: 12px; }
    .fundup-modal-body { margin: .75rem; padding: 1rem !important; }
    .fundup-modal-footer { padding: .75rem 1rem !important; }
    .modal-content:has(.fundup-modal-header) .partner-wizard-step { margin: .75rem; padding: 1rem; }
}

/* Wizard contents and footers are also rendered through step partials. */
.modal-content:has(.fundup-modal-header) :is(.project-wizard, .project-wizard-main, .proposal-wizard, .proposal-wizard-main) { background: var(--bs-tertiary-bg, #f5f7fa); }
.modal-content:has(.fundup-modal-header) :is(.project-wizard-sidebar, .proposal-wizard-sidebar) { background: var(--bs-tertiary-bg, #f5f7fa); border-color: var(--fundup-modal-border); }
.modal-content:has(.fundup-modal-header) :is(.project-wizard-card, .proposal-side-card, .proposal-wizard-content) { background: var(--bs-body-bg, #fff); border: 1px solid var(--fundup-modal-border); border-radius: 14px; }
.modal-content:has(.fundup-modal-header) .proposal-wizard-content { margin: 1.25rem; padding: 1.5rem; }
.modal-content:has(.fundup-modal-header) :is(.partner-wizard-footer, .project-wizard-footer, .proposal-wizard-footer) {
    background: var(--bs-body-bg, #fff);
    border-top: 1px solid var(--fundup-modal-border);
    box-shadow: 0 -6px 20px rgba(20, 45, 40, .05);
    flex-wrap: wrap;
    gap: .75rem;
}
.modal-content:has(.fundup-modal-header) :is(.partner-wizard-footer, .project-wizard-footer, .proposal-wizard-footer) .btn { border-radius: 10px; padding: .7rem 1.15rem; font-weight: 600; }
.modal-content:has(.fundup-modal-header) .sollicitation-wizard-modal > form > .modal-body { margin: 1.25rem; padding: 1.5rem; background: var(--bs-body-bg, #fff); border: 1px solid var(--fundup-modal-border); border-radius: 14px; }
.modal-content:has(.fundup-modal-header) .sollicitation-wizard-modal .modal-footer { background: var(--bs-body-bg, #fff); border-top: 1px solid var(--fundup-modal-border); padding: 1rem 1.5rem; }
.modal-content:has(.fundup-modal-header) .d-lg-grid > :not(aside) > .p-4,
.modal-content:has(.fundup-modal-header) .d-lg-grid > form > fieldset > .p-4 { background: var(--bs-body-bg, #fff); border: 1px solid var(--fundup-modal-border); border-radius: 14px; margin: 1.25rem; }
.modal-content:has(.fundup-modal-header) .onboarding-header { height: auto; }
.modal-content:has(.fundup-modal-header) .onboarding-brand-icon { background: var(--fundup-modal-tint); color: var(--fundup-modal-accent); border-radius: 16px; }
#gallery-lightbox .fundup-modal-body { overflow: auto; }
#gallery-lightbox [data-gallery-target="lightboxImage"] { max-height: 70vh; object-fit: contain; }
@media (max-width: 767.98px) {
    .modal-content:has(.fundup-modal-header) .proposal-wizard-content { margin: .75rem; padding: 1rem; }
}
