/* Plantillas */

.tpl-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 48px 64px;
}

/* Toolbar */
.tpl-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  margin: 0 0 28px;
}
.tpl-search { max-width: 380px; flex: 0 1 380px; }
.tpl-count {
  font-size: 12px;
  color: var(--fg-tertiary);
  display: inline-flex; gap: 4px;
  font-family: var(--font-mono);
  letter-spacing: 0;
}
.tpl-count b { color: var(--fg-secondary); font-weight: 500; }

/* Grid */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Card */
.tpl-card {
  position: relative;
  background: var(--bg-medium);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px 20px 16px;
  display: flex; flex-direction: column;
  min-height: 200px;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}
.tpl-card:hover {
  border-color: var(--border-default);
  transform: translateY(-1px);
}
.tpl-card.active {
  border-color: var(--accent-primary);
  background:
    radial-gradient(ellipse at 100% 0%, rgba(124,92,255,0.08), transparent 60%),
    var(--bg-medium);
  box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

.tpl-card-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 14px;
}
.tpl-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 160ms ease, color 160ms ease;
}
.tpl-card.active .tpl-icon {
  background: var(--accent-primary);
  color: var(--fg-inverse);
}
.tpl-pill-active {
  display: inline-flex; align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-primary);
  background: rgba(124,92,255,0.18);
  border: 1px solid rgba(124,92,255,0.3);
  padding: 3px 8px 3px 6px;
  border-radius: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tpl-name {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--fg-primary);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.tpl-desc {
  font-size: 12.5px;
  color: var(--fg-secondary);
  line-height: 1.5;
  margin: 0;
  text-wrap: pretty;
}

.tpl-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
}
.tpl-meta {
  font-size: 11px;
  color: var(--fg-tertiary);
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  letter-spacing: 0;
}
.tpl-meta-muted {
  font-family: inherit;
  font-style: italic;
}
.tpl-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.tpl-btn {
  height: 30px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-secondary);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  transition: all 160ms ease;
}
.tpl-card:hover .tpl-btn:not(:disabled) {
  background: var(--accent-primary);
  color: var(--fg-inverse);
  border-color: var(--accent-primary);
}
.tpl-btn:disabled {
  background: transparent;
  border-color: rgba(124,92,255,0.3);
  color: var(--accent-primary);
  cursor: default;
}

/* Custom card */
.tpl-card-custom {
  background:
    repeating-linear-gradient(0deg, transparent 0 6px, rgba(255,255,255,0.012) 6px 12px),
    var(--bg-medium);
  border-style: dashed;
  border-color: var(--border-default);
}
.tpl-card-custom:hover {
  border-color: var(--accent-primary);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(124,92,255,0.06), transparent 60%),
    var(--bg-medium);
}
.tpl-icon-custom {
  width: 44px; height: 44px;
  border-radius: 10px;
  border: 1.5px dashed var(--accent-primary);
  color: var(--accent-primary);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-primary-muted);
}
.tpl-btn-create {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
