.template-gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 295px), 1fr)); gap: 18px; }
.template-card { display: grid; align-content: start; overflow: hidden; border: 1px solid #d9dfd8; border-radius: 12px; background: #fff; }
.template-card[hidden] { display: none; }
.template-card iframe { display: block; box-sizing: border-box; width: 100%; height: 425px; border: 0; border-bottom: 1px solid #e1e8e0; }
.template-card-meta { padding: 14px 16px 16px; }
.template-card-meta h3 { margin: 0; font: 700 17px/1.35 Arial,sans-serif; }
.template-card-meta p { margin: 4px 0 10px; color: #526159; font-size: 13px; }
.template-gallery-filter { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; flex-wrap: wrap; }
.template-gallery-filter select { width: auto; color: #182522; padding: 7px 12px; border: 1px solid #becabf; border-radius: 6px; background: #fff; font: inherit; }
#studio-template-dialog { width: min(1120px, calc(100% - 30px)); max-height: calc(100% - 30px); padding: 0; border: 1px solid #d9dfd8; border-radius: 14px; background: #f4f6f2; color: #162b26; }
#studio-template-dialog::backdrop { background: rgba(14,27,25,.66); }
.template-dialog-header { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; background: #fff; border-bottom: 1px solid #d9dfd8; }
.template-dialog-header h2 { margin: 0; font-size: 21px; }
.template-dialog-body { padding: 18px 20px; }

.template-gallery-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
#studio-controls .template-gallery-toolbar label { width: auto; margin: 0; }
#studio-controls .template-gallery-palette { display: flex; align-items: center; gap: 7px; }
.template-gallery-palette input { width: auto; }
