/* Canvix Template Library Redesign V2 — mobile filter drawer and compact toolbar. */
.canvix-account-shell.template-library-v1-page main {
  padding-top: 24px;
}

.cvx-library-page {
  --tl-blue: #38b6ff;
  --tl-blue-dark: #139eea;
  --tl-ink: #101828;
  --tl-text: #344054;
  --tl-muted: #75839a;
  --tl-line: #e5ebf2;
  --tl-surface: #ffffff;
  --tl-soft: #f5f8fb;
  width: 100%;
  color: var(--tl-text);
}

.cvx-library-page button,
.cvx-library-page input,
.cvx-library-page select {
  font: inherit;
}

.tl-search-area {
  margin: 0 0 20px;
}

.tl-search-shell {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 18px;
  border: 1px solid #d6e5ef;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(42, 75, 104, .07);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.tl-search-shell:focus-within {
  border-color: var(--tl-blue);
  box-shadow: 0 0 0 3px rgba(56, 182, 255, .13), 0 12px 30px rgba(42, 75, 104, .1);
}

.tl-search-shell > i {
  color: #168fd5;
  font-size: 19px;
}

.tl-search-shell input {
  min-width: 0;
  flex: 1 1 auto;
  height: 58px;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--tl-ink);
  font-size: 16px;
}

.tl-search-shell input::placeholder {
  color: #98a5b8;
}

.tl-search-clear {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #eef5fa;
  color: #63748d;
  cursor: pointer;
}

.tl-load-more-button,
.tl-preview-primary {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--tl-blue);
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(56, 182, 255, .22);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.tl-load-more-button:hover,
.tl-preview-primary:hover {
  transform: translateY(-1px);
  background: var(--tl-blue-dark);
  box-shadow: 0 13px 28px rgba(56, 182, 255, .28);
}

.tl-platform-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  margin-bottom: 20px;
  padding: 3px 2px 9px;
  scrollbar-width: thin;
}

.tl-platform-chip {
  min-height: 43px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid #e1e8ef;
  border-radius: 999px;
  background: #fff;
  color: #344054;
  box-shadow: 0 3px 12px rgba(38, 61, 89, .035);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.tl-platform-chip i {
  color: #65758d;
}

.tl-platform-chip small {
  min-width: 23px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #77869b;
  font-size: 10px;
  text-align: center;
}

.tl-platform-chip:hover {
  transform: translateY(-1px);
  border-color: #b9e6ff;
  color: #118dcc;
}

.tl-platform-chip.is-active {
  border-color: var(--tl-blue);
  background: var(--tl-blue);
  color: #fff;
  box-shadow: 0 8px 22px rgba(56, 182, 255, .22);
}

.tl-platform-chip.is-active i,
.tl-platform-chip.is-active small {
  color: #fff;
}

.tl-platform-chip.is-active small {
  background: rgba(255, 255, 255, .2);
}

.tl-results-panel {
  padding: 24px;
  border: 1px solid #e7edf3;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(30, 52, 75, .065);
}

.tl-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
}

.tl-toolbar-title h2 {
  margin: 0;
  color: var(--tl-ink);
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.tl-mobile-filter-toggle {
  display: none;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid #d8e5ee;
  border-radius: 10px;
  background: #fff;
  color: #41546d;
  box-shadow: 0 4px 14px rgba(38, 61, 89, .05);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tl-mobile-filter-toggle i {
  color: #159de0;
}

.tl-mobile-filter-toggle.is-active {
  border-color: var(--tl-blue);
  background: #eef9ff;
  color: #168fd5;
}

.tl-toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.tl-select-control {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #dfe7ee;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(38, 61, 89, .045);
  color: #526177;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.tl-select-control:focus-within {
  border-color: var(--tl-blue);
  box-shadow: 0 0 0 3px rgba(56, 182, 255, .1);
}

.tl-select-control i {
  color: #169edf;
}

.tl-select-control select {
  min-width: 118px;
  height: 42px;
  padding: 0 24px 0 0;
  border: 0 !important;
  outline: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tl-size-control select,
.tl-category-control select {
  min-width: 145px;
}

.tl-setup-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #d7edf9;
  border-radius: 12px;
  background: #f3fbff;
  color: #52728b;
  font-size: 12px;
  line-height: 1.5;
}

.tl-setup-note i {
  margin-top: 2px;
  color: #139eea;
}

.tl-grid-wrap {
  position: relative;
  min-height: 320px;
}

.tl-template-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.tl-template-results {
  display: contents;
}

.tl-blank-template-card {
  border-color: #e7edf3;
}

.tl-blank-card-trigger {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.tl-blank-card-preview {
  width: 100%;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef1f4;
  transition: background .2s ease;
}

.tl-blank-plus {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d1d9e1;
  border-radius: 14px;
  background: rgba(255, 255, 255, .86);
  color: #8592a2;
  box-shadow: 0 8px 22px rgba(30, 52, 75, .06);
  font-size: 20px;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
}

.tl-blank-card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px 16px 17px;
}

.tl-blank-card-body strong {
  color: var(--tl-ink);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 650;
}

.tl-blank-card-body > span {
  color: #8090a7;
  font-size: 12px;
}

.tl-blank-template-card:hover .tl-blank-card-preview,
.tl-blank-card-trigger:focus-visible .tl-blank-card-preview {
  background: #e9f7ff;
}

.tl-blank-template-card:hover .tl-blank-plus,
.tl-blank-card-trigger:focus-visible .tl-blank-plus {
  transform: translateY(-2px);
  border-color: var(--tl-blue);
  background: #fff;
  color: var(--tl-blue-dark);
}

.tl-blank-card-trigger:focus-visible {
  outline: 3px solid rgba(56, 182, 255, .22);
  outline-offset: -3px;
}

.tl-template-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 9px 28px rgba(30, 52, 75, .085);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.tl-template-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 182, 255, .85);
  box-shadow: 0 15px 35px rgba(56, 182, 255, .16), 0 8px 24px rgba(30, 52, 75, .08);
}

.tl-card-preview {
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.tl-card-image-shell {
  position: relative;
  width: 100%;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f2f5f8;
}

.tl-card-image-shell img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transition: transform .28s ease;
}

.tl-template-card:hover .tl-card-image-shell img {
  transform: scale(1.018);
}

.tl-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 25, 44, .22);
  opacity: 0;
  transition: opacity .2s ease;
}

.tl-template-card:hover .tl-card-overlay,
.tl-card-preview:focus-visible .tl-card-overlay {
  opacity: 1;
}

.tl-preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  color: #1f3348;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
  font-size: 12px;
  font-weight: 700;
}

.tl-pro-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #fff6dd;
  color: #9c6700;
  box-shadow: 0 6px 18px rgba(91, 66, 12, .12);
  font-size: 10px;
  font-weight: 700;
}

.tl-card-body {
  padding: 15px 16px 16px;
}

.tl-card-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tl-card-heading-row h3 {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  color: var(--tl-ink);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-card-more {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7d8ca2;
}

.tl-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: #8090a7;
  font-size: 12px;
}

