.template-grid { display: flex; gap: 10px; margin-bottom: 4px; }
.template-thumb {
  flex: 1; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  border: 2.5px solid var(--gray-200); cursor: pointer;
  transition: border-color 0.18s; padding: 0; background: none;
  position: relative;
}
.template-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.template-thumb.active { border-color: var(--teal); }
.template-thumb:hover { border-color: var(--teal); }

.template-thumb::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px;
  background: var(--teal); color: #fff;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  font-size: 0.65rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.template-thumb.active::after { opacity: 1; }

#flyerCanvasWrap {
  display: flex;
  flex: 1;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  background-color: #f0f4f7;
  background-image: radial-gradient(circle, #c8d6e0 1px, transparent 1px);
  background-size: 20px 20px;
  padding: 16px;
}

#flyerCanvas {
  width: auto;
  height: auto;
  max-height: calc(100vh - 360px);
  max-width: 100%;
  border-radius: 8px;
  display: block;
  border: 1px solid var(--gray-200);
}

.preview-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,0.5); color: #fff;
  font-size: 0.7rem; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
  pointer-events: none;
}
