/* A fixed logical A4 document is scaled as one sheet at every card width. */
.dashboard-template-card { min-width: 0; }
[data-template-category][hidden] { display: none !important; }
.public-template-grid { margin-top: 24px; }
.public-template-grid .template-card, .template-gallery-card { padding: 0; overflow: hidden; min-width: 0; }
.public-template-grid .template-card-copy, .template-gallery-card .template-card-copy { padding: 18px; }
.public-template-grid .template-card-actions, .template-gallery-card .template-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.public-template-grid .template-use { margin: 0; }
.template-filter-status { grid-column: 1 / -1; margin: 0; color: #526680; font-size: 14px; }
.template-preview-dialog { width: min(900px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 20px; border: 1px solid #cbd9e9; border-radius: 16px; background: #eef3f9; color: #132849; overflow: auto; }
.template-preview-dialog::backdrop { background: rgba(13, 35, 70, .65); }
.template-preview-dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.template-preview-dialog h2 { margin: 0 0 8px; font-size: 22px; }
.template-preview-dialog header p { margin: 0; font-size: 14px; }
.template-preview-dialog header button { flex-shrink: 0; }
.template-preview-dialog .template-preview-sheet { box-shadow: 0 3px 18px rgba(13, 35, 70, .15); }
.template-preview-dialog footer { display: flex; justify-content: flex-end; margin-top: 16px; }
.template-preview-dialog .button:focus-visible, [data-template-preview]:focus-visible { outline: 3px solid #0866dc; outline-offset: 3px; }
@media (max-width: 600px) { .template-preview-dialog { padding: 12px; } .template-preview-dialog h2 { font-size: 18px; } }
.template-gallery-sheet {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 210 / 297;
  overflow: hidden;
  background: #fff;
  border-bottom: 1px solid #e0e8f2;
  contain: layout paint;
}
.template-gallery-frame {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 794px;
  height: 1123px;
  min-width: 0;
  max-width: none;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
}
.dashboard-template-card .creative-pack-badge {
  position: static;
  display: inline-flex;
  width: fit-content;
  align-self: start;
  padding: 5px 8px;
  margin: 0 0 2px;
  font-size: 9px;
  line-height: 1.3;
  letter-spacing: .04em;
  background: #26374e;
  color: #fff;
}
.template-gallery-sheet + .template-card-copy { border-top: 0; }
.template-gallery-sheet--image { display: block; }
.template-gallery-sheet--image .template-reference-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
}
.template-gallery-head { display: block; margin-bottom: 26px; }
.template-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-top: 20px;
  padding: 0;
  border-radius: 0;
  background: transparent;
}
.template-filter button {
  --filter-icon-color: #0866dc;
  --filter-icon-bg: #e7f1ff;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 140px;
  padding: 17px;
  border: 1px solid #dce7f2;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(16, 49, 86, .06);
  color: #132849;
  font-size: inherit;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  transition: transform .18s, border-color .18s, box-shadow .18s, background .18s;
}
.template-filter button:nth-child(2) { --filter-icon-color: #c87931; --filter-icon-bg: #fff1e2; }
.template-filter button:nth-child(3) { --filter-icon-color: #178677; --filter-icon-bg: #e5f7f3; }
.template-filter button:nth-child(4) { --filter-icon-color: #7651bd; --filter-icon-bg: #f0eaff; }
.template-filter button:hover { transform: translateY(-2px); border-color: #a7c8ed; box-shadow: 0 12px 26px rgba(16, 49, 86, .1); }
.template-filter button.active {
  border-color: #72aff5;
  background: linear-gradient(145deg, #fff, #edf6ff);
  box-shadow: inset 0 0 0 1px #72aff5, 0 10px 25px rgba(8, 102, 220, .11);
  color: #102744;
}
.template-filter button.active::after {
  content: '✓';
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #0866dc;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.template-filter button:focus-visible { outline: 3px solid #0866dc; outline-offset: 3px; }
.template-filter-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 15px;
  border-radius: 12px;
  background: var(--filter-icon-bg);
  color: var(--filter-icon-color);
}
.template-filter-icon .ui-icon { width: 25px; height: 25px; }
.template-filter button strong { display: block; margin-top: auto; font-size: 15px; font-weight: 780; letter-spacing: -.015em; }
.template-filter button small { display: block; margin-top: 5px; color: #657b95; font-size: 11px; font-weight: 550; line-height: 1.3; }
@media (max-width: 800px) {
  .template-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .dashboard-template-card .creative-pack-badge { font-size: 9px; }
  .template-gallery-head { margin: 0 0 22px; }
  .template-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 17px; padding: 0; background: transparent; }
  .template-filter button { min-height: 132px; padding: 14px; font-size: inherit; }
  .template-filter-icon { width: 38px; height: 38px; margin-bottom: 10px; border-radius: 11px; }
  .template-filter-icon .ui-icon { width: 23px; height: 23px; }
  .template-filter button strong { font-size: 15px; }
  .template-filter button small { font-size: 11.5px; }
}
@media (max-width: 360px) {
  .template-filter button { min-height: 130px; padding: 12px; }
  .template-filter button strong { font-size: 13.5px; }
  .template-filter button small { font-size: 10.5px; }
  .template-filter button.active::after { top: 10px; right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .template-filter button { transition: none; }
  .template-filter button:hover { transform: none; }
}
