#templates > .row[hidden], #templates .template-catalog [hidden] { display: none !important; }
#templates .template-catalog {
  --tc-soft: #edf8f3;
  --tc-accent: #006751;
  --tc-card-ink: #e0f6ed;
  --tc-utility-bg: #e8eeff;
  --tc-utility-ink: #234ac3;
  --tc-marketing-bg: #f4e8ff;
  --tc-marketing-ink: #7a24aa;
  --tc-check-ink: #fff;
  --tc-amber-bg: #fff1d4;
  --tc-amber-ink: #824a08;
  --tc-red-bg: #fff0ed;
  --tc-red-ink: #982d25;
  display: grid;
  gap: 16px;
  width: 100%;
  color: var(--text);
}
html[data-theme="dark"] #templates .template-catalog {
  --tc-soft: #19352c;
  --tc-accent: #81e3bf;
  --tc-card-ink: #21463a;
  --tc-utility-bg: #263760;
  --tc-utility-ink: #b9caff;
  --tc-marketing-bg: #43275b;
  --tc-marketing-ink: #ebbcff;
  --tc-check-ink: #21463a;
  --tc-amber-bg: #49371d;
  --tc-amber-ink: #ffd58c;
  --tc-red-bg: #4b2926;
  --tc-red-ink: #ffc0b8;
}
.template-catalog svg { width: 20px; height: 20px; display: block; flex-shrink: 0; }
.template-catalog .tc-header,
.template-catalog .tc-toolbar,
.template-catalog .tc-filters,
.template-catalog .tc-selects { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.template-catalog .tc-header,
.template-catalog .tc-filters { justify-content: space-between; }
.template-catalog .tc-header h2 {
  margin: 0; font-size: clamp(22px, 3vw, 35px); font-weight: 800; letter-spacing: -.025em;
}
.template-catalog .tc-search,
.template-catalog .tc-category {
  min-height: 42px; display: flex; align-items: center; gap: 9px;
  padding: 0 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.template-catalog .tc-search input {
  border: 0; background: transparent; color: var(--text); width: min(220px, 46vw); padding: 8px 0;
}
.template-catalog .tc-category select,
.template-catalog .template-channel-picker select {
  padding: 7px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
.template-catalog .template-channel-picker { color: var(--muted); margin: 0; gap: 8px; font-size: 13px; }
.template-catalog .tc-category span { font-size: 13px; color: var(--muted); }
#templates .template-catalog button.tc-icon-button,
#templates .template-catalog button.tc-info {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card) !important; color: var(--tc-accent) !important; border: 1px solid var(--line);
  min-width: 42px; min-height: 42px; padding: 8px;
}
#templates .template-catalog button.tc-info { min-width: 30px; min-height: 30px; padding: 4px; margin-left: 2px; }
#templates .template-catalog button.tc-primary {
  background: #007f5f !important; color: #fff !important; min-height: 42px; padding-inline: 13px;
}
.template-catalog .tc-messages { display: contents; }
.template-catalog .tc-messages > :empty { display: none; }
.template-catalog .tc-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(235px, 100%), 1fr)); gap: 12px; }
#templates .template-catalog .tc-card {
  display: flex; align-items: center; gap: 12px; min-height: 104px;
  padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card) !important; color: var(--text) !important; text-align: left;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
#templates .template-catalog button.tc-card:is(:hover,:focus-visible),
#templates .template-catalog button.tc-card[aria-pressed="true"]:not([data-tc-status="ALL"]) {
  border-color: var(--tc-accent); background: var(--tc-soft) !important;
  box-shadow: 0 7px 18px #00675115;
}
#templates .template-catalog button.tc-card:hover { transform: translateY(-2px); }
.template-catalog .tc-card strong { display: block; font-size: 27px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.template-catalog .tc-card-icon {
  display: grid; place-items: center; color: var(--tc-accent); background: var(--tc-card-ink);
  border-radius: 12px; width: 47px; height: 47px; flex: 0 0 47px;
}
.template-catalog .tc-card-icon svg { width: 26px; height: 26px; transition: transform .18s ease; }
.template-catalog button.tc-card:hover .tc-card-icon svg { transform: scale(1.12); }
.template-catalog .tc-card-alert { background: var(--tc-amber-bg); color: var(--tc-amber-ink); }
.template-catalog .tc-quote strong { font-size: clamp(17px, 2vw, 24px); }
.template-catalog .tc-quote small { display: block; color: var(--muted); }
.template-catalog .tc-quote button { margin-left: auto; }
.template-catalog small.tc-plan-pill {
  display: inline-block; margin-top: 5px; padding: 2px 7px; border-radius: 999px;
  color: var(--tc-accent); background: var(--tc-card-ink); font-weight: 700;
}
.template-catalog .tc-status-filters { display: flex; gap: 5px; flex-wrap: wrap; }
#templates .template-catalog .tc-status-filters button {
  border: 1px solid var(--line); background: var(--card) !important; color: var(--text) !important;
}
#templates .template-catalog .tc-status-filters button[aria-pressed="true"] {
  background: #007657 !important; color: #fff !important; border-color: #007657;
}
#templates .template-catalog :is(button,input,select):focus-visible,
.tc-details button:focus-visible { outline: 2px solid var(--brand2); outline-offset: 2px; }
.template-catalog .tc-icon-button svg { transition: transform .2s ease; }
.template-catalog .tc-icon-button:hover svg { transform: rotate(-12deg); }
.template-catalog :is([data-tc-sync],[data-tc-refresh-rate]):disabled svg { animation: tc-spin 1s linear infinite; }
@keyframes tc-spin { to { transform: rotate(360deg); } }