.tl-use-button,
.tl-pro-upgrade-button {
  width: 100%;
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 13px;
  border: 1px solid #d7e8f3;
  border-radius: 10px;
  background: #f7fbfe;
  color: #168fd5 !important;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none !important;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.tl-use-button:hover,
.tl-pro-upgrade-button:hover {
  border-color: var(--tl-blue);
  background: var(--tl-blue);
  color: #fff !important;
}

.tl-pro-upgrade-button {
  gap: 7px;
  border-color: #f2d899;
  background: #fff8e8;
  color: #9a6500 !important;
}

.tl-pro-upgrade-button:hover,
.tl-preview-primary.tl-is-locked {
  border-color: #f0b429;
  background: #f5a800;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(245, 168, 0, .22);
}

.tl-loading-overlay {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  padding-top: 100px;
  border-radius: 16px;
  background: rgba(251, 253, 255, .82);
  color: #577087;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(3px);
}

.tl-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #cfeeff;
  border-top-color: var(--tl-blue);
  border-radius: 50%;
  animation: tl-spin .7s linear infinite;
}

@keyframes tl-spin { to { transform: rotate(360deg); } }

.tl-empty-state {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px;
  border: 1px dashed #d3e1eb;
  border-radius: 18px;
  background: #fff;
  text-align: center;
}

.tl-empty-state[hidden],
.tl-load-more-wrap[hidden],
.tl-loading-overlay[hidden] {
  display: none !important;
}

.tl-empty-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 18px;
  background: #eaf8ff;
  color: #139eea;
  font-size: 23px;
}

.tl-empty-state h3 {
  margin: 0;
  color: var(--tl-ink);
  font-size: 19px;
}

.tl-empty-state p {
  margin: 8px 0 18px;
  color: var(--tl-muted);
  font-size: 13px;
}

.tl-empty-state button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid #cde9f8;
  border-radius: 10px;
  background: #f2fbff;
  color: #168fd5;
  font-weight: 700;
  cursor: pointer;
}

.tl-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 30px 0 4px;
}

.tl-load-more-button {
  min-width: 190px;
}

.tl-preview-modal {
  position: fixed;
  z-index: 2500;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tl-preview-modal.is-open {
  display: flex;
}

.tl-preview-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(7, 17, 31, .72);
  backdrop-filter: blur(5px);
}

.tl-preview-dialog {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 32px 90px rgba(4, 17, 34, .35);
}

.tl-preview-close {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e4ebf1;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  color: #43536a;
  cursor: pointer;
}

.tl-preview-media {
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
  background: #eef3f7;
}

.tl-preview-media img {
  max-width: 100%;
  max-height: 660px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(22, 39, 57, .18);
}

.tl-preview-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 46px 34px 34px;
}

.tl-preview-kicker {
  color: #168fd5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.tl-preview-content h2 {
  margin: 10px 0 0;
  color: var(--tl-ink);
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -.03em;
}

.tl-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  color: #718198;
  font-size: 12px;
}

.tl-preview-content p {
  margin: 22px 0;
  color: #637188;
  font-size: 13px;
  line-height: 1.65;
}

.tl-preview-actions {
  display: grid;
  gap: 10px;
}

.tl-preview-secondary {
  min-height: 45px;
  border: 1px solid #dce7ee;
  border-radius: 12px;
  background: #fff;
  color: #405169;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

html.tl-modal-open {
  overflow: hidden;
}

.tl-use-modal .pg-modal-inner-row {
  max-width: 590px;
}

.tl-use-modal .pg-modal-title-wrap h3 {
  font-size: 21px;
}

/* Dark mode */
html.pg-dark-mode .cvx-library-page {
  --tl-ink: #f5f8fd;
  --tl-text: #c6d3e4;
  --tl-muted: #8fa3bd;
  --tl-line: #2a405a;
  --tl-surface: #111f32;
  --tl-soft: #0c1828;
}


html.pg-dark-mode .tl-card-meta,
html.pg-dark-mode .tl-toolbar-title p,
html.pg-dark-mode .tl-preview-content p,
html.pg-dark-mode .tl-preview-meta {
  color: #91a5bd;
}

html.pg-dark-mode .tl-search-shell,
html.pg-dark-mode .tl-results-panel,
html.pg-dark-mode .tl-platform-chip,
html.pg-dark-mode .tl-select-control,
html.pg-dark-mode .tl-template-card,
html.pg-dark-mode .tl-empty-state,
html.pg-dark-mode .tl-preview-dialog,
html.pg-dark-mode .tl-preview-secondary,
html.pg-dark-mode .tl-mobile-filter-toggle {
  border-color: #29415b;
  background: #111f32;
  color: #c9d6e6;
}

html.pg-dark-mode .tl-search-shell input,
html.pg-dark-mode .tl-select-control select {
  color: #edf5ff !important;
}

html.pg-dark-mode .tl-platform-chip small,
html.pg-dark-mode .tl-search-clear {
  background: #1b3047;
  color: #a9bad0;
}

html.pg-dark-mode .tl-card-image-shell,
html.pg-dark-mode .tl-preview-media {
  background: #0b1726;
}

html.pg-dark-mode .tl-blank-card-preview {
  background: #0c1828;
}

html.pg-dark-mode .tl-blank-plus {
  border-color: #29415b;
  background: #14263a;
  color: #8fa3bd;
}

html.pg-dark-mode .tl-blank-template-card:hover .tl-blank-card-preview,
html.pg-dark-mode .tl-blank-card-trigger:focus-visible .tl-blank-card-preview {
  background: #10283d;
}

html.pg-dark-mode .tl-blank-card-body > span {
  color: #8fa3bd;
}

html.pg-dark-mode .tl-use-button,
html.pg-dark-mode .tl-pro-upgrade-button {
  border-color: #294b67;
  background: #12283d;
  color: #57c3ff !important;
}

html.pg-dark-mode .tl-pro-upgrade-button {
  border-color: #6d5421;
  background: #2a2110;
  color: #ffd778 !important;
}

html.pg-dark-mode .tl-setup-note {
  border-color: #214765;
  background: #0e2437;
  color: #98b2c9;
}

html.pg-dark-mode .tl-loading-overlay {
  background: rgba(8, 20, 34, .86);
}

html.pg-dark-mode .tl-preview-close {
  border-color: #334a63;
  background: #17283b;
  color: #dbe8f5;
}

@media (max-width: 1180px) {
  .tl-template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tl-card-image-shell, .tl-blank-card-preview { height: 210px; }
}

@media (max-width: 900px) {
  .tl-results-panel { padding: 20px; }
  .tl-toolbar { align-items: flex-start; flex-direction: column; }
  .tl-toolbar-title { width: 100%; }
  .tl-toolbar-controls { width: 100%; flex-wrap: wrap; }
  .tl-select-control { flex: 1 1 180px; }
  .tl-select-control select { width: 100%; }
  .tl-template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tl-preview-dialog { grid-template-columns: 1fr; overflow-y: auto; }
  .tl-preview-media { min-height: 340px; }
}

@media (max-width: 640px) {
  .canvix-account-shell.template-library-v1-page main { padding: 18px 14px 55px; }
  .tl-search-area { margin-bottom: 16px; }
  .tl-search-shell { min-height: 54px; padding: 0 14px; border-radius: 13px; }
  .tl-results-panel { padding: 14px; border-radius: 17px; }
  .tl-search-shell input { height: 52px; font-size: 14px; }

  .tl-toolbar {
    width: 100%;
    gap: 0;
    margin-bottom: 14px;
  }

  .tl-toolbar-title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .tl-toolbar-title h2 {
    font-size: 21px;
  }

  .tl-mobile-filter-toggle {
    display: inline-flex;
  }

  .tl-toolbar-controls {
    display: none;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #edf2f6;
  }

  .tl-toolbar-controls.is-mobile-open {
    display: grid;
  }

  .tl-select-control {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    gap: 5px;
    padding: 0 7px;
    border-radius: 9px;
    box-shadow: none;
  }

  .tl-select-control i {
    flex: 0 0 auto;
    font-size: 11px;
  }

  .tl-select-control select,
  .tl-size-control select,
  .tl-category-control select {
    width: 100%;
    min-width: 0;
    height: 36px;
    padding-right: 14px;
    font-size: 11px;
  }

  .tl-sort-control {
    grid-column: 1 / -1;
  }

  .tl-sort-control select {
    font-size: 12px;
  }

  html.pg-dark-mode .tl-toolbar-controls {
    border-top-color: #29415b;
  }

  .tl-template-grid { grid-template-columns: 1fr; gap: 17px; }
  .tl-card-image-shell, .tl-blank-card-preview { height: 245px; }
  .tl-preview-modal { padding: 10px; }
  .tl-preview-dialog { max-height: calc(100vh - 20px); border-radius: 17px; }
  .tl-preview-media { min-height: 280px; padding: 28px 18px; }
  .tl-preview-content { padding: 28px 20px 24px; }
}

/* ------------------------------------------------------------------
   Redesign V3: compact thumbnail-only cards
   ------------------------------------------------------------------ */
.tl-template-grid {
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
}

.tl-template-card {
  border-radius: 13px;
  box-shadow: 0 7px 21px rgba(30, 52, 75, .075);
}

.tl-template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(56, 182, 255, .15), 0 6px 18px rgba(30, 52, 75, .07);
}

