.template-editor-shell {
    display: grid;
    gap: 1rem;
}

.template-editor-mode-note {
    margin-top: 0.5rem;
}

.template-editor-panel {
    display: none;
}

.template-editor-panel.is-active {
    display: block;
}

.template-builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 1rem;
}

.template-builder-workbench,
.template-builder-preview-card {
    border: 1px solid #d0d7de;
    border-radius: 0.75rem;
    background: #ffffff;
}

.template-builder-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.template-builder-canvas {
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
}

.template-builder-empty {
    padding: 1.5rem;
    border: 1px dashed #cbd5e1;
    border-radius: 0.75rem;
    background: #f8fafc;
    color: #475569;
}

.template-builder-block {
    border: 1px solid #dbe4ee;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
}

.template-builder-block-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border-bottom: 1px solid #dbe4ee;
}

.template-builder-block-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.template-builder-block-body {
    padding: 1rem;
    display: grid;
    gap: 0.85rem;
}

.template-builder-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.template-builder-link-settings {
    border-top: 1px solid #e5e7eb;
    padding-top: 0.85rem;
    display: grid;
    gap: 0.75rem;
}

.template-builder-link-settings-title {
    font-weight: 600;
    color: #1e3a5f;
}

.template-builder-checkbox-wrap {
    display: flex;
    align-items: end;
}

.template-builder-columns-editor {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.template-builder-column-editor,
.template-builder-nested-block {
    border: 1px solid #dbe4ee;
    border-radius: 0.75rem;
    background: #f8fafc;
}

.template-builder-column-editor-header,
.template-builder-nested-block-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dbe4ee;
    background: #eef6ff;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

.template-builder-column-toolbar,
.template-builder-column-canvas,
.template-builder-nested-block-body {
    padding: 0.85rem;
}

.template-builder-column-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    border-bottom: 1px solid #dbe4ee;
}

.template-builder-column-canvas,
.template-builder-nested-block-body {
    display: grid;
    gap: 0.75rem;
}

.template-builder-nested-empty {
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 0.75rem;
    color: #475569;
    background: #fff;
}

.template-builder-preview-card {
    padding: 1rem;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.template-builder-preview-stage {
    background: #dbe4ee;
    border-radius: 1rem;
    padding: 1rem;
}

.template-builder-preview {
    max-width: 680px;
    margin: 0 auto;
    padding: 1.25rem;
    border: 1px solid #d0d7de;
    border-radius: 1rem;
    background: #ffffff;
    min-height: 240px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.template-builder-help {
    color: #475569;
    font-size: 0.9rem;
}

@media (max-width: 991.98px) {
    .template-builder-layout {
        grid-template-columns: 1fr;
    }

    .template-builder-columns-editor {
        grid-template-columns: 1fr;
    }
}