.template-catalog .tc-table-wrap {
  overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card);
}
.template-catalog .tc-table-wrap table { width: 100%; border-collapse: collapse; }
.template-catalog th { background: var(--tc-soft); padding: 11px 14px; font-weight: 750; }
.template-catalog td { padding: 10px 14px; vertical-align: middle; transition: background .15s ease; }
.template-catalog tbody tr:last-child td { border-bottom: 0; }
.template-catalog tbody tr:hover td,
.template-catalog tbody tr:focus-within td { background: var(--tc-soft); }
.template-catalog .tc-identity { display: flex; align-items: center; gap: 12px; min-width: 210px; white-space: normal; }
.template-catalog .tc-identity strong,
.template-catalog .tc-identity small { overflow-wrap: anywhere; }
.template-catalog .tc-identity small {
  display: -webkit-box; color: var(--muted); margin-top: 3px; font-size: 12px;
  -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.tc-thumbnail {
  position: relative; flex: 0 0 56px; width: 56px; height: 50px; display: grid; place-items: center;
  background: var(--bg); color: var(--brand2); overflow: hidden; border-radius: 8px;
}
.tc-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tc-thumbnail svg { width: 21px; height: 21px; }
.tc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--text); background: var(--bg);
}
.template-catalog .tc-badge svg { width: 13px; height: 13px; }
.tc-badge.approved, .tc-badge.category { background: var(--tc-card-ink); color: var(--tc-accent); }
.tc-badge.utility { background: var(--tc-utility-bg); color: var(--tc-utility-ink); }
.tc-badge.marketing { background: var(--tc-marketing-bg); color: var(--tc-marketing-ink); }
.tc-badge.pending { background: var(--tc-amber-bg); color: var(--tc-amber-ink); }
.tc-badge.rejected { background: var(--tc-red-bg); color: var(--tc-red-ink); }
.template-catalog .tc-empty { padding: 25px; text-align: center; color: var(--muted); white-space: normal; }
.template-catalog .tc-unit-price { font-weight: 650; font-variant-numeric: tabular-nums; }
.template-catalog .tc-prepaid-price-head {
  display: grid; gap: 3px; font-size: 13px; line-height: 1.35;
}
.template-catalog .tc-meta-exclusion { color: var(--tc-red-ink); }
.template-catalog .tc-prepaid-packages h3 { margin: 0 0 8px; font-size: 16px; }
.template-catalog .tc-prepaid-packages ul {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 10px; list-style: none; margin: 0; padding: 0;
}
.template-catalog .tc-prepaid-packages li {
  display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card);
}
.template-catalog .tc-prepaid-packages strong { color: var(--tc-accent); }
.template-catalog .tc-prepaid-packages span { font-size: 13px; }
.template-catalog .tc-prepaid-price-head a {
  justify-self: start; color: var(--tc-accent); text-decoration: underline; text-underline-offset: 2px;
}
.template-catalog .tc-prepaid-price-head a:focus-visible {
  outline: 2px solid var(--tc-accent); outline-offset: 2px;
}
.template-catalog .tc-price-note {
  display: flex; gap: 8px; align-items: center; margin: 0; padding: 10px 12px;
  border-radius: 10px; color: var(--text); background: var(--tc-soft); font-size: 13px;
}
.template-catalog .tc-balloon {
  position: fixed; z-index: 1200; max-width: min(250px, calc(100vw - 24px));
  padding: 8px 11px; border-radius: 8px; background: #104a3d; color: #fff; font-size: 13px;
  box-shadow: 0 6px 20px #0002; animation: tc-arrive .17s ease-out;
}
@keyframes tc-arrive { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.tc-details {
  width: min(520px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); overflow: auto;
  padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text);
}
.tc-details::backdrop { background: #1131288c; }
.tc-details h3 { overflow-wrap: anywhere; }
.tc-details .tc-thumbnail { width: 120px; height: 86px; }
.tc-details .tc-message-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.tc-details .tc-detail-buttons, .tc-details footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tc-details .tc-detail-buttons a { border: 1px solid var(--line); padding: 5px 9px; border-radius: 8px; color: var(--brand2); }
.tc-details footer { justify-content: flex-end; }
.tc-sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 680px) {
  .template-catalog .tc-toolbar { width: 100%; }
  .template-catalog .tc-search { flex: 1; }
  .template-catalog .tc-search input { min-width: 0; width: 100%; }
  .template-catalog th, .template-catalog td { padding-inline: 9px; }
  .template-catalog .tc-identity { min-width: 175px; }
  .template-catalog .tc-status-filters button { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .template-catalog *, .template-catalog *::before { transition: none !important; animation: none !important; }
}