.tl-card-preview,
.tl-blank-card-trigger {
  height: 100%;
}

.tl-card-image-shell,
.tl-blank-card-preview {
  height: auto;
  aspect-ratio: 4 / 3;
  min-height: 0;
}

.tl-card-image-shell img {
  object-fit: contain;
}

.tl-card-body,
.tl-blank-card-body {
  display: none !important;
}

.tl-card-overlay {
  background: rgba(8, 25, 44, .28);
}

.tl-preview-pill {
  padding: 8px 12px;
  background: rgba(255, 255, 255, .97);
  color: #168fd5;
  font-size: 12px;
}

.tl-pro-badge {
  top: 8px;
  right: 8px;
  padding: 5px 8px;
  font-size: 9px;
}

.tl-blank-card-preview {
  position: relative;
  flex-direction: column;
  gap: 10px;
}

.tl-blank-plus {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 17px;
}

.tl-blank-label {
  color: #68788d;
  font-size: 12px;
  font-weight: 700;
}

/* With Orientation hidden, Category, Size and Sort form one compact row. */
.tl-toolbar-controls {
  flex-wrap: nowrap;
}

/* Ensure the primary action remains visible over legacy/global anchor styles. */
.tl-preview-actions a.tl-preview-primary,
.tl-preview-actions .tl-preview-primary {
  width: 100% !important;
  min-height: 46px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid var(--tl-blue) !important;
  background: var(--tl-blue) !important;
  color: #fff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.tl-preview-actions a.tl-preview-primary:hover,
.tl-preview-actions .tl-preview-primary:hover {
  border-color: var(--tl-blue-dark) !important;
  background: var(--tl-blue-dark) !important;
  color: #fff !important;
}

.tl-preview-actions .tl-preview-primary span,
.tl-preview-actions .tl-preview-primary i {
  color: inherit !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.tl-preview-actions .tl-preview-primary.tl-is-locked {
  border-color: #f0b429 !important;
  background: #f5a800 !important;
  color: #fff !important;
}

html.pg-dark-mode .tl-blank-label {
  color: #9db0c7;
}

@media (max-width: 900px) {
  .tl-template-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 13px;
  }

  .tl-toolbar-controls {
    flex-wrap: wrap;
  }
}

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

  .tl-toolbar-controls.is-mobile-open {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tl-sort-control {
    grid-column: auto;
  }

  .tl-card-image-shell,
  .tl-blank-card-preview {
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .tl-preview-pill {
    padding: 7px 10px;
    font-size: 11px;
  }

  .tl-blank-plus {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }

  .tl-blank-label {
    font-size: 11px;
  }
}

/* ------------------------------------------------------------------
   Redesign V4: fixed preview action and four-column desktop grid
   ------------------------------------------------------------------ */
.tl-template-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tl-preview-actions button.tl-preview-primary,
.tl-preview-actions #tlPreviewUseButton {
  width: 100% !important;
  min-height: 46px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 18px !important;
  border: 1px solid var(--tl-blue) !important;
  border-radius: 12px !important;
  background: var(--tl-blue) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  opacity: 1 !important;
  visibility: visible !important;
  cursor: pointer !important;
}

.tl-preview-actions button.tl-preview-primary:hover,
.tl-preview-actions #tlPreviewUseButton:hover {
  border-color: var(--tl-blue-dark) !important;
  background: var(--tl-blue-dark) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

.tl-preview-actions #tlPreviewUseButton span {
  display: inline !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.tl-preview-actions #tlPreviewUseButton.tl-is-locked {
  border-color: #f0b429 !important;
  background: #f5a800 !important;
}

.tl-preview-popup-trigger {
  display: none !important;
}

