/* PDF template gallery (/templates/) and template pages */
.tp-search { position: relative; max-width: 560px; margin: 8px auto 0; }
.tp-search .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.tp-search input { width: 100%; height: 50px; padding: 0 16px 0 42px; font: inherit; font-size: 16px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text); }
.tp-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.tp-gallery { padding-top: 28px; }
.tp-cats { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px; margin-bottom: 18px; scrollbar-width: none; position: sticky; top: var(--header-h, 0); z-index: 3; background: var(--bg); }
.tp-cats::-webkit-scrollbar { display: none; }
.tp-cats .chip { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.tp-cats .chip:hover { border-color: var(--border-strong); }
.tp-cats .chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.tp-group { margin-bottom: 40px; }
.tp-group > h2 { font-size: 20px; letter-spacing: -.015em; margin: 0 0 14px; }
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.tp-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.tp-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.tp-thumb { display: block; background: var(--surface-2); padding: 14px 14px 0; border-bottom: 1px solid var(--border); aspect-ratio: 595 / 600; overflow: hidden; }
.tp-thumb img { display: block; width: 100%; height: auto; border-radius: 4px 4px 0 0; box-shadow: 0 1px 4px rgba(16, 24, 40, .12); transition: transform .2s; }
.tp-card:hover .tp-thumb img { transform: translateY(-3px); }
.tp-meta { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 6px; flex: 1; }
.fx .tp-card .tp-meta a.tp-name.tp-name, .fx .tp-card a.tp-thumb.tp-thumb { color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none; }
.fx .tp-card .tp-meta a.tp-name.tp-name:hover { color: var(--accent-text); }
.tp-meta span { color: var(--muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tp-use { margin: 6px 14px 14px; }
.tp-empty { text-align: center; color: var(--muted); padding: 40px 0; }
.tp-hero { text-align: left; }
.tp-hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.tp-hero .fx-crumbs { justify-content: flex-start; }
.tp-hero h1 { margin-left: 0; }
.tp-hero .fx-sub { margin-left: 0; }
.tp-hero .fx-ctas.left, .tp-hero .fx-trust { justify-content: flex-start; align-items: center; }
.tp-hero .fx-ctas .btn .i { margin-right: 6px; }
.tp-preview { margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.tp-preview img { display: block; width: 100%; height: auto; box-shadow: 0 6px 24px rgba(16, 24, 40, .14); border-radius: 3px; }
.tp-note { color: var(--muted); font-size: 14px; }
@media (max-width: 860px) {
  .tp-hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .tp-preview { max-width: 420px; }
  .tp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tp-meta span { display: none; }
  .tp-use { margin: 4px 10px 10px; }
}
/* Busy overlay while a template opens (same as Create PDF) */
.cr-busy { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(16, 24, 40, .32); }
.cr-busy .card { display: flex; gap: 12px; align-items: center; padding: 18px 26px; font-weight: 600; }
