/* Template List — Grid Cards */

.tl-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 20px 20px 10px;
}
.tl-header-title {
    font-size: 18px;
    font-weight: 700;
}
.tl-header-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}
.tl-header-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    background: rgba(99,102,241,.12);
    padding: 3px 10px;
    border-radius: 12px;
}

.tl-empty {
    padding: 28px;
    text-align: center;
    color: var(--text-dim);
}

.tl-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 10px 20px 20px;
}

.tl-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
    transition: transform .12s, border-color .12s;
}
.tl-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99,102,241,.55);
}

.tl-img {
    height: 120px;
    background: rgba(0,0,0,.18);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.tl-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tl-img-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}
.tl-img-fallback i { width: 28px; height: 28px; }
.tl-img.noimg .tl-img-fallback { opacity: 1; }

.tl-body {
    padding: 12px 12px 14px;
}

.tl-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.tl-name {
    font-size: 14px;
    font-weight: 650;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tl-badges {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    flex-shrink: 0;
}
.tl-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(99,102,241,.12);
    color: var(--primary-hover);
    border: 1px solid rgba(99,102,241,.22);
    white-space: nowrap;
}
.tl-badge.dim {
    background: rgba(148,163,184,.12);
    border-color: rgba(148,163,184,.18);
    color: var(--text-dim);
}

.tl-desc {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tl-meta {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: var(--text-dim);
}
.tl-meta i { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.tl-id { font-family: 'SF Mono', 'Fira Code', monospace; }

@media (max-width: 980px) {
    .tl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .tl-grid { grid-template-columns: 1fr; }
    .tl-img { height: 140px; }
}