@media (max-width: 900px) {
  .tl-template-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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


/* ------------------------------------------------------------------
   Redesign V5: legacy-style wrapped platform tabs + preview button fix
   ------------------------------------------------------------------ */

/* The preview modal lives outside .cvx-library-page, so give it its own
   design tokens. Without these, var(--tl-blue) resolves as invalid and
   the primary action can fall back to a white legacy button style. */
.tl-preview-modal {
  --tl-blue: #38b6ff;
  --tl-blue-dark: #139eea;
  --tl-ink: #101828;
  --tl-text: #344054;
}

.tl-preview-actions #tlPreviewUseButton,
.tl-preview-actions button.tl-preview-primary {
  border-color: #38b6ff !important;
  background-color: #38b6ff !important;
  background-image: none !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: 0 10px 24px rgba(56, 182, 255, .24) !important;
}

.tl-preview-actions #tlPreviewUseButton:hover,
.tl-preview-actions button.tl-preview-primary:hover {
  border-color: #139eea !important;
  background-color: #139eea !important;
  background-image: none !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.tl-preview-actions #tlPreviewUseButton #tlPreviewUseLabel,
.tl-preview-actions #tlPreviewUseButton span {
  display: inline-block !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.tl-preview-actions #tlPreviewUseButton.tl-is-locked {
  border-color: #f5a800 !important;
  background-color: #f5a800 !important;
  box-shadow: 0 10px 24px rgba(245, 168, 0, .22) !important;
}

/* Restore the friendlier legacy-style platform layout on desktop:
   centered pills, natural wrapping, no horizontal scrollbar. */
@media (min-width: 641px) {
  .tl-platform-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: 12px;
    row-gap: 12px;
    overflow: visible;
    margin: 0 auto 22px;
    padding: 7px 18px 2px;
    scrollbar-width: none;
  }

  .tl-platform-strip::-webkit-scrollbar {
    display: none;
  }

  .tl-platform-chip {
    min-height: 44px;
    padding: 0 17px;
    border-color: #dfe6ed;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(38, 61, 89, .045);
    font-size: 14px;
  }

  .tl-platform-chip:hover {
    border-color: #8fd8ff;
    background: #f5fbff;
    color: #118dcc;
    box-shadow: 0 7px 18px rgba(56, 182, 255, .10);
  }

  .tl-platform-chip.is-active {
    border-color: #38b6ff;
    background: #38b6ff;
    color: #ffffff;
    box-shadow: 0 9px 22px rgba(56, 182, 255, .23);
  }

  .tl-platform-chip.is-active:hover {
    border-color: #139eea;
    background: #139eea;
    color: #ffffff;
  }

  .tl-platform-chip[data-platform="youtube"]:not(.is-active) i { color: #ff0000; }
  .tl-platform-chip[data-platform="instagram"]:not(.is-active) i { color: #e1306c; }
  .tl-platform-chip[data-platform="facebook"]:not(.is-active) i { color: #1877f2; }
  .tl-platform-chip[data-platform="linkedin"]:not(.is-active) i { color: #0a66c2; }
  .tl-platform-chip[data-platform="pinterest"]:not(.is-active) i { color: #e60023; }
  .tl-platform-chip[data-platform="tiktok"]:not(.is-active) i { color: #111111; }
  .tl-platform-chip[data-platform="snapchat"]:not(.is-active) i { color: #f2d600; }
  .tl-platform-chip[data-platform="x"]:not(.is-active) i { color: #111111; }
  .tl-platform-chip[data-platform="ads"]:not(.is-active) i,
  .tl-platform-chip[data-platform="print"]:not(.is-active) i,
  .tl-platform-chip[data-platform="other"]:not(.is-active) i { color: #38b6ff; }
}

/* Preserve the compact one-line swipe navigation on phones so the
   platform list does not push the two-column template grid far down. */
@media (max-width: 640px) {
  .tl-platform-strip {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
  }
}

html.pg-dark-mode .tl-platform-chip[data-platform]:not(.is-active) i {
  color: #9db0c7;
}

/* ------------------------------------------------------------------
   Redesign V6: clearer card separation and featured blank canvas
   ------------------------------------------------------------------ */
.tl-template-card {
  border: 1px solid #dfe7ef;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(16, 24, 40, .035),
    0 7px 20px rgba(30, 52, 75, .085);
}

.tl-template-card:hover {
  border-color: rgba(56, 182, 255, .78);
  box-shadow:
    0 0 0 1px rgba(56, 182, 255, .10),
    0 12px 28px rgba(56, 182, 255, .15),
    0 7px 20px rgba(30, 52, 75, .07);
}

/* Make the always-first blank option feel intentionally different,
   without overpowering the real template thumbnails. */
.tl-blank-template-card {
  border: 2px solid #a9dcf8;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(56, 182, 255, .05),
    0 8px 22px rgba(31, 116, 166, .11);
}

.tl-blank-template-card:hover,
.tl-blank-template-card:focus-within {
  border-color: #38b6ff;
  box-shadow:
    0 0 0 3px rgba(56, 182, 255, .11),
    0 13px 29px rgba(56, 182, 255, .17);
}

.tl-blank-card-preview {
  background: #f0f4f7;
}

html.pg-dark-mode .tl-template-card {
  border-color: #2c425a;
  background: #111f32;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .20),
    0 8px 22px rgba(0, 0, 0, .24);
}

html.pg-dark-mode .tl-template-card:hover {
  border-color: rgba(56, 182, 255, .78);
  box-shadow:
    0 0 0 1px rgba(56, 182, 255, .10),
    0 13px 30px rgba(0, 0, 0, .28);
}

html.pg-dark-mode .tl-blank-template-card {
  border-color: #3f7697;
  background: #111f32;
  box-shadow:
    0 0 0 1px rgba(56, 182, 255, .05),
    0 9px 24px rgba(0, 0, 0, .25);
}

html.pg-dark-mode .tl-blank-template-card:hover,
html.pg-dark-mode .tl-blank-template-card:focus-within {
  border-color: #38b6ff;
  box-shadow:
    0 0 0 3px rgba(56, 182, 255, .12),
    0 14px 30px rgba(0, 0, 0, .30);
}


/* ------------------------------------------------------------------
   Compact Toolbar V1: search integrated beside the filters
   ------------------------------------------------------------------ */
.tl-search-area {
  display: none !important;
}

.tl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 18px;
}

.tl-toolbar-search {
  min-width: 240px;
  flex: 1 1 360px;
}

.tl-toolbar .tl-search-shell {
  width: 100%;
  min-height: 44px;
  gap: 9px;
  padding: 0 12px;
  border-radius: 12px;
  box-shadow: 0 5px 16px rgba(38, 61, 89, .045);
}

.tl-toolbar .tl-search-shell > i {
  flex: 0 0 auto;
  font-size: 15px;
}

.tl-toolbar .tl-search-shell input {
  width: 100%;
  min-width: 0;
  height: 42px;
  font-size: 13px;
}

.tl-toolbar .tl-search-clear {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
}

.tl-toolbar-controls {
  width: auto;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.tl-toolbar .tl-select-control {
  min-height: 44px;
}

.tl-toolbar .tl-category-control select {
  min-width: 150px;
}

.tl-toolbar .tl-size-control select {
  min-width: 135px;
}

.tl-toolbar .tl-sort-control select {
  min-width: 110px;
}

html.pg-dark-mode .tl-toolbar .tl-search-shell {
  border-color: #29415b;
  background: #111f32;
  color: #c9d6e6;
}

html.pg-dark-mode .tl-toolbar .tl-search-shell input {
  color: #edf5ff !important;
}

html.pg-dark-mode .tl-toolbar .tl-search-shell input::placeholder {
  color: #8298b3;
}

@media (max-width: 1080px) {
  .tl-toolbar {
    flex-wrap: wrap;
  }

  .tl-toolbar-search {
    width: 100%;
    flex-basis: 100%;
  }

  .tl-toolbar-controls {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 900px) {
  .tl-toolbar {
    flex-direction: row;
    align-items: center;
  }

  .tl-toolbar-controls {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .tl-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
    margin-bottom: 14px;
  }

  .tl-toolbar-search {
    width: auto;
    min-width: 0;
    grid-column: 1;
  }

  .tl-toolbar .tl-search-shell {
    min-height: 42px;
    padding: 0 10px;
    border-radius: 10px;
  }

  .tl-toolbar .tl-search-shell input {
    height: 40px;
    font-size: 12px;
  }

  .tl-toolbar .tl-search-shell > i {
    font-size: 13px;
  }

  .tl-mobile-filter-toggle {
    grid-column: 2;
    min-height: 42px;
    align-self: stretch;
  }

  .tl-toolbar-controls {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 0;
  }

  .tl-toolbar-controls.is-mobile-open {
    display: grid;
  }
}

/* ==================================================================
   Template Library Redesign V1
   Premium discovery layout based on the approved prototype.
   ================================================================== */
.canvix-account-shell.template-library-v1-page main {
  padding-top: 24px;
}

.cvx-library-page {
  --tl-blue: #1677ff;
  --tl-blue-dark: #0b61db;
  --tl-ink: #101828;
  --tl-text: #344054;
  --tl-muted: #718096;
  --tl-line: #e2e8f0;
  --tl-surface: #ffffff;
  --tl-soft: #f7f9fc;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}

.tl-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.tl-page-heading > div:first-child {
  min-width: 0;
}

.tl-page-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--tl-blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.tl-page-heading h1 {
  margin: 0;
  color: var(--tl-ink);
  font-size: clamp(25px, 2vw, 32px);
  line-height: 1.12;
  letter-spacing: -.035em;
}

.tl-page-heading p {
  margin: 7px 0 0;
  color: var(--tl-muted);
  font-size: 13px;
  line-height: 1.5;
}

.tl-page-count {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid #dfe8f1;
  border-radius: 12px;
  background: #ffffff;
  color: #7b899d;
  font-size: 11px;
}

.tl-page-count strong {
  color: #1d2939;
  font-size: 15px;
}

.tl-platform-panel,
.tl-toolbar-panel {
  border: 1px solid #e3e9f0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 25px rgba(16, 24, 40, .045);
}

.tl-platform-panel {
  margin-bottom: 16px;
  padding: 16px;
}

.tl-platform-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.tl-platform-chip {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid #e0e7ef;
  border-radius: 12px;
  background: #ffffff;
  color: #344054;
  box-shadow: none;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  transform: none;
}

.tl-platform-chip:hover {
  border-color: #a9d4ff;
  background: #f8fbff;
  color: #176bc5;
  transform: none;
}

.tl-platform-chip i {
  width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.tl-platform-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-platform-chip small {
  min-width: 30px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #718096;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.tl-platform-chip.is-active,
.tl-platform-chip.is-active:hover {
  border-color: var(--tl-blue);
  background: #f4f8ff;
  color: #0b67d6;
  box-shadow: inset 0 0 0 1px rgba(22, 119, 255, .08);
}

.tl-platform-chip.is-active i {
  color: var(--tl-blue);
}

.tl-platform-chip.is-active small {
  background: #e6f1ff;
  color: #126bd0;
}

.tl-results-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tl-toolbar-panel {
  margin-bottom: 18px;
  padding: 12px;
}

.tl-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.45fr) minmax(0, 2.65fr);
  align-items: center;
  gap: 12px;
  margin: 0;
}

.tl-toolbar-search {
  min-width: 0;
  width: 100%;
}

.tl-toolbar .tl-search-shell,
.tl-toolbar .tl-select-control {
  min-height: 48px;
  border: 1px solid #dfe7ef;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: none;
}

.tl-toolbar .tl-search-shell {
  gap: 10px;
  padding: 0 13px;
}

.tl-toolbar .tl-search-shell:focus-within,
.tl-toolbar .tl-select-control:focus-within {
  border-color: #82b9ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .08);
}

.tl-toolbar .tl-search-shell > i {
  color: #63758c;
  font-size: 15px;
}

.tl-toolbar .tl-search-shell input {
  height: 46px;
  font-size: 13px;
}

.tl-search-shortcut {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 7px;
  background: #f3f6f9;
  color: #76869a;
  font-size: 10px;
  font-weight: 700;
}

.tl-toolbar-controls {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .95fr);
  gap: 10px;
}

.tl-toolbar .tl-select-control {
  width: 100%;
  min-width: 0;
  padding: 0 13px;
}

.tl-toolbar .tl-select-control i {
  color: #52657c;
  font-size: 14px;
}

.tl-toolbar .tl-select-control select,
.tl-toolbar .tl-category-control select,
.tl-toolbar .tl-size-control select,
.tl-toolbar .tl-sort-control select {
  width: 100%;
  min-width: 0;
  height: 46px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.tl-mobile-filter-toggle {
  min-height: 48px;
  box-shadow: none;
}

.tl-setup-note {
  margin: 0 0 16px;
}

.tl-grid-wrap {
  min-height: 340px;
}

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

.tl-template-results {
  display: contents;
}

.tl-template-card,
.tl-blank-template-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dfe6ee;
  border-radius: 15px;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(16, 24, 40, .055);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.tl-template-card:hover,
.tl-template-card:focus-within,
.tl-blank-template-card:hover,
.tl-blank-template-card:focus-within {
  transform: translateY(-2px);
  border-color: #8ac2ff;
  box-shadow: 0 10px 25px rgba(16, 83, 158, .12);
}

.tl-card-preview,
.tl-blank-card-trigger {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.tl-card-image-shell,
.tl-blank-card-preview {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #eef2f6;
}

.tl-card-image-shell img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: none;
  transition: transform .25s ease;
}

.tl-card-orientation-portrait .tl-card-image-shell img,
.tl-card-orientation-square .tl-card-image-shell img {
  object-fit: contain;
  padding: 8px;
}

.tl-template-card:hover .tl-card-image-shell img {
  transform: scale(1.018);
}

.tl-card-overlay {
  background: rgba(8, 22, 39, .28);
}

.tl-preview-pill {
  padding: 8px 12px;
  background: rgba(255, 255, 255, .96);
  color: #126bd0;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .16);
  font-size: 11px;
}

.tl-card-body,
.tl-blank-card-body {
  flex: 1 1 auto;
  display: block !important;
  padding: 12px 13px 13px;
}

.tl-card-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.tl-card-heading-row strong,
.tl-card-heading-row h3 {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  color: #1d2939;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-card-more {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  color: #7c8b9f;
}

.tl-card-meta {
  margin-top: 8px;
  color: #7a899e;
  font-size: 10.5px;
}

.tl-card-meta-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tl-card-meta-split > span {
  min-width: 0;
}

.tl-card-platform {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.tl-card-platform > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-card-platform i {
  flex: 0 0 auto;
  color: #64748b;
}

.tl-card-platform-youtube i { color: #ff0000; }
.tl-card-platform-instagram i { color: #e1306c; }
.tl-card-platform-facebook i { color: #1877f2; }
.tl-card-platform-linkedin i { color: #0a66c2; }
.tl-card-platform-pinterest i { color: #e60023; }
.tl-card-platform-x i { color: #111111; }
.tl-card-platform-tiktok i { color: #111111; }
.tl-card-platform-ads i,
.tl-card-platform-other i,
.tl-card-platform-print i { color: #168fd5; }

.tl-card-size {
  flex: 0 0 auto;
  color: #8a98aa;
  white-space: nowrap;
}

.tl-pro-badge {
  top: 9px;
  right: 9px;
  padding: 5px 8px;
  box-shadow: 0 5px 14px rgba(91, 66, 12, .10);
}

.tl-blank-template-card {
  border-style: dashed;
  border-width: 1.5px;
  border-color: #82b9ff;
  box-shadow: none;
}

.tl-blank-card-preview {
  background: linear-gradient(145deg, #f8fbff, #f1f6fc);
}

.tl-blank-plus {
  width: 52px;
  height: 52px;
  border: 1px solid #b9d8fb;
  border-radius: 50%;
  background: #ffffff;
  color: var(--tl-blue);
  box-shadow: 0 7px 18px rgba(20, 92, 171, .10);
  font-size: 18px;
}

.tl-blank-template-card:hover .tl-blank-plus,
.tl-blank-card-trigger:focus-visible .tl-blank-plus {
  transform: translateY(-2px);
  border-color: var(--tl-blue);
  background: #ffffff;
}

.tl-load-more-wrap {
  margin-top: 24px;
}

.tl-load-more-button {
  min-width: 190px;
  box-shadow: none;
}

.tl-loading-overlay {
  border-radius: 16px;
  background: rgba(247, 250, 253, .88);
}

/* Dark mode */
html.pg-dark-mode .cvx-library-page {
  --tl-ink: #f2f6fb;
  --tl-text: #d4deea;
  --tl-muted: #91a2b8;
  --tl-line: #2c3d50;
  --tl-surface: #111c2a;
  --tl-soft: #0f1926;
}

html.pg-dark-mode .tl-page-heading h1,
html.pg-dark-mode .tl-card-heading-row strong,
html.pg-dark-mode .tl-card-heading-row h3 {
  color: #f4f8fc;
}

html.pg-dark-mode .tl-page-heading p,
html.pg-dark-mode .tl-page-count,
html.pg-dark-mode .tl-card-meta,
html.pg-dark-mode .tl-card-size {
  color: #93a5ba;
}

html.pg-dark-mode .tl-page-count,
html.pg-dark-mode .tl-platform-panel,
html.pg-dark-mode .tl-toolbar-panel,
html.pg-dark-mode .tl-template-card,
html.pg-dark-mode .tl-blank-template-card {
  border-color: #2a3b4f;
  background: #111c2a;
  box-shadow: none;
}

html.pg-dark-mode .tl-page-count strong {
  color: #edf4fc;
}

html.pg-dark-mode .tl-platform-chip,
html.pg-dark-mode .tl-toolbar .tl-search-shell,
html.pg-dark-mode .tl-toolbar .tl-select-control {
  border-color: #2b4057;
  background: #142235;
  color: #d8e2ee;
  box-shadow: none;
}

html.pg-dark-mode .tl-platform-chip:hover {
  border-color: #426987;
  background: #182a40;
  color: #f1f6fb;
}

html.pg-dark-mode .tl-platform-chip small,
html.pg-dark-mode .tl-search-shortcut {
  background: #203249;
  color: #a6b6c8;
}

html.pg-dark-mode .tl-platform-chip.is-active,
html.pg-dark-mode .tl-platform-chip.is-active:hover {
  border-color: #38b6ff;
  background: #123454;
  color: #76caff;
  box-shadow: inset 0 0 0 1px rgba(56, 182, 255, .08);
}

html.pg-dark-mode .tl-platform-chip.is-active small {
  background: #1d496e;
  color: #b8e4ff;
}

html.pg-dark-mode .tl-toolbar .tl-search-shell input,
html.pg-dark-mode .tl-toolbar .tl-select-control select {
  color: #eef5fc !important;
}

html.pg-dark-mode .tl-toolbar .tl-search-shell input::placeholder {
  color: #8093aa;
}

html.pg-dark-mode .tl-toolbar .tl-search-shell > i,
html.pg-dark-mode .tl-toolbar .tl-select-control i {
  color: #8fa4bc;
}

html.pg-dark-mode .tl-template-card:hover,
html.pg-dark-mode .tl-template-card:focus-within,
html.pg-dark-mode .tl-blank-template-card:hover,
html.pg-dark-mode .tl-blank-template-card:focus-within {
  border-color: #38b6ff;
  background: #132236;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .20);
}

html.pg-dark-mode .tl-card-image-shell,
html.pg-dark-mode .tl-blank-card-preview {
  background: #0d1723;
}

html.pg-dark-mode .tl-blank-card-preview {
  background: linear-gradient(145deg, #101d2c, #0d1723);
}

html.pg-dark-mode .tl-blank-plus {
  border-color: #385a79;
  background: #14263a;
  color: #56c1ff;
  box-shadow: none;
}

html.pg-dark-mode .tl-card-platform-x i,
html.pg-dark-mode .tl-card-platform-tiktok i {
  color: #d5e0ec;
}

html.pg-dark-mode .tl-card-more {
  color: #879bb2;
}

html.pg-dark-mode .tl-loading-overlay {
  background: rgba(10, 19, 29, .86);
}

@media (max-width: 1280px) {
  .tl-platform-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tl-template-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .tl-toolbar {
    grid-template-columns: 1fr;
  }

  .tl-toolbar-controls {
    width: 100%;
  }

  .tl-template-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .tl-page-heading {
    align-items: flex-start;
  }

  .tl-page-count {
    display: none;
  }

  .tl-platform-strip {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .tl-platform-chip {
    width: 190px;
    flex: 0 0 190px;
  }

  .tl-template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .canvix-account-shell.template-library-v1-page main {
    padding-top: 16px;
  }

  .tl-page-heading {
    margin-bottom: 14px;
  }

  .tl-page-eyebrow {
    display: none;
  }

  .tl-page-heading h1 {
    font-size: 24px;
  }

  .tl-page-heading p {
    font-size: 12px;
  }

  .tl-platform-panel,
  .tl-toolbar-panel {
    border-radius: 14px;
  }

  .tl-platform-panel {
    padding: 11px;
  }

  .tl-platform-chip {
    width: 170px;
    flex-basis: 170px;
    min-height: 44px;
    padding: 0 11px;
  }

  .tl-toolbar-panel {
    padding: 10px;
  }

  .tl-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
  }

  .tl-toolbar-search {
    grid-column: 1;
  }

  .tl-search-shortcut {
    display: none;
  }

  .tl-mobile-filter-toggle {
    display: inline-flex;
    grid-column: 2;
    min-height: 48px;
  }

  .tl-toolbar-controls {
    grid-column: 1 / -1;
    display: none;
    grid-template-columns: 1fr;
  }

  .tl-toolbar-controls.is-mobile-open {
    display: grid;
  }

  .tl-template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .tl-card-body,
  .tl-blank-card-body {
    padding: 10px;
  }

  .tl-card-heading-row strong,
  .tl-card-heading-row h3 {
    font-size: 12px;
  }

  .tl-card-meta {
    font-size: 9.5px;
  }

  .tl-card-size {
    display: none;
  }

  .tl-card-platform > span {
    max-width: 120px;
  }
}


/* ==================================================================
   Template Library Redesign V2
   Circular platform selector + unified discovery card.
   ================================================================== */
.canvix-account-shell.template-library-v1-page main {
  padding-top: 22px;
}

.tl-page-heading {
  align-items: center;
  margin-bottom: 12px;
}

.tl-page-heading h1 {
  font-size: clamp(26px, 2vw, 32px);
}

.tl-create-template-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--tl-blue);
  color: #fff;
  box-shadow: 0 8px 20px rgba(22, 119, 255, .18);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.tl-create-template-button:hover,
.tl-create-template-button:focus-visible {
  background: var(--tl-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(22, 119, 255, .22);
}

.tl-platform-panel {
  margin: 0 0 14px;
  padding: 4px 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tl-platform-strip {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: clamp(13px, 1.35vw, 22px);
  overflow-x: auto;
  margin: 0;
  padding: 2px 3px 8px;
  scrollbar-width: thin;
}

.tl-platform-chip,
.tl-platform-chip:hover,
.tl-platform-chip.is-active,
.tl-platform-chip.is-active:hover {
  width: 88px;
  min-width: 88px;
  min-height: auto;
  flex: 0 0 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #475467;
  text-align: center;
  transform: none;
}

.tl-platform-chip:hover,
.tl-platform-chip:focus-visible {
  color: var(--tl-blue);
}

.tl-platform-icon-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e1e8f0;
  border-radius: 50%;
  background: #fff;
  color: #52657a;
  box-shadow: 0 5px 14px rgba(16, 24, 40, .06);
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.tl-platform-icon-wrap i,
.tl-platform-chip i {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-size: 20px;
}

.tl-platform-chip:hover .tl-platform-icon-wrap,
.tl-platform-chip:focus-visible .tl-platform-icon-wrap {
  transform: translateY(-2px);
  border-color: #9ac9ff;
  box-shadow: 0 8px 18px rgba(22, 119, 255, .12);
}

.tl-platform-chip.is-active .tl-platform-icon-wrap,
.tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
  border-color: var(--tl-blue);
  background: var(--tl-blue);
  color: #fff;
  box-shadow: 0 8px 20px rgba(22, 119, 255, .22);
}

.tl-platform-name,
.tl-platform-chip span.tl-platform-name {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-platform-chip.is-active .tl-platform-name {
  color: var(--tl-blue);
  font-weight: 750;
}

.tl-platform-icon-wrap small,
.tl-platform-chip small,
.tl-platform-chip.is-active small {
  position: absolute;
  top: -5px;
  right: -8px;
  min-width: 22px;
  max-width: 42px;
  padding: 2px 5px;
  overflow: hidden;
  border: 2px solid #f7f9fc;
  border-radius: 999px;
  background: #eef3f8;
  color: #68778b;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.tl-platform-chip.is-active .tl-platform-icon-wrap small {
  background: #e8f2ff;
  color: #126bd0;
}

.tl-results-panel {
  padding: 14px;
  border: 1px solid #e3e9f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(16, 24, 40, .045);
}

.tl-toolbar-panel {
  margin: 0 0 14px;
  padding: 0 0 14px;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tl-template-grid {
  gap: 14px;
}

html.pg-dark-mode .tl-create-template-button {
  background: #159fea;
  color: #fff;
  box-shadow: none;
}

html.pg-dark-mode .tl-platform-panel {
  border: 0;
  background: transparent;
}

html.pg-dark-mode .tl-platform-chip,
html.pg-dark-mode .tl-platform-chip:hover,
html.pg-dark-mode .tl-platform-chip.is-active,
html.pg-dark-mode .tl-platform-chip.is-active:hover {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #aebdce;
}

html.pg-dark-mode .tl-platform-icon-wrap {
  border-color: #2b4057;
  background: #142235;
  color: #aebdce;
  box-shadow: none;
}

html.pg-dark-mode .tl-platform-chip:hover .tl-platform-icon-wrap {
  border-color: #41729a;
  background: #182a40;
  color: #e5eef8;
}

html.pg-dark-mode .tl-platform-chip.is-active .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
  border-color: #38b6ff;
  background: #159fea;
  color: #fff;
  box-shadow: none;
}

html.pg-dark-mode .tl-platform-chip.is-active .tl-platform-name {
  color: #6dcaff;
}

html.pg-dark-mode .tl-platform-icon-wrap small,
html.pg-dark-mode .tl-platform-chip small,
html.pg-dark-mode .tl-platform-chip.is-active small {
  border-color: #0f1926;
  background: #21344c;
  color: #a9bacd;
}

html.pg-dark-mode .tl-results-panel {
  border-color: #2a3b4f;
  background: #111c2a;
  box-shadow: none;
}

html.pg-dark-mode .tl-toolbar-panel {
  border-bottom-color: #26384b;
  background: transparent;
}

@media (max-width: 900px) {
  .tl-platform-strip {
    flex-wrap: nowrap;
  }

  .tl-platform-chip,
  .tl-platform-chip:hover,
  .tl-platform-chip.is-active,
  .tl-platform-chip.is-active:hover {
    width: 82px;
    min-width: 82px;
    flex-basis: 82px;
  }
}

@media (max-width: 640px) {
  .tl-page-heading {
    gap: 12px;
    margin-bottom: 10px;
  }

  .tl-page-heading h1 {
    font-size: 24px;
  }

  .tl-create-template-button {
    min-height: 40px;
    padding: 0 13px;
  }

  .tl-create-template-button span {
    display: none;
  }

  .tl-create-template-button i {
    font-size: 15px;
  }

  .tl-platform-panel {
    padding-bottom: 7px;
  }

  .tl-platform-strip {
    gap: 10px;
  }

  .tl-platform-chip,
  .tl-platform-chip:hover,
  .tl-platform-chip.is-active,
  .tl-platform-chip.is-active:hover {
    width: 72px;
    min-width: 72px;
    flex-basis: 72px;
  }

  .tl-platform-icon-wrap {
    width: 50px;
    height: 50px;
  }

  .tl-platform-icon-wrap i,
  .tl-platform-chip i {
    font-size: 18px;
  }

  .tl-platform-name,
  .tl-platform-chip span.tl-platform-name {
    font-size: 10px;
  }

  .tl-results-panel {
    padding: 10px;
    border-radius: 14px;
  }

  .tl-toolbar-panel {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }
}


/* ==================================================================
   Template Library Redesign V3
   Brand-coloured platform launchers + refined create action.
   ================================================================== */
.tl-create-template-button {
  min-height: 46px;
  gap: 10px;
  padding: 0 18px 0 10px;
  border: 1px solid #1677ff;
  border-radius: 14px;
  background: linear-gradient(135deg, #1677ff 0%, #2caeff 100%);
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(22, 119, 255, .16);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.tl-create-template-button span,
.tl-create-template-button i {
  color: inherit !important;
}

.tl-create-template-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  border-radius: 10px;
  background: rgba(255,255,255,.18);
  font-size: 12px;
}

.tl-create-template-button:hover,
.tl-create-template-button:focus-visible {
  border-color: #0868e5;
  background: linear-gradient(135deg, #086de8 0%, #169fe9 100%);
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(22, 119, 255, .2);
}

.tl-platform-chip {
  --platform-color: #1677ff;
  --platform-soft: #edf5ff;
}

.tl-platform-chip[data-platform="youtube"] { --platform-color:#ff0033; --platform-soft:#fff0f3; }
.tl-platform-chip[data-platform="instagram"] { --platform-color:#e1306c; --platform-soft:#fff0f7; }
.tl-platform-chip[data-platform="facebook"] { --platform-color:#1877f2; --platform-soft:#edf5ff; }
.tl-platform-chip[data-platform="ads"] { --platform-color:#2f9cf4; --platform-soft:#edf8ff; }
.tl-platform-chip[data-platform="linkedin"] { --platform-color:#0a66c2; --platform-soft:#edf6fc; }
.tl-platform-chip[data-platform="pinterest"] { --platform-color:#e60023; --platform-soft:#fff0f2; }
.tl-platform-chip[data-platform="x"],
.tl-platform-chip[data-platform="twitter"] { --platform-color:#111827; --platform-soft:#eef1f5; }
.tl-platform-chip[data-platform="other"] { --platform-color:#239ee8; --platform-soft:#edf8ff; }

.tl-platform-icon-wrap,
.tl-platform-chip:hover .tl-platform-icon-wrap,
.tl-platform-chip:focus-visible .tl-platform-icon-wrap,
.tl-platform-chip.is-active .tl-platform-icon-wrap,
.tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
  width: 58px;
  height: 58px;
  border: 1px solid color-mix(in srgb, var(--platform-color) 18%, #dfe7ef);
  background: var(--platform-soft);
  color: var(--platform-color);
  box-shadow: 0 6px 15px rgba(16, 24, 40, .055);
}

.tl-platform-icon-wrap i,
.tl-platform-chip i {
  color: var(--platform-color) !important;
  font-size: 21px;
}

.tl-platform-chip:hover .tl-platform-icon-wrap,
.tl-platform-chip:focus-visible .tl-platform-icon-wrap {
  transform: translateY(-2px) scale(1.025);
  border-color: color-mix(in srgb, var(--platform-color) 48%, #ffffff);
  box-shadow: 0 9px 19px color-mix(in srgb, var(--platform-color) 13%, transparent);
}

.tl-platform-chip.is-active .tl-platform-icon-wrap,
.tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
  border-color: var(--platform-color);
  background: var(--platform-soft);
  color: var(--platform-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--platform-color) 14%, transparent), 0 8px 18px rgba(16,24,40,.08);
}

.tl-platform-chip.is-active .tl-platform-name {
  color: var(--platform-color);
  font-weight: 750;
}

/* Counts were visually colliding with the circular launcher edge. Keep them
   accessible in each button's title/ARIA label instead of drawing badges. */
.tl-platform-icon-wrap small,
.tl-platform-chip small,
.tl-platform-chip.is-active small {
  display: none !important;
}

html.pg-dark-mode .tl-create-template-button,
html.pg-dark-mode .tl-create-template-button:hover,
html.pg-dark-mode .tl-create-template-button:focus-visible {
  border-color: #38b6ff;
  background: linear-gradient(135deg, #168fe0 0%, #38b6ff 100%);
  color: #fff !important;
  box-shadow: none;
}

html.pg-dark-mode .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip:hover .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip:focus-visible .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip.is-active .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
  border-color: color-mix(in srgb, var(--platform-color) 42%, #26384b);
  background: color-mix(in srgb, var(--platform-color) 12%, #111c2a);
  color: var(--platform-color);
  box-shadow: none;
}

html.pg-dark-mode .tl-platform-icon-wrap i,
html.pg-dark-mode .tl-platform-chip i {
  color: var(--platform-color) !important;
}

html.pg-dark-mode .tl-platform-chip.is-active .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--platform-color) 18%, transparent);
}

@supports not (color: color-mix(in srgb, red, blue)) {
  .tl-platform-icon-wrap,
  .tl-platform-chip:hover .tl-platform-icon-wrap,
  .tl-platform-chip:focus-visible .tl-platform-icon-wrap,
  .tl-platform-chip.is-active .tl-platform-icon-wrap,
  .tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
    border-color: #dce6ef;
  }
}

@media (max-width: 640px) {
  .tl-create-template-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }

  .tl-create-template-icon {
    width: 30px;
    height: 30px;
  }
}


/* ==================================================================
   Template Library Redesign V4
   Solid platform launchers + flat Canvix create action.
   ================================================================== */
.tl-create-template-button,
.tl-create-template-button:hover,
.tl-create-template-button:focus-visible {
  min-height: 44px;
  padding: 0 17px 0 11px;
  border: 1px solid #38b6ff;
  border-radius: 12px;
  background: #38b6ff;
  color: #fff !important;
  box-shadow: none;
  transform: none;
}

.tl-create-template-button:hover,
.tl-create-template-button:focus-visible {
  border-color: #1aa8f3;
  background: #1aa8f3;
}

.tl-create-template-icon {
  background: rgba(255,255,255,.18);
  color: #fff !important;
}

.tl-platform-chip {
  --platform-color: #38b6ff;
  --platform-active-ring: rgba(56,182,255,.22);
}

.tl-platform-chip[data-platform="youtube"] {
  --platform-color: #ff0033;
  --platform-active-ring: rgba(255,0,51,.19);
}
.tl-platform-chip[data-platform="instagram"] {
  --platform-color: #e1306c;
  --platform-active-ring: rgba(225,48,108,.19);
}
.tl-platform-chip[data-platform="facebook"] {
  --platform-color: #1877f2;
  --platform-active-ring: rgba(24,119,242,.19);
}
.tl-platform-chip[data-platform="ads"] {
  --platform-color: #2f9cf4;
  --platform-active-ring: rgba(47,156,244,.19);
}
.tl-platform-chip[data-platform="linkedin"] {
  --platform-color: #0a66c2;
  --platform-active-ring: rgba(10,102,194,.19);
}
.tl-platform-chip[data-platform="pinterest"] {
  --platform-color: #e60023;
  --platform-active-ring: rgba(230,0,35,.19);
}
.tl-platform-chip[data-platform="x"],
.tl-platform-chip[data-platform="twitter"] {
  --platform-color: #111827;
  --platform-active-ring: rgba(17,24,39,.18);
}
.tl-platform-chip[data-platform="other"] {
  --platform-color: #7c5cff;
  --platform-active-ring: rgba(124,92,255,.19);
}

.tl-platform-icon-wrap,
.tl-platform-chip:hover .tl-platform-icon-wrap,
.tl-platform-chip:focus-visible .tl-platform-icon-wrap,
.tl-platform-chip.is-active .tl-platform-icon-wrap,
.tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
  border-color: var(--platform-color);
  background: var(--platform-color);
  color: #fff;
  box-shadow: none;
}

.tl-platform-icon-wrap i,
.tl-platform-chip i,
.tl-platform-chip:hover .tl-platform-icon-wrap i,
.tl-platform-chip:focus-visible .tl-platform-icon-wrap i,
.tl-platform-chip.is-active .tl-platform-icon-wrap i {
  color: #fff !important;
}

.tl-platform-chip:hover .tl-platform-icon-wrap,
.tl-platform-chip:focus-visible .tl-platform-icon-wrap {
  transform: translateY(-2px);
  filter: brightness(.96);
  box-shadow: 0 7px 15px rgba(15,23,42,.12);
}

.tl-platform-chip.is-active .tl-platform-icon-wrap,
.tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
  background: var(--platform-color);
  color: #fff;
  box-shadow: 0 0 0 4px var(--platform-active-ring);
  filter: none;
}

.tl-platform-chip .tl-platform-name,
.tl-platform-chip.is-active .tl-platform-name {
  color: #344054;
  font-weight: 650;
}

.tl-platform-chip.is-active .tl-platform-name {
  color: var(--platform-color);
  font-weight: 750;
}

html.pg-dark-mode .tl-create-template-button,
html.pg-dark-mode .tl-create-template-button:hover,
html.pg-dark-mode .tl-create-template-button:focus-visible {
  border-color: #38b6ff;
  background: #38b6ff;
  color: #fff !important;
  box-shadow: none;
}

html.pg-dark-mode .tl-create-template-button:hover,
html.pg-dark-mode .tl-create-template-button:focus-visible {
  border-color: #1aa8f3;
  background: #1aa8f3;
}

html.pg-dark-mode .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip:hover .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip:focus-visible .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip.is-active .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip.is-active:hover .tl-platform-icon-wrap {
  border-color: var(--platform-color);
  background: var(--platform-color);
  color: #fff;
}

html.pg-dark-mode .tl-platform-icon-wrap i,
html.pg-dark-mode .tl-platform-chip i,
html.pg-dark-mode .tl-platform-chip:hover .tl-platform-icon-wrap i,
html.pg-dark-mode .tl-platform-chip:focus-visible .tl-platform-icon-wrap i,
html.pg-dark-mode .tl-platform-chip.is-active .tl-platform-icon-wrap i {
  color: #fff !important;
}

html.pg-dark-mode .tl-platform-chip .tl-platform-name {
  color: #c6d3e1;
}

html.pg-dark-mode .tl-platform-chip.is-active .tl-platform-name {
  color: #7fd0ff;
}


/* ==================================================================
   Template Library Redesign V5
   Final platform launcher polish: reliable X glyph, softer active ring,
   and restrained hover motion for a cleaner premium finish.
   ================================================================== */
.tl-platform-chip {
  transition: color .16s ease;
}

.tl-platform-icon-wrap {
  width: 58px;
  height: 58px;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}

.tl-platform-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  line-height: 1;
  font-weight: 800;
  pointer-events: none;
}

.tl-platform-glyph-x {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  letter-spacing: -.04em;
}

.tl-platform-chip:hover .tl-platform-icon-wrap,
.tl-platform-chip:focus-visible .tl-platform-icon-wrap {
  transform: translateY(-1px);
  filter: brightness(.97);
  box-shadow: 0 5px 11px rgba(15, 23, 42, .09);
}

.tl-platform-chip.is-active .tl-platform-icon-wrap,
.tl-platform-chip.is-active:hover .tl-platform-icon-wrap,
.tl-platform-chip.is-active:focus-visible .tl-platform-icon-wrap {
  transform: none;
  filter: none;
  box-shadow: 0 0 0 2px var(--platform-active-ring);
}

.tl-platform-chip.is-active .tl-platform-name {
  font-weight: 700;
}

html.pg-dark-mode .tl-platform-glyph {
  color: #fff !important;
}

html.pg-dark-mode .tl-platform-chip.is-active .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip.is-active:hover .tl-platform-icon-wrap,
html.pg-dark-mode .tl-platform-chip.is-active:focus-visible .tl-platform-icon-wrap {
  box-shadow: 0 0 0 2px var(--platform-active-ring);
}
