/* Templates panel */

.tmpl-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 6px;
}

.tmpl-search {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  padding: 5px 8px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s;
}
.tmpl-search:focus { border-color: var(--info); }
.tmpl-search::placeholder { color: var(--text-dim); }

/* Category chips */
.tmpl-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 14px 10px;
  border-bottom: 1px solid var(--border);
}

.tmpl-cat-chip {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--sans);
  letter-spacing: 0.02em;
}
.tmpl-cat-chip:hover {
  border-color: var(--border-bright);
  color: var(--text);
}
.tmpl-cat-chip.active {
  background: var(--info);
  border-color: var(--info);
  color: #0a1620;
  font-weight: 600;
}

/* Template panel list */
.tmpl-panel-list {
  flex: 1;
  overflow: auto;
  padding: 6px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tmpl-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  font-family: var(--serif);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 3px;
  margin-top: 8px;
}

.tmpl-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.12s;
}
.tmpl-row:hover {
  border-color: var(--border-bright);
  background: var(--surface-2);
}

.tmpl-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tmpl-row .name {
  flex: 1;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmpl-row .builtin-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tmpl-row .desc {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmpl-row .preview {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmpl-row .s-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

/* Insert button */
.tmpl-ins-btn {
  background: transparent;
  border: 1px solid var(--info);
  color: var(--info);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--sans);
  line-height: 1.3;
}
.tmpl-ins-btn:hover { background: var(--info); color: #0a1620; }

/* Edit button */
.tmpl-edit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--sans);
  line-height: 1.3;
}
.tmpl-edit-btn:hover { border-color: var(--border-bright); color: var(--text); }

/* Delete button */
.tmpl-del-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--sans);
  line-height: 1.3;
}
.tmpl-del-btn:hover { border-color: var(--error); color: var(--error); }

/* Save as Template button */
.tmpl-save-btn-wrap {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
}

.tmpl-save-btn {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  color: var(--text);
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--sans);
  font-weight: 500;
}
.tmpl-save-btn:hover {
  border-color: var(--info);
  color: var(--info);
}
