/* === HOME NAVBAR & BUTTONS FOR HEADER === */
.nav.nav-fullscreen {
  width: 100%;
  position: relative;
  z-index: 10;
  background: var(--hp-header-bg, #fff);
  border-bottom: 1px solid var(--hp-header-border, #e5e7eb);
  backdrop-filter: blur(10px);
}
.nav-inner-full {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 12px var(--hp-pad-x, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}
.nav-link {
  font-size: 15px;
  line-height: 1;
  color: var(--hp-nav-link, #334155);
  padding: 10px 12px;
  border-radius: 12px;
  transition: background-color .18s, color .18s;
}
.nav-link:hover {
  background: var(--hp-nav-link-hover-bg, #f1f5f9);
  color: var(--hp-nav-link-hover, #1e293b);
}
.nav-link.is-active {
  background: var(--hp-nav-active-bg, #dbeafe);
  border: 1px solid var(--hp-nav-active-border, #93c5fd);
  color: var(--hp-nav-active, #2563eb);
}
.btn {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 14px 34px rgba(37,99,235,.18);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
}
.btn-outline {
  background: var(--hp-surface, #fff);
  border: 1px solid var(--hp-border, #2563eb);
  color: var(--hp-text, #2563eb);
}
.btn-outline:hover {
  background: var(--hp-surface-2, #f1f5f9);
  color: #2563eb;
}
/* ========== TEMPLATES PAGE (Profly) ==========
   Senior minimalist UI, fully scoped to Templates page only.
   ============================================ */

body.templates-page{
  background: #f8fafc;
  color: #0f172a;
  position: relative;
  isolation: isolate; /* keep blur layers behind content */
}

/* Soft gradient blur background (very light, scoped) */
body.templates-page::before,
body.templates-page::after{
  content:"";
  position: fixed;
  inset: -120px;
  z-index: -1;
  pointer-events: none;
  filter: blur(48px);
  opacity: 0.75;
}

body.templates-page::before{
  background:
    radial-gradient(700px 420px at 18% 12%, rgba(37, 99, 235, 0.16), rgba(255,255,255,0) 60%),
    radial-gradient(760px 460px at 82% 10%, rgba(13, 212, 179, 0.14), rgba(255,255,255,0) 62%),
    radial-gradient(820px 520px at 55% 92%, rgba(168, 85, 247, 0.08), rgba(255,255,255,0) 58%);
}


body.templates-page::after{
  background:
    radial-gradient(780px 520px at 50% -10%, rgba(2, 132, 199, 0.10), rgba(255,255,255,0) 58%),
    radial-gradient(720px 520px at 10% 86%, rgba(34, 197, 94, 0.08), rgba(255,255,255,0) 60%);
  opacity: 0.55;
  filter: blur(64px);
}

@media (min-width: 1920px) {
  body.templates-page .tpl-page {
    margin-top: clamp(44px, 5vh, 72px);
    max-width: none;
    width: 100%;
    padding-left: clamp(16px, 3vw, 56px);
    padding-right: clamp(16px, 3vw, 56px);
  }
}


.tpl-page {
  padding-top: 84px;
  background: transparent;
  display: grid;
  position: relative;
}




/* HERO GRADIENT SECTION */
.tpl-hero-gradient {
  background: 
    radial-gradient(900px 520px at 12% 10%, rgba(37, 99, 235, 0.15), rgba(7, 11, 20, 0)),
    radial-gradient(900px 520px at 88% 0%, rgba(13, 212, 179, 0.12), rgba(7, 11, 20, 0)),
    linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(13, 212, 179, 0.06) 100%),
    #f8fafc;
  padding: clamp(40px, 5vh, 64px) clamp(16px, 3vw, 56px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.tpl-hero-gradient-inner {
  max-width: 1120px;
  margin: 0 auto;
}

.tpl-hero-gradient-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.tpl-hero-gradient-title {
  font-size: clamp(32px, 3.5vw, 48px);
  line-height: 1.2;
  margin: 0 0 16px;
  color: #0b1220;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.tpl-hero-gradient-text {
  font-size: clamp(16px, 1.2vw, 18px);
  line-height: 1.6;
  margin: 0;
  color: rgba(15, 23, 42, 0.72);
  max-width: 65ch;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {
  .tpl-hero-gradient {
    padding: clamp(32px, 4vh, 48px) clamp(16px, 4vw, 24px);
  }
  
  .tpl-hero-gradient-title {
    font-size: 28px;
  }
  
  .tpl-hero-gradient-text {
    font-size: 15px;
  }
}

/* HERO */
 
.tpl-hero {
  padding: clamp(56px, 6vh, 84px) 0 clamp(104px, 13vh, 190px);
}

.tpl-hero-inner {
  max-width: none;
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: center;
}

.tpl-hero-text {
  max-width: 1040px;
  margin: 0 auto;
  text-align: center;
}

.tpl-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(37, 99, 235, 0.9);
  margin: 0 0 14px;
}

.tpl-hero-title {
  font-size: clamp(40px, 4.4vw, 84px);
  line-height: 1.02;
  margin: 0 0 16px;
  color: #0b1220;
  letter-spacing: -0.04em;
  font-weight: 800;
  text-wrap: balance;
  max-width: 20ch;
}

/* Full-screen desktop: keep headline on ONE line */
@media (min-width: 1024px){
  .tpl-hero-title{
    max-width: none;
    white-space: nowrap;
    text-wrap: nowrap;
  }
}

.tpl-hero-subtitle {
  margin: 0 auto 22px;
  color: rgba(15, 23, 42, 0.68);
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.65;
  max-width: 56ch;
}

.tpl-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  justify-content: center;
}

.tpl-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  background: rgba(255,255,255,0.75);
  color: rgba(15,23,42,0.72);
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.tpl-pill-new {
  background: #dcfce7;
  color: #16a34a;
  border-color: rgba(22, 163, 74, 0.3);
}

.tpl-pill-type {
  background: #fef3c7;
  color: #92400e;
  border-color: rgba(234, 179, 8, 0.4);
}

.tpl-hero-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  justify-content: center;
}

.tpl-hero-meta{
  margin: 0 0 18px;
  font-size: clamp(14px, 1.1vw, 16px);
  color: rgba(15, 23, 42, 0.62);
  line-height: 1.7;
  letter-spacing: 0.01em;
  max-width: 72ch;
  margin-left: auto;
  margin-right: auto;
}

.tpl-hero-note {
  font-size: 13px;
  color: #6b7280;
}

/* HERO PREVIEW (right card) */

.tpl-hero-preview {
  display: flex;
  justify-content: flex-end;
}

.tpl-hero-preview-card{
  width: min(460px, 92vw);
  aspect-ratio: 297 / 210;
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 18px 46px rgba(15,23,42,0.12);
  position: relative;
  overflow: hidden;
}

.tpl-hero-preview-card::before{
  content: none;
}

.tpl-hero-preview-inner{
  position: relative;
  height: 100%;
  border-radius: 16px;
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: inset 0 0 0 1px rgba(15,23,42,0.04);
  padding: 22px 26px;
  display:flex;
  flex-direction: column;
  align-items:center;
  text-align:center;
  gap: 8px;
}

.tpl-hero-card-title {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6b7280;
}

.tpl-hero-card-sub {
  font-size: 13px;
  text-transform: lowercase;
  color: #9ca3af;
}

.tpl-hero-card-name {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.tpl-hero-card-body {
  margin-top: 4px;
  font-size: 12px;
  color: #4b5563;
}

.tpl-hero-card-footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #6b7280;
}

/* TOOLBAR: FILTERS + SEARCH */

.tpl-toolbar {
  position: relative; /* sits in normal flow, above the grid */
  z-index: 20;
  padding: 6px 0;
  background: rgba(248, 250, 252, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

/* Spacing between hero and templates grid */
body.templates-page .tpl-toolbar{
  margin-top: 18px;
  margin-bottom: 10px;
}

.tpl-toolbar-inner {
  max-width: none;
  margin: 0;
  padding-bottom: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.tpl-toolbar-meta{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.tpl-toolbar-title h2{
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.tpl-toolbar-subtitle{
  margin: 4px 0 0;
  font-size: 13px;
  color: rgba(15, 23, 42, 0.62);
}
.tpl-count{
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255,255,255,0.7);
  color: rgba(15,23,42,0.72);
  font-size: 13px;
  white-space: nowrap;
}

.tpl-toolbar-controls{
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 12px;
  align-items: center;
}

.tpl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tpl-filter {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255,255,255,0.8);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(15,23,42,0.72);
  cursor: pointer;
  transition: all 0.16s ease;
}

.tpl-filter.is-active {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-color: rgba(37, 99, 235, 0.85);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.14);
}

.tpl-filter:hover {
  border-color: rgba(37, 99, 235, 0.55);
}

.tpl-search-wrap {
  min-width: 240px;
}

.tpl-search-label{
  display:flex;
  position: relative;
}
.tpl-search {
  width: 100%;
  height: 40px;
  padding: 0 44px 0 14px; /* room for button */
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  font-size: 14px;
  background: rgba(255,255,255,0.86);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: none;
}

.tpl-search:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
  background: rgba(255,255,255,0.94);
}

/* search button inside input */
.tpl-search-btn{
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255,255,255,0.65);
  color: rgba(15,23,42,0.62);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: none;
}

.tpl-search-btn:hover{
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.35);
  color: rgba(29, 78, 216, 0.95);
}

.tpl-search-btn svg{
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tpl-search-btn svg circle,
.tpl-search-btn svg path{
  vector-effect: non-scaling-stroke;
}

.tpl-sort-wrap{
  display:flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}
.tpl-sort{
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255,255,255,0.84);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(15,23,42,0.78);
  box-shadow: 0 6px 14px rgba(15,23,42,0.05);
}
.tpl-clear{
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255,255,255,0.60);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tpl-clear:hover{
  border-color: rgba(37,99,235,0.55);
  color: #1d4ed8;
}

.tpl-sr{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip: rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

/* GRID SECTION */

.tpl-grid-section {
  padding: 12px 0 clamp(56px, 6vh, 84px);
}

.tpl-grid-section .container {
  max-width: none;
  margin: 0 auto;
  padding: 0;
}

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

/* Load more */
.tpl-loadmore{
  display: flex;
  justify-content: center;
  padding: 22px 0 6px;
}

.tpl-loadmore-btn{
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.75);
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tpl-loadmore-btn:hover{
  background: linear-gradient(180deg, #1d4ed8, #1e40af);
  border-color: rgba(37, 99, 235, 0.95);
  color: #ffffff;
}

/* CARDS */

.tpl-card {
  position: relative;
  background: rgba(255,255,255,0.9);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tpl-card:hover {
  transform: translateY(-3px);
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10);
}

/* rangli preview */

.tpl-thumb {
  position: relative;
  padding: 14px;
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.tpl-thumb::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(520px 200px at 20% 0%, rgba(15,23,42,0.05), rgba(255,255,255,0));
  pointer-events:none;
  z-index: 1;
}

/* Paper preview inside thumb */
.tpl-thumb::before{
  content:"";
  position: relative;
  display:block;
  width: 100%;
  aspect-ratio: 297/210;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 8px 18px rgba(15,23,42,0.10);
  z-index: 0;
}

/* Watermark text in the middle of each template thumb */
.tpl-thumb-watermark{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: clamp(16px, 1.8vw, 22px);
  color: rgba(15, 23, 42, 0.14);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* Use template button: neutral by default, blue only on hover (templates page only) */
body.templates-page .tpl-actions .btn.btn-primary,
body.templates-page [data-modal-use].btn.btn-primary{
  background: rgba(255,255,255,0.85);
  color: rgba(15,23,42,0.88);
  border: 1px solid rgba(15,23,42,0.14);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}

body.templates-page .tpl-actions .btn.btn-primary:hover,
body.templates-page [data-modal-use].btn.btn-primary:hover{
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-color: rgba(37, 99, 235, 0.85);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.18);
}

/* subtle “layout lines” overlay */
.tpl-thumb .tpl-paper-lines{ display:none; }
.tpl-thumb::marker{ content:""; }

/* Color accents per template (used for modal too) */
.tpl-thumb-1::after,
.tpl-thumb-2::after,
.tpl-thumb-3::after,
.tpl-thumb-4::after,
.tpl-thumb-5::after,
.tpl-thumb-6::after,
.tpl-thumb-7::after,
.tpl-thumb-8::after,
.tpl-thumb-9::after,
.tpl-thumb-10::after{
  opacity: 1;
}

.tpl-thumb-1::after { background: radial-gradient(520px 220px at 20% 0%, rgba(37,99,235,0.12), rgba(255,255,255,0)); }
.tpl-thumb-2::after { background: radial-gradient(520px 220px at 20% 0%, rgba(249,115,22,0.11), rgba(255,255,255,0)); }
.tpl-thumb-3::after { background: radial-gradient(520px 220px at 20% 0%, rgba(234,179,8,0.12), rgba(255,255,255,0)); }
.tpl-thumb-4::after { background: radial-gradient(520px 220px at 20% 0%, rgba(14,165,233,0.12), rgba(255,255,255,0)); }
.tpl-thumb-5::after { background: radial-gradient(520px 220px at 20% 0%, rgba(236,72,153,0.11), rgba(255,255,255,0)); }
.tpl-thumb-6::after { background: radial-gradient(520px 220px at 20% 0%, rgba(148,163,184,0.14), rgba(255,255,255,0)); }
.tpl-thumb-7::after { background: radial-gradient(520px 220px at 20% 0%, rgba(34,197,94,0.11), rgba(255,255,255,0)); }
.tpl-thumb-8::after { background: radial-gradient(520px 220px at 20% 0%, rgba(15,23,42,0.06), rgba(255,255,255,0)); }
.tpl-thumb-9::after { background: radial-gradient(520px 220px at 20% 0%, rgba(99,102,241,0.12), rgba(255,255,255,0)); }
.tpl-thumb-10::after { background: radial-gradient(520px 220px at 20% 0%, rgba(20,184,166,0.12), rgba(255,255,255,0)); }

/* Badglar */

.tpl-badges {
  position: absolute;
  top: 10px;
  left: 12px;
  display: flex;
  gap: 6px;
}

/* Card body */

.tpl-card-body {
  padding: 18px 18px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tpl-card-title {
  font-size: 15.5px;
  margin: 0 0 2px 0;
  color: #1e293b;
  font-weight: 500 !important; /* medium (override h3 default bold) */
  letter-spacing: 0.01em;
}

/* Premium crown badge (random 5 cards) */
.tpl-premium{
  position: absolute;
  top: 18px;
  right: 24px;
  left: auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  z-index: 5; /* stay above thumb overlays */
  line-height: 0;
}

.tpl-premium-icon{
  width: 30px;
  height: 30px;
  color: #facc15; /* yellow */
  fill: currentColor !important;
  stroke: none !important;
  filter: none;
}

.tpl-premium-icon path{
  fill: currentColor !important;
  stroke: none !important;
}

.tpl-card-text {
  margin: 0;
  font-size: 14px;
  color: #4b5563;
}

/* Sertifikat fieldlari ro‘yxati */

.tpl-fields {
  margin: 4px 0 6px;
  padding-left: 18px;
  list-style: disc;
  font-size: 13px;
  color: #6b7280;
}

.tpl-fields li + li {
  margin-top: 2px;
}

/* Meta */

.tpl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}

.tpl-meta span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f3f4f6;
}

/* Actions */

.tpl-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

/* Premium quick overlay */

/* Kichik buttonlar – umumiy .btn bilan mos */

.tpl-btn-sm {
  padding: 7px 18px !important;
  font-size: 14px !important;
  border-radius: 12px !important;
  margin: 0;
  min-width: 96px;
}

.tpl-btn-ghost {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.16s ease;
}

.tpl-btn-ghost:hover {
  border-color: #2563eb;
  color: #2563eb;
}

/* RESPONSIVE */

@media (max-width: 960px) {
  .tpl-hero-inner {
    grid-template-columns: minmax(0, 1fr);
  }
  .tpl-hero-preview {
    justify-content: flex-start;
    margin-top: 12px;
  }
  .tpl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tpl-page {
    padding-top: 76px;
  }
  .tpl-hero {
    padding-top: 32px;
  }
  .tpl-hero-title {
    font-size: 32px;
  }
  .tpl-toolbar-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .tpl-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .tpl-hero-card {
    width: 100%;
  }
}

@media (min-width: 1280px){
  .tpl-grid{ grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1020px){
  .tpl-toolbar-controls{
    grid-template-columns: 1fr;
  }
  .tpl-sort-wrap{
    justify-content: flex-start;
  }
}

/* Extra breathing room for 1600+ widths */
@media (min-width: 1600px){
  .tpl-page{
    padding-top: 92px;
  }

  .tpl-hero-title{
    font-size: 46px;
  }

  .tpl-hero-subtitle{
    font-size: 16px;
  }

  .tpl-toolbar-inner{
    padding-bottom: 10px;
  }

  .tpl-grid{
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
  }

  .tpl-thumb{
    padding: 16px;
  }
}

/* MODAL */
.tpl-modal{
  position: fixed;
  inset: 0;
  z-index: 80;
}
.tpl-modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
}
.tpl-modal__dialog{
  position: relative;
  width: min(1120px, calc(100vw - 32px));
  margin: 84px auto 24px;
  border-radius: 22px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 40px 120px rgba(15,23,42,0.35);
  overflow: hidden;
}
.tpl-modal__header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15,23,42,0.08);
}
.tpl-modal__title h3{
  margin: 0;
  font-size: 16px;
}
.tpl-modal__title p{
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(15,23,42,0.62);
}
.tpl-modal__actions{
  display:flex;
  align-items:center;
  gap: 10px;
}
.tpl-modal__close{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(255,255,255,0.75);
  cursor:pointer;
}
.tpl-modal__close:hover{
  border-color: rgba(37,99,235,0.35);
  color: #1d4ed8;
}
.tpl-modal__body{
  display:grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
}
.tpl-preview{
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 12px;
  border-radius: 18px;
  background: radial-gradient(circle at top left, rgba(37,99,235,0.10), rgba(255,255,255,0));
  border: 1px solid rgba(15,23,42,0.08);
}
.tpl-preview__paper{
  width: min(720px, 100%);
  aspect-ratio: 297/210;
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(15,23,42,0.18);
  padding: 12px;
  background: #fff;
}

/* Modal preview accent backgrounds (because preview classes are applied to .tpl-preview__paper) */
.tpl-preview__paper.tpl-thumb-1{
  background: radial-gradient(760px 420px at 12% 8%, rgba(37,99,235,0.20), rgba(255,255,255,0)), #fff;
}
.tpl-preview__paper.tpl-thumb-2{
  background: radial-gradient(760px 420px at 12% 8%, rgba(249,115,22,0.18), rgba(255,255,255,0)), #fff;
}
.tpl-preview__paper.tpl-thumb-3{
  background: radial-gradient(760px 420px at 12% 8%, rgba(234,179,8,0.20), rgba(255,255,255,0)), #fff;
}
.tpl-preview__paper.tpl-thumb-4{
  background: radial-gradient(760px 420px at 12% 8%, rgba(14,165,233,0.20), rgba(255,255,255,0)), #fff;
}
.tpl-preview__paper.tpl-thumb-5{
  background: radial-gradient(760px 420px at 12% 8%, rgba(236,72,153,0.18), rgba(255,255,255,0)), #fff;
}
.tpl-preview__paper.tpl-thumb-6{
  background: radial-gradient(760px 420px at 12% 8%, rgba(148,163,184,0.22), rgba(255,255,255,0)), #fff;
}
.tpl-preview__paper.tpl-thumb-7{
  background: radial-gradient(760px 420px at 12% 8%, rgba(34,197,94,0.18), rgba(255,255,255,0)), #fff;
}
.tpl-preview__paper.tpl-thumb-8{
  background: radial-gradient(760px 420px at 12% 8%, rgba(15,23,42,0.10), rgba(255,255,255,0)), #fff;
}
.tpl-preview__paper.tpl-thumb-9{
  background: radial-gradient(760px 420px at 12% 8%, rgba(99,102,241,0.18), rgba(255,255,255,0)), #fff;
}
.tpl-preview__paper.tpl-thumb-10{
  background: radial-gradient(760px 420px at 12% 8%, rgba(20,184,166,0.18), rgba(255,255,255,0)), #fff;
}
.tpl-preview__inner{
  height: 100%;
  border-radius: 14px;
  border: 2px solid rgba(15,23,42,0.20);
  background: rgba(255,255,255,0.92);
  padding: 22px 26px;
  display:flex;
  flex-direction: column;
  align-items:center;
  text-align:center;
  gap: 8px;
}
.tpl-preview__title{
  letter-spacing: 0.22em;
  font-weight: 800;
  font-size: 18px;
}
.tpl-preview__sub{
  font-size: 12px;
  color: rgba(15,23,42,0.55);
}
.tpl-preview__name{
  margin-top: 8px;
  font-size: 22px;
  font-weight: 700;
}
.tpl-preview__text{
  margin-top: 4px;
  font-size: 12px;
  max-width: 520px;
  color: rgba(15,23,42,0.72);
}
.tpl-preview__footer{
  margin-top: auto;
  width: 100%;
  display:flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(15,23,42,0.62);
}
.tpl-preview__footer > div{
  width: 44%;
  display:flex;
  flex-direction: column;
  align-items:center;
  gap: 4px;
}
.tpl-preview__line{
  display:block;
  width: 100%;
  height: 1px;
  background: rgba(15,23,42,0.35);
}
/* side panel removed for minimalism */

@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; scroll-behavior:auto !important; }
}
