<div class="modal fade project-modal schema-modal" id="projectSchemaModal" tabindex="-1" aria-hidden="true"><div class="modal-dialog modal-xl modal-dialog-centered modal-dialog-scrollable"><div class="modal-content">
<div class="modal-header px-4 py-3"><div><div class="schema-kicker"><i class="bi bi-database-check"></i> Preview-first synchronization</div><h5 class="modal-title mb-0"><span id="schemaProjectName"></span> schema &amp; structure</h5></div><button class="btn-close btn-close-white" type="button" data-bs-dismiss="modal" aria-label="Close schema and structure"></button></div>
<div class="modal-body p-0"><div class="schema-summary" id="schemaSummary"><div><span>Database only</span><strong data-schema-count="database_only">—</strong></div><div><span>Project only</span><strong data-schema-count="project_only">—</strong></div><div><span>Field drift</span><strong data-schema-count="changed">—</strong></div><div><span>Needs refresh</span><strong data-schema-count="needs_refresh">—</strong></div><span class="schema-engine" id="schemaEngine"></span></div>
<div class="schema-body"><section class="schema-column"><div class="schema-section-head"><div><span class="schema-eyebrow">Database → Project</span><h6>Available to import</h6></div><button class="btn btn-sm btn-primary" id="schemaImport" type="button"><i class="bi bi-box-arrow-in-down me-1"></i>Import selected</button></div><p>Bring selected live tables or views into the project model. Database objects are not changed.</p><div class="schema-object-list" id="schemaDatabaseOnly"></div></section>
<section class="schema-column"><div class="schema-section-head"><div><span class="schema-eyebrow">Project → Database</span><h6>Missing from database</h6></div><button class="btn btn-sm btn-outline-primary" id="schemaCreateMissing" type="button"><i class="bi bi-plus-square me-1"></i>Create selected</button></div><p>Only tables with portable blueprints can be created. Existing database objects are never altered.</p><div class="schema-object-list" id="schemaProjectOnly"></div></section>
<section class="schema-column wide"><div class="schema-section-head"><div><span class="schema-eyebrow">Conflict preview</span><h6>Tracked structure drift</h6></div><button class="btn btn-sm btn-dark" id="schemaRebuild" type="button"><i class="bi bi-arrow-repeat me-1"></i>Rebuild project structures</button></div><div class="schema-rebuild-options"><label class="form-check"><input class="form-check-input" id="schemaRemoveMissing" type="checkbox"><span class="form-check-label">Remove project-only objects and their layout relationships</span></label><span>Unchecked keeps missing objects available for later database creation.</span></div><div class="schema-conflicts" id="schemaConflicts"></div></section></div></div>
<div class="modal-footer px-4 py-3"><span class="schema-footer-note me-auto"><i class="bi bi-shield-check"></i> Every apply action creates a safety checkpoint first.</span><button class="btn btn-light border" type="button" data-bs-dismiss="modal">Close</button><button class="btn btn-outline-secondary" id="schemaRefresh" type="button"><i class="bi bi-arrow-clockwise me-1"></i>Refresh preview</button></div>
</div></div></div>
