/* generation_template_detail.html: moved inline styles from template */
.yookassa-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  border: none;
  max-width: 92vw;
  width: min(420px, calc(100svw - 32px));
  max-height: min(90dvh, calc(100vh - 32px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: transparent;
  box-shadow: none;
  color: #1e293b;
}

.yookassa-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.yookassa-dialog-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 20px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(59, 0, 49, 0.18);
}

.yookassa-dialog-inner [hidden] {
  display: none !important;
}

.yookassa-dialog-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
  z-index: 2;
}

.yookassa-dialog-title {
  margin: 0 28px 8px 0;
  font-size: 18px;
  font-weight: 700;
  color: #3b0031;
  flex-shrink: 0;
}

.yookassa-dialog-hint {
  margin: 0 0 12px 0;
  color: #475569;
  font-size: 14px;
  flex-shrink: 0;
}

.yookassa-dialog-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.yookassa-modal-option {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid #b230cc;
  border-radius: 12px;
  background: #b230cc;
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.yookassa-modal-option:hover {
  background: #9a1fb3;
  border-color: #9a1fb3;
}

.yookassa-dialog-shortage-lead {
  margin: 0 28px 6px 0;
  font-size: 18px;
  font-weight: 700;
  color: #3b0031;
  line-height: 1.3;
  flex-shrink: 0;
}

.yookassa-dialog-shortage-balance {
  margin: 0 28px 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #475569;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.yookassa-dialog-shortage-balance .template-neuron-icon {
  vertical-align: middle;
  flex-shrink: 0;
}

#template-neuron-dialog-heading-standard,
#template-neuron-dialog-heading-shortage {
  flex-shrink: 0;
}

#template-prompt-override {
  min-height: 44px;
  max-height: clamp(220px, 38vh, 360px);
  overflow-y: auto;
  resize: vertical;
  scrollbar-width: thin;
  scrollbar-color: rgb(107 52 166) rgba(255, 255, 255, 0.08);
}

.template-prompt-override-chip {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09) 0%, rgba(20, 22, 48, 0.72) 100%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  padding: 10px 12px;
}

.template-prompt-override-chip:focus {
  outline: none;
  border-color: rgba(178, 48, 204, 0.85);
  box-shadow: 0 0 0 2px rgba(178, 48, 204, 0.2), 0 4px 18px rgba(0, 0, 0, 0.22);
}

#template-prompt-override::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#template-prompt-override::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

#template-prompt-override::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(172, 75, 255, 0.92), rgba(124, 58, 237, 0.92));
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.08);
}

#template-prompt-override::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(186, 95, 255, 0.98), rgba(139, 92, 246, 0.98));
}

.template-prompt-editor {
  margin-bottom: 5px;
}

.template-prompt-editor__toggle {
  margin: 0;
}

.template-prompt-editor__panel {
  margin-top: 0;
  display: grid;
  gap: 9px;
}

.template-prompt-editor__panel > * {
  margin: 0;
}
.templates-page,
.template-detail-page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 80px) calc(clamp(80px, 11vh, 120px) + clamp(25px, 3.5vh, 40px));
}

/* Деталь шаблона: без «листа страницы вправо в пустоту» из‑за ширины ленты похожих */
.template-detail-page {
  width: 100%;
  max-width: min(1440px, 100%);
  box-sizing: border-box;
  overflow-x: clip;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.templates-page[data-user-id]:not([data-user-id=""]) {
  padding-bottom: calc(clamp(92px, 13vh, 136px) + clamp(28px, 4vh, 46px));
}

.templates-page-header h1 {
  font-size: 28px;
  line-height: 1.2;
}

.templates-page-header p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.8);
}

.templates-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(12px, 2vh, 22px);
  margin-bottom: 10px;
  padding: clamp(12px, 1.8vw, 18px);
  border-radius: clamp(12px, 2vh, 20px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.templates-hero__left {
  min-width: 0;
}

.templates-hero__title {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1.2;
}

.templates-hero__subtitle {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(12px, 1.2vw, 15px);
}

.templates-hero__right {
  min-width: min(420px, 100%);
  flex: 0 0 min(420px, 100%);
}

.templates-search-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
}

.templates-search-input::placeholder {
  color: rgba(255, 255, 255, 0.95);
}

.templates-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  cursor: pointer;
  opacity: 0.95;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4L12 12M12 4L4 12' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}

.templates-search-input:focus {
  border-color: rgba(178, 48, 204, 0.85);
  box-shadow: 0 0 0 2px rgba(178, 48, 204, 0.2);
}

.templates-search-section {
  margin-top: 14px;
}

.templates-search-status {
  margin: 0 0 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
}

.templates-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(8px, 1.5vw, 20px);
  margin-top: clamp(15px, 3.5vh, 50px);
  margin-bottom: 4px;
}

.templates-filter-bar .templates-filter-chip {
  flex-shrink: 0;
}

.templates-filter-bar[hidden] {
  display: none !important;
}

.templates-collections-section {
  margin: 10px 0 8px;
}

.templates-collections-title {
  font-size: clamp(12px, 1.2vw, 15px);
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 8px;
}

.templates-collections-list {
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(8px, 2vw, 12px);
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.templates-collection-card {
  /* Узкий экран — чуть компактнее, широкий — до ~прежнего максимума */
  width: clamp(90px, 21vw, 140px);
  flex: 0 0 clamp(90px, 21vw, 140px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: clamp(10px, 2vw, 12px);
  background: rgba(255, 255, 255, 0.08);
  padding: 0;
  color: #fff;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}

.templates-collection-card.active {
  border-color: rgba(178, 48, 204, 0.9);
  box-shadow: 0 0 0 2px rgba(178, 48, 204, 0.24);
}

.templates-collection-card__preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: clamp(9px, 1.8vw, 11px) clamp(9px, 1.8vw, 11px) 0 0;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}

.templates-collection-card__preview img,
.templates-collection-card__preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.templates-collection-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(8px, 2.2vw, 10px);
  color: rgba(255, 255, 255, 0.62);
}
.templates-collection-card__title {
  margin-top: clamp(5px, 1.2vw, 7px);
  padding: 0 clamp(5px, 1.6vw, 8px);
  font-size: clamp(10px, 2.6vw, 12px);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.templates-collection-card__count {
  margin-top: 2px;
  padding: 0 clamp(5px, 1.6vw, 8px) clamp(5px, 1.4vw, 7px);
  font-size: clamp(9px, 2.4vw, 11px);
  color: rgba(255, 255, 255, 0.75);
}

.templates-category-dropdown {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(280px, 100%);
}

.templates-category-dropdown__trigger {
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.templates-category-dropdown__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.templates-category-dropdown__chevron {
  flex-shrink: 0;
  width: 12px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='white' stroke-width='2' stroke-opacity='0.75' stroke-linecap='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  opacity: 0.85;
  transition: transform 0.2s ease;
}

.templates-category-dropdown--open .templates-category-dropdown__chevron {
  transform: rotate(180deg);
}

.templates-category-dropdown--has-value .templates-category-dropdown__trigger {
  box-shadow: inset 0 0 0 1px rgba(178, 48, 204, 0.28);
}

.templates-category-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: auto;
  z-index: 80;
  box-sizing: border-box;
  /* Не шире окна; ширина по пунктам, но не уже кнопки */
  min-width: 100%;
  width: max-content;
  max-width: calc(100vw - 20px);
  max-height: min(55vh, 320px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
  border-radius: clamp(12px, 2vh, 16px);
  background: rgba(18, 20, 42, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.templates-category-dropdown__menu[hidden] {
  display: none !important;
}

.templates-category-dropdown__option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: clamp(12px, 1.4vw, 15px);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.templates-category-dropdown__option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.templates-category-dropdown__option:focus-visible {
  outline: none;
  background: rgba(172, 75, 255, 0.2);
}

.templates-category-dropdown__option--selected {
  background: rgba(178, 48, 204, 0.22);
}

.templates-category-dropdown__option--selected:hover {
  background: rgba(178, 48, 204, 0.3);
}

.templates-grid {
  margin-top: 20px;
}

/* Каталог шаблонов: колонки как у AiHere (CSS column-count, без JS) */
.templates-grid--masonry {
  display: block;
  width: 100%;
  box-sizing: border-box;
  column-count: 4;
  column-gap: 8px;
}

@media (max-width: 1100px) {
  .templates-grid--masonry {
    column-count: 3;
  }
}

@media (max-width: 600px) {
  .templates-grid--masonry {
    column-count: 2;
    column-gap: 10px;
  }
}

@media (max-width: 550px) {
  .templates-grid--masonry {
    column-count: 2;
    column-gap: 6px;
  }
}

/* Узкий WebView (Telegram): одна колонка читабельнее */
@media (max-width: 320px) {
  .templates-grid--masonry {
    column-count: 1;
    column-gap: 8px;
  }
}

.templates-grid--masonry > .template-card-wrap[hidden],
.templates-grid--masonry > .template-card-link[hidden] {
  display: none !important;
}

.templates-grid--masonry > .template-card-wrap,
.templates-grid--masonry > .template-card-link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 8px;
  position: relative;
  z-index: 0;
  transition: transform 0.22s ease;
}

.templates-grid--masonry > .template-card-wrap:hover,
.templates-grid--masonry > .template-card-link:hover {
  z-index: 3;
  transform: scale(1.02);
}

.templates-grid--masonry > .template-card-wrap:hover .template-card,
.templates-grid--masonry > .template-card-link:hover .template-card {
  transform: none;
  border-color: rgba(172, 75, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(172, 75, 255, 0.35),
    0 14px 36px rgba(0, 0, 0, 0.38);
}

.templates-history-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (max-width: 860px) {
  .templates-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .templates-hero__right {
    min-width: 0;
    flex: 1 1 auto;
  }
}

@media (min-width: 300px) {
  .templates-history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 600px) {
  .templates-history-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .templates-history-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Карточка в masonry: без отступов у превью — только рамка; hover см. .template-card-link:hover */
.templates-grid--masonry .template-card {
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
  display: block;
  position: relative;
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.templates-grid--masonry .template-preview {
  position: relative;
  inset: auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
}

.templates-grid--masonry .template-preview img,
.templates-grid--masonry .template-preview video {
  display: block;
  width: 100%;
  height: auto;
  /* Компромисс: выше старых 280px для 9:16, но без почти полного экрана */
  max-height: min(60dvh, 620px);
  object-fit: contain;
  object-position: center;
}

.templates-grid--masonry .template-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(
    to top,
    rgba(5, 8, 20, 0.92) 0%,
    rgba(5, 8, 20, 0.55) 32%,
    rgba(5, 8, 20, 0.18) 58%,
    rgba(5, 8, 20, 0) 82%
  );
}

.templates-grid--masonry .template-card-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin-top: 0;
  padding: 8px 10px 10px;
  background: transparent;
  border-top: none;
  z-index: 2;
}

.templates-grid--masonry .template-card-title-row h3 {
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.65);
}

.templates-grid--masonry .template-price-inline {
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.55));
}

.templates-grid--masonry .template-preview-placeholder {
  height: auto;
  min-height: 120px;
}

.template-card-link {
  color: inherit;
  text-decoration: none;
  display: block;
  -webkit-tap-highlight-color: transparent;
}

.template-card-link:hover {
  color: inherit;
  text-decoration: none;
}

.template-card-link[hidden] {
  display: none !important;
}

.template-card {
  background: rgba(10, 11, 29, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
  height: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.template-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(
    to top,
    rgba(5, 8, 20, 0.82) 0%,
    rgba(5, 8, 20, 0.58) 26%,
    rgba(5, 8, 20, 0.22) 48%,
    rgba(5, 8, 20, 0.0) 72%
  );
}

.template-card-link:hover .template-card {
  transform: translateY(-2px);
  border-color: rgba(172, 75, 255, 0.8);
}

.template-preview {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.template-preview-top-badges {
  --template-preview-badge-size: clamp(22px, 2vw, 24px);
  --template-preview-badge-icon-size: 16px;
  --template-preview-badge-radius: 6px;
  position: absolute;
  top: 15px;
  left: clamp(10px, 2vw, 15px);
  z-index: 3;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

/* >800 и 451–600: в ряд; 601–800 и ≤450: колонкой */
@media (max-width: 800px) and (min-width: 601px) {
  .template-preview-top-badges {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 450px) {
  .template-preview-top-badges {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (min-width: 451px) and (max-width: 600px) {
  .template-preview-top-badges {
    flex-direction: row;
    align-items: center;
  }
}

/* Плашки каталога: один размер с template-input-badge (перекрывает .template-like-btn ниже) */
.template-preview-top-badges .template-input-badge,
.template-preview-top-badges .template-like-badge.template-like-btn {
  flex-shrink: 0;
  box-sizing: border-box;
  width: var(--template-preview-badge-size);
  height: var(--template-preview-badge-size);
  min-width: var(--template-preview-badge-size);
  min-height: var(--template-preview-badge-size);
  max-height: var(--template-preview-badge-size);
  padding: 0;
  margin: 0;
  border-radius: var(--template-preview-badge-radius);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.template-preview-top-badges .template-input-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.template-preview-top-badges .template-like-badge.template-like-btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 3px;
  appearance: none;
  -webkit-appearance: none;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.template-preview-top-badges .template-like-badge.template-like-btn.has-count {
  width: auto;
  min-width: var(--template-preview-badge-size);
  padding: 0 5px 0 4px;
}

.template-preview-top-badges .template-input-badge img,
.template-preview-top-badges .template-like-badge__icon {
  flex-shrink: 0;
  display: block;
  width: var(--template-preview-badge-icon-size);
  height: var(--template-preview-badge-icon-size);
  max-width: var(--template-preview-badge-icon-size);
  max-height: var(--template-preview-badge-icon-size);
  opacity: 0.92;
}

.template-preview-top-badges .template-input-badge img {
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.template-preview-top-badges .template-like-badge__count {
  flex-shrink: 0;
  min-width: var(--template-preview-badge-icon-size);
  height: var(--template-preview-badge-icon-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: rgba(255, 255, 255, 0.92);
  pointer-events: none;
  white-space: nowrap;
}

.template-preview-top-badges .template-like-badge__count[hidden] {
  display: none;
}

.template-preview-top-badges .template-like-badge.template-like-btn:hover {
  border-color: rgba(255, 120, 160, 0.65);
  color: #fff;
}

.template-preview-top-badges .template-like-badge.template-like-btn.is-liked {
  border-color: rgba(255, 90, 130, 0.85);
  background: rgba(180, 40, 90, 0.55);
  color: #fff;
}

.template-preview-top-badges .template-like-badge.template-like-btn.is-liked .template-stat__icon--heart path {
  fill: rgba(255, 120, 160, 0.35);
}

.template-preview-top-badges .template-like-badge.template-like-btn[data-loading="1"] {
  opacity: 0.65;
  pointer-events: none;
}

.template-category-badge {
  position: absolute;
  top: 15px;
  right: clamp(10px, 2vw, 15px);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: clamp(22px, 2.5vw, 24px);
  max-width: calc(100% - 52px);
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: clamp(9px, 2vw, 11px);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.template-preview img,
.template-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

.template-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.template-card-body {
  position: relative;
  z-index: 2;
  padding: 14px;
}

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

.template-card-title-row h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: clamp(10px, 2.5vw, 14px);
  font-weight: 400;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.template-card-link:hover .template-card-title-row h3 {
  color: rgba(255, 255, 255, 0.92);
}

/* Статистика шаблона (детальная страница и общие элементы) */
.template-card-wrap {
  position: relative;
}

.template-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.82);
}

.template-stat__icon {
  flex-shrink: 0;
  opacity: 0.9;
}

.template-stat__count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Не каталог (.template-like-badge) и не topbar детали (.template-detail-share-btn) */
.template-like-btn:not(.template-like-badge):not(.template-detail-share-btn) {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.template-like-btn:not(.template-like-badge):not(.template-detail-share-btn):hover {
  border-color: rgba(255, 120, 160, 0.65);
  color: #fff;
}

.template-like-btn:not(.template-like-badge):not(.template-detail-share-btn).is-liked {
  border-color: rgba(255, 90, 130, 0.85);
  background: rgba(180, 40, 90, 0.55);
  color: #fff;
}

.template-like-btn:not(.template-like-badge):not(.template-detail-share-btn).is-liked .template-stat__icon--heart path {
  fill: rgba(255, 120, 160, 0.35);
}

.template-like-btn:not(.template-like-badge)[data-loading="1"] {
  opacity: 0.65;
  pointer-events: none;
}

.template-card-link:hover .template-price-value {
  color: rgba(255, 255, 255, 0.92);
}

.template-price-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-top: 1px;
}

.template-price-value {
  font-size: clamp(11px, 2.5vw, 14px);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
}

.template-neuron-icon {
  width: clamp(15px, 3.6vw, 18px);
  height: clamp(15px, 3.6vw, 18px);
  object-fit: contain;
  opacity: 0.9;
  flex-shrink: 0;
}

@media (max-width: 899px) {
  .template-price-inline {
    display: none;
  }
}

.templates-empty-state {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.templates-history-section {
  margin-top: 8px;
}

.templates-history-status {
  margin: 0 0 10px;
  min-height: 1.25em;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}

.templates-history-card {
  background: rgba(10, 11, 29, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  overflow: hidden;
}

.templates-history-thumb {
  display: block;
  height: 170px;
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  text-decoration: none;
  position: relative;
}

.templates-history-thumb img,
.templates-history-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.templates-history-thumb-multi {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 28px;
  height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: rgba(10, 11, 29, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.templates-history-thumb-loader {
  width: 100%;
  height: 100%;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

.templates-history-thumb-loader__spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(200, 140, 255, 0.95);
  animation: templates-fs-spin 0.85s linear infinite;
  flex-shrink: 0;
}

.templates-history-thumb-loader__text {
  font-size: 12px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
}

.templates-history-thumb-fallback,
.templates-history-thumb-placeholder {
  width: 100%;
  height: 100%;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  padding: 12px;
  text-align: center;
}

.templates-history-thumb-fallback-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  padding: 0 8px;
}

.templates-history-body {
  padding: 14px;
}

.templates-history-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: clamp(8px, 1.2vw, 12px);
  opacity: 0.8;
}

.templates-history-title {
  margin-top: 10px;
  font-size: clamp(10px, 1.2vw, 16px);
  line-height: 1.25;
  font-weight: 500;
}

.templates-history-title a {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
}

.templates-history-title a:hover {
  color: #e8c4ff;
}

.templates-history-status-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.templates-history-status-text {
  font-size: clamp(9px, 1.2vw, 13px);
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.78);
  min-width: 0;
  flex: 1;
}

.templates-history-icon-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.templates-history-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(16px, 2vw, 32px);
  height: clamp(10px, 1.2vw, 32px);
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.templates-history-icon-btn img {
  width: clamp(12px, 1.5vw, 18px);
  height: clamp(12px, 1.5vw, 18px);
  object-fit: contain;
  opacity: 0.8;
  display: block;
}

.templates-history-icon-btn:hover:not(.templates-history-icon-btn--disabled) img {
  opacity: 1;
}

.templates-history-icon-btn--disabled {
  cursor: default;
  pointer-events: none;
}

.templates-history-icon-btn--disabled img {
  opacity: 0.28;
}

.templates-history-icon-btn--link {
  text-decoration: none;
}

.templates-history-card--clickable {
  cursor: pointer;
}

.templates-history-card--clickable:focus-visible {
  outline: 2px solid rgba(200, 140, 255, 0.85);
  outline-offset: 2px;
}

.templates-history-error {
  margin-top: 8px;
  font-size: 12px;
  color: #ffb3b3;
}

.template-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: clamp(12px, 2vh, 22px);
  margin-bottom: 14px;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
}

.template-detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  margin-top: clamp(12px, 2vh, 22px);
  margin-bottom: 14px;
  min-width: 0;
}

.template-detail-topbar .template-back-link {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100% - 8rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-detail-topbar .template-detail-actions {
  margin-left: auto;
  flex: 0 0 auto;
  flex-shrink: 0;
}

/* В topbar — та же «высота», что у .tab-btn «Назад» (padding), не 42px как у «Поделиться» */
.template-detail-topbar .template-detail-share-btn--stat {
  width: auto;
  min-width: 0;
  height: auto;
  padding: clamp(8px, 1.2vh, 12px) clamp(10px, 1.5vw, 14px);
  border-radius: clamp(12px, 2vh, 20px);
  gap: 5px;
  box-sizing: border-box;
}

.template-detail-topbar .template-detail-share-btn--stat .template-detail-share-btn__icon {
  width: 16px;
  height: 16px;
}

.template-detail-topbar .template-detail-share-btn__count {
  font-size: clamp(11px, 1.4vw, 13px);
}

@media (max-width: 520px) {
  .template-detail-topbar {
    gap: 6px;
  }

  .template-detail-topbar .template-detail-actions {
    gap: 4px;
  }

  .template-detail-topbar .template-detail-share-btn--stat {
    padding: clamp(6px, 1vh, 10px) clamp(7px, 2vw, 10px);
    gap: 4px;
  }

  .template-detail-topbar .template-detail-share-btn--stat .template-detail-share-btn__icon {
    width: 14px;
    height: 14px;
  }

  .template-detail-topbar .template-detail-share-btn__count {
    font-size: 11px;
  }
}

.template-detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.template-detail-share-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.template-detail-share-btn:hover {
  border-color: rgba(178, 48, 204, 0.75);
  background: rgba(178, 48, 204, 0.22);
  color: #fff;
}

.template-detail-share-btn:focus-visible {
  outline: 2px solid rgba(200, 140, 255, 0.9);
  outline-offset: 2px;
}

.template-detail-share-btn__icon {
  display: block;
  flex-shrink: 0;
}

.template-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.template-detail-share-btn--stat {
  width: auto;
  min-width: 42px;
  padding: 0 10px;
  gap: 6px;
  cursor: default;
}

.template-detail-views-stat {
  pointer-events: none;
}

.template-detail-share-btn--stat.template-like-btn {
  cursor: pointer;
}

/* Без лайка — тот же фон, что у просмотров (.template-detail-share-btn) */
.template-detail-share-btn.template-like-btn:not(.is-liked) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.template-detail-share-btn.template-like-btn:not(.is-liked):hover {
  border-color: rgba(178, 48, 204, 0.75);
  background: rgba(178, 48, 204, 0.22);
  color: #fff;
}

.template-detail-share-btn__count {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: rgba(255, 255, 255, 0.92);
}

.template-detail-share-btn.template-like-btn.is-liked {
  border-color: rgba(255, 90, 130, 0.85);
  background: rgba(180, 40, 90, 0.35);
  color: #fff;
}

.template-detail-share-btn.template-like-btn.is-liked:hover {
  border-color: rgba(255, 120, 160, 0.9);
  background: rgba(200, 50, 100, 0.45);
}

.template-detail-share-btn.template-like-btn.is-liked .template-detail-share-btn__icon--heart path {
  fill: rgba(255, 120, 160, 0.35);
}

.template-detail-share-btn.template-like-btn[data-loading="1"] {
  opacity: 0.65;
  pointer-events: none;
}

.template-detail-title-row h1 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: clamp(20px, 4.6vw, 28px);
  font-weight: 500;
  line-height: 1.22;
  color: #fff;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.template-detail-meta-inline {
  flex-shrink: 0;
  font-size: clamp(12px, 2.4vw, 14px);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}

.template-detail-description {
  margin-top: 12px;
  font-size: clamp(14px, 2.6vw, 17px);
  line-height: 1.55;
  color: #fff;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.template-detail-meta-chips {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.template-detail-chip {
  flex: 1 1 140px;
  min-width: min(100%, 145px);
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09) 0%, rgba(20, 22, 48, 0.72) 100%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.template-detail-chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg, rgba(200, 140, 255, 0.95) 0%, rgba(178, 48, 204, 0.85) 100%);
  opacity: 0.95;
}

.template-detail-chip--credits::before {
  background: linear-gradient(180deg, rgba(120, 220, 255, 0.55) 0%, rgba(178, 48, 204, 0.95) 100%);
}

.template-detail-chip__caption {
  display: block;
  font-size: clamp(11px, 2vw, 12px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.template-detail-chip__value {
  font-size: clamp(14px, 2.8vw, 17px);
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
  word-break: break-word;
}

.template-detail-chip__line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.template-detail-chip__value--num {
  font-variant-numeric: tabular-nums;
  font-size: clamp(16px, 3vw, 20px);
}

.template-neuron-icon--chip {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.95;
  filter: brightness(0) invert(1);
}

.template-detail-card {
  display: grid;
  grid-template-columns: minmax(0, 50%) minmax(0, 1fr);
  gap: 22px;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.template-detail-preview {
  position: relative;
  min-width: 0;
  width: min(100%, min(72vh, 760px));
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.template-detail-content {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: clip;
}

/* Вся картинка/видео видна целиком; «пустое» поле — фон квадрата (letterboxing внутри рамки) */
.template-detail-preview img,
.template-detail-preview video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.template-detail-preview .template-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  width: auto;
  height: auto;
  padding: 12px;
  box-sizing: border-box;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: clamp(12px, 2.4vw, 14px);
}

.template-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Сетка слотов загрузки: до 2 в ряд на странице шаблона / редактора */
.template-file-slots-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(4px, 2vw, 18px);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 2px;
}

.template-file-slots-grid--single {
  grid-template-columns: 1fr;
}

.template-file-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.template-file-slot .template-file-picker {
  flex-wrap: wrap;
  align-items: center;
  min-height: 0;
  gap: clamp(8px, 2vw, 10px);
}

.template-file-slot .template-file-preview {
  flex: 1 1 auto;
  min-width: 0;
}

/* Пустое состояние: «Файл не выбран» по вертикали по центру рядом со скрепкой */
.template-file-slot .template-file-preview:has(.template-file-preview__empty) {
  min-height: clamp(44px, 11vw, 52px);
}

.template-form__label,
.template-form label.template-form__label {
  font-size: clamp(14px, 2.5vw, 16px);
  font-weight: 500;
  color: #fff;
}

/* Только textarea: не цеплять input[type=file] — иначе width:100% бьёт .template-file-input по специфичности и рвёт вёрстку */
.template-form textarea,
.template-form-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.24);
  color: #fff;
  padding: 9px 10px;
  font-size: 13px;
  box-sizing: border-box;
  max-width: 100%;
}

.template-file-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 52px;
}

.template-form .template-file-input,
.template-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

.template-file-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: clamp(13px, 2.2vw, 15px);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-file-picker-btn:hover {
  border-color: rgba(178, 48, 204, 0.8);
  background: rgba(178, 48, 204, 0.2);
}

.template-file-picker-btn--icon-only {
  flex: 0 0 auto;
  width: clamp(44px, 11vw, 52px);
  height: clamp(44px, 11vw, 52px);
  padding: 0;
  white-space: normal;
  text-overflow: clip;
  overflow: visible;
}

.template-file-picker-btn--icon-only .template-file-picker-icon {
  display: block;
  width: clamp(20px, 5vw, 24px);
  height: clamp(20px, 5vw, 24px);
  margin: 0 auto;
}

.template-file-picker-btn--icon-only:focus-visible {
  outline: 2px solid rgba(232, 121, 249, 0.95);
  outline-offset: 2px;
}

.template-file-preview {
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.template-file-thumb {
  flex-shrink: 0;
  display: block;
  max-height: 52px;
  max-width: min(140px, 42vw);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.28);
}

.template-file-thumb--video {
  object-fit: cover;
}

.template-file-preview__empty {
  text-align: left;
}

.template-file-name {
  min-width: 0;
  font-size: clamp(12px, 2.2vw, 14px);
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-submit-btn {
  margin-top: 6px;
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  background: #b230cc;
  color: #fff;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font-size: clamp(14px, 2.6vw, 17px);
  font-weight: 600;
}

.template-submit-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.template-neuron-icon--submit {
  width: 18px;
  height: 18px;
}

.template-category-badge--detail {
  top: 15px;
  right: clamp(10px, 2vw, 15px);
  max-width: calc(100% - 30px);
}

.template-related-section {
  margin-top: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.template-related-title {
  margin: 0 0 8px;
  font-size: clamp(13px, 2.8vw, 17px);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
}

.template-related-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: clamp(8px, 2vw, 14px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: clamp(6px, 1.2vw, 10px);
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}

.template-related-card {
  flex: 0 0 auto;
  /* Квадрат: от ~92px на узких экранах до ~148px на широких */
  width: clamp(92px, min(24vw, 16vh), 148px);
  scroll-snap-align: start;
  aspect-ratio: 1;
  border-radius: clamp(10px, 2vw, 14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 11, 29, 0.55);
  overflow: hidden;
  text-decoration: none;
  color: #fff;
}

.template-related-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.25);
}

.template-related-card__inner img,
.template-related-card__inner video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.template-related-card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(8px, 2vw, 11px);
  padding: 4px;
  text-align: center;
}

.template-category-badge--related {
  top: clamp(4px, 1.2vw, 8px);
  right: clamp(4px, 1.2vw, 8px);
  height: auto;
  min-height: 0;
  max-width: calc(100% - 16px);
  padding: clamp(2px, 0.5vw, 4px) clamp(4px, 1.2vw, 8px);
  border-radius: clamp(4px, 1vw, 6px);
  font-size: clamp(6px, 2.1vw, 8px);
  line-height: 1.1;
}

.template-related-card__title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: clamp(14px, 4vw, 22px) clamp(4px, 1.2vw, 8px) clamp(4px, 1vw, 8px);
  font-size: clamp(9px, 2.6vw, 12px);
  line-height: 1.3;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.35) 50%, transparent 100%);
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-job-status {
  margin-top: 12px;
  font-size: clamp(13px, 2.4vw, 15px);
  color: rgba(255, 255, 255, 0.92);
}

.template-job-result {
  margin-top: 10px;
  font-size: clamp(13px, 2.4vw, 15px);
  min-width: 0;
}

.template-job-result img,
.template-job-result video {
  max-width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 800px) {
  .template-detail-card {
    grid-template-columns: 1fr;
  }
}

/* Модалка «Поделиться» (страница шаблона) */
.template-share-modal {
  position: fixed;
  inset: 0;
  z-index: 10064;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.template-share-modal[hidden] {
  display: none !important;
}

.template-share-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 14, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.template-share-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 20px 20px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(14, 15, 28, 0.97);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}

.template-share-modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.template-share-modal__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.template-share-modal__title {
  margin: 0 36px 16px 0;
  font-size: clamp(17px, 3.2vw, 20px);
  font-weight: 600;
  color: #fff;
}

.template-share-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.template-share-modal__btn {
  flex: 1 1 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.template-share-modal__btn:hover {
  filter: brightness(1.08);
}

.template-share-modal__btn--tg {
  background: #229ed9;
}

.template-share-modal__btn--vk {
  background: #0077ff;
}

.template-share-modal__copy-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-share-modal__copy-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

.template-share-modal__copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.template-share-modal__url-input {
  flex: 1 1 160px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 13px;
}

.template-share-modal__copy-btn {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(178, 48, 204, 0.65);
  background: rgba(178, 48, 204, 0.25);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.template-share-modal__copy-btn:hover {
  background: rgba(178, 48, 204, 0.4);
}

.template-share-modal__hint {
  margin: 0;
  font-size: 13px;
  color: #9cffc1;
}

/* Popover: базовый .template-detail-chip { overflow: hidden } иначе обрезает панель */
.template-detail-chip.template-price-popover {
  overflow: visible;
  z-index: 3;
}

.template-price-popover {
  position: relative;
}

/* «Мостик» наведения: без него курсор теряет hover в зазоре между чипом и панелью */
.template-price-popover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 16px;
  z-index: 39;
}

.template-price-popover__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  /* svw — не раздувает layout при вертикальном скроллбаре (в отличие от 100vw) */
  width: min(270px, calc(100svw - 44px));
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(16, 18, 36, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.template-price-popover__panel::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 18px;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  background: rgba(16, 18, 36, 0.97);
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.template-price-popover.is-open .template-price-popover__panel,
.template-price-popover:hover .template-price-popover__panel,
.template-price-popover:focus-within .template-price-popover__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.template-price-popover__line {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

.template-price-popover__line + .template-price-popover__line {
  margin-top: 6px;
}

.template-price-popover__neu-ico {
  width: 16px;
  height: 16px;
  vertical-align: -0.2em;
  margin: 0 1px;
  display: inline-block;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.template-price-popover__topup-btn {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(178, 48, 204, 0.72);
  background: rgba(178, 48, 204, 0.28);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.template-price-popover__topup-btn:hover {
  background: rgba(178, 48, 204, 0.42);
}

body.templates-body-no-scroll {
  overflow: hidden;
}

.templates-fullscreen-loader {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(6, 7, 18, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
}

.templates-fullscreen-loader[hidden] {
  display: none !important;
}

.templates-fullscreen-loader__spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(200, 140, 255, 0.95);
  animation: templates-fs-spin 0.85s linear infinite;
}

.templates-fullscreen-loader__text {
  margin: 0;
  max-width: 280px;
  font-size: 16px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
}

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

.templates-history-card--highlight {
  outline: 2px solid rgba(200, 140, 255, 0.9);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(178, 48, 204, 0.22);
  transition: outline-color 0.3s ease, box-shadow 0.3s ease;
}

.templates-result-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.templates-result-modal[hidden] {
  display: none !important;
}

.templates-result-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 14, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.templates-result-modal__panel {
  position: relative;
  z-index: 1;
  max-width: min(960px, calc(100svw - 32px));
  max-height: min(92vh, 900px);
  width: 100%;
  background: rgba(14, 15, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.templates-result-modal__close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.templates-result-modal__close:hover {
  background: rgba(178, 48, 204, 0.45);
}

.templates-result-modal__body {
  padding: 48px 20px 24px;
  overflow: auto;
  display: block;
  min-height: 120px;
  box-sizing: border-box;
  max-height: min(92vh, 900px);
}

.templates-result-modal__stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  align-items: stretch;
}

.templates-result-modal__meta {
  margin: 0;
}

.templates-result-modal__model,
.templates-result-modal__date {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.88);
}

.templates-result-modal__date {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.72);
}

.templates-result-modal__media-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}

.templates-result-modal__media {
  max-width: 100%;
  max-height: min(52vh, 560px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.templates-result-modal__gallery {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.templates-result-modal__gallery-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.templates-result-modal__gallery-item .templates-result-modal__media-wrap {
  min-height: 60px;
}

.templates-result-modal__gallery-item .templates-result-modal__media {
  max-height: min(40vh, 420px);
  width: 100%;
}

.templates-result-modal__gallery-caption {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.78);
  text-transform: uppercase;
}

.templates-result-modal__gallery-dl {
  align-self: flex-end;
}

.templates-result-modal__prompt-host {
  margin-top: 2px;
}

.templates-result-modal__prompt-empty {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

.templates-result-modal__prompt-block {
  margin: 0;
}

.templates-result-modal__prompt-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.templates-result-modal__prompt-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
}

.templates-result-modal__prompt-copy {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.templates-result-modal__prompt-copy:hover {
  background: rgba(178, 48, 204, 0.35);
}

.templates-result-modal__prompt-copy img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  opacity: 0.8;
  display: block;
}

.templates-result-modal__prompt-copy:hover img {
  opacity: 1;
}

.templates-result-modal__prompt-details {
  margin: 0;
}

/* Закрытый <details>: текст промпта скрыт (на случай квирков WebView). */
.templates-result-modal__prompt-details:not([open]) > .templates-result-modal__prompt-text {
  display: none;
}

.templates-result-modal__prompt-summary {
  display: block;
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 0;
  margin: 0 0 8px;
}

.templates-result-modal__prompt-summary::-webkit-details-marker {
  display: none;
}

.templates-result-modal__prompt-summary-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.templates-result-modal__prompt-summary-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #d8b4ff;
}

.templates-result-modal__prompt-summary-text::after {
  content: "";
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(216, 180, 255, 0.92);
  margin-top: 1px;
  transition: transform 0.2s ease;
}

.templates-result-modal__prompt-details[open] .templates-result-modal__prompt-summary-text::after {
  transform: rotate(180deg);
}

.templates-result-modal__prompt-text {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  max-height: min(40vh, 360px);
  overflow: auto;
}

.templates-result-modal__footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: clamp(6px, 2.2vw, 10px);
  padding-top: 4px;
  margin-bottom: 12px;
}

.templates-result-modal__action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(7px, 2vw, 10px) clamp(12px, 4.2vw, 20px);
  min-height: clamp(36px, 9vw, 44px);
  border-radius: clamp(8px, 2vw, 10px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(178, 48, 204, 0.42);
  color: #fff;
  font: inherit;
  font-size: clamp(12px, 3.4vw, 14px);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.templates-result-modal__action-btn:hover {
  background: rgba(200, 90, 220, 0.5);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.templates-result-modal__action-btn--danger {
  background: rgba(140, 40, 55, 0.45);
  border-color: rgba(255, 154, 154, 0.35);
  color: #ffe8e8;
}

.templates-result-modal__action-btn--danger:hover {
  background: rgba(170, 55, 70, 0.55);
  border-color: rgba(255, 180, 180, 0.45);
  color: #fff;
}

.templates-result-modal__fallback {
  margin: 0;
  text-align: center;
}

/* Подтверждение удаления генерации (кастомное, в фирменных цветах) */
.templates-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 28px);
  box-sizing: border-box;
}

.templates-confirm-modal[hidden] {
  display: none !important;
}

.templates-confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 5, 20, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

.templates-confirm-modal__panel {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  padding: clamp(18px, 4vw, 24px);
  border-radius: clamp(14px, 3vw, 18px);
  border: 1px solid rgba(178, 48, 204, 0.45);
  background: linear-gradient(155deg, rgba(40, 12, 48, 0.96) 0%, rgba(22, 8, 32, 0.98) 100%);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  box-sizing: border-box;
}

.templates-confirm-modal__title {
  margin: 0 0 10px;
  font-size: clamp(17px, 4vw, 20px);
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
}

.templates-confirm-modal__message {
  margin: 0 0 clamp(18px, 4vw, 22px);
  font-size: clamp(13px, 3.2vw, 15px);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.88);
}

.templates-confirm-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.templates-confirm-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.templates-confirm-modal__btn--secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.92);
}

.templates-confirm-modal__btn--secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
  color: #fff;
}

.templates-confirm-modal__btn--primary {
  background: #b230cc;
  border-color: #b230cc;
  color: #fff;
}

.templates-confirm-modal__btn--primary:hover {
  background: #9a1fb3;
  border-color: #9a1fb3;
  color: #fff;
}

/* Инструкция по загрузке (текст из админки; строки «1. …» — с маркером) */
.template-prompt-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
  min-width: 0;
  max-width: 100%;
}

.template-prompt-editor__toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  font: inherit;
  font-size: clamp(13px, 2.4vw, 14px);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.template-prompt-editor__toggle-label {
  flex: 0 1 auto;
}

.template-prompt-editor__chevron {
  flex-shrink: 0;
  width: 12px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='white' stroke-width='2' stroke-opacity='0.75' stroke-linecap='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  opacity: 0.85;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.template-prompt-editor__toggle[aria-expanded="true"] .template-prompt-editor__chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.template-prompt-editor__toggle:hover {
  border-color: rgba(178, 48, 204, 0.75);
  background: rgba(178, 48, 204, 0.22);
  color: #fff;
}

.template-prompt-editor__toggle:focus-visible {
  outline: 2px solid rgba(200, 140, 255, 0.9);
  outline-offset: 2px;
}

.template-prompt-editor__toggle[aria-expanded="true"] {
  border-color: rgba(178, 48, 204, 0.65);
  background: rgba(178, 48, 204, 0.18);
}

.template-prompt-editor__panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.template-prompt-editor__panel[hidden] {
  display: none !important;
}

.template-prompt-editor__hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.62);
}

.template-prompt-editor__textarea {
  min-height: 88px;
  resize: vertical;
}

.template-prompt-editor__auth-msg {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.78);
}

.template-upload-instructions {
  margin: 0 0 clamp(14px, 3vw, 18px);
  padding: 0;
  border-radius: clamp(12px, 2.5vw, 16px);
  border: 1px solid rgba(178, 48, 204, 0.35);
  background: linear-gradient(
    135deg,
    rgba(36, 12, 48, 0.92) 0%,
    rgba(22, 18, 42, 0.88) 50%,
    rgba(18, 24, 52, 0.9) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 8px 28px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  overflow: hidden;
}

.template-upload-instructions::before {
  content: "";
  display: block;
  height: clamp(3px, 0.8vw, 4px);
  background: linear-gradient(90deg, #b230cc, #e879f9, #7c3aed);
  opacity: 0.95;
}

.template-upload-instructions__title {
  margin: 0;
  padding: clamp(10px, 2.2vw + 6px, 14px) clamp(12px, 3.5vw, 16px) clamp(6px, 1.2vw + 4px, 10px);
  font-size: clamp(12.5px, 0.28rem + 2.6vw, 15px);
  font-weight: 700;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.97);
  letter-spacing: 0.01em;
}

.template-upload-instructions__body {
  margin: 0;
  padding: clamp(2px, 0.5vw, 4px) clamp(12px, 3.5vw, 16px) clamp(12px, 3vw, 16px);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.template-upload-instructions__row--numbered {
  display: flex;
  align-items: flex-start;
  gap: clamp(8px, 2.2vw, 12px);
  margin: 0 0 clamp(8px, 2vw, 10px);
}

.template-upload-instructions__row--numbered:last-child {
  margin-bottom: 0;
}

.template-upload-instructions__badge {
  flex: 0 0 auto;
  min-width: clamp(22px, 5vw + 10px, 28px);
  width: clamp(22px, 5vw + 10px, 28px);
  height: clamp(22px, 5vw + 10px, 28px);
  margin-top: clamp(0px, 0.2vw, 1px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: clamp(10.5px, 0.15rem + 2.2vw, 13px);
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: linear-gradient(145deg, #c94de6 0%, #b230cc 45%, #8b1fa3 100%);
  box-shadow: 0 2px 8px rgba(178, 48, 204, 0.45);
}

.template-upload-instructions__line-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding-top: clamp(1px, 0.4vw, 3px);
  font-size: clamp(12px, 0.22rem + 2.4vw, 14px);
  line-height: 1.5;
  color: rgba(248, 250, 252, 0.92);
  word-break: break-word;
}

.template-upload-instructions__row--plain {
  margin: 0 0 clamp(6px, 1.8vw, 8px);
  padding-left: 2px;
  font-size: clamp(12px, 0.22rem + 2.4vw, 14px);
  line-height: 1.5;
  color: rgba(226, 232, 240, 0.88);
  word-break: break-word;
}

.template-upload-instructions__row--plain:last-child {
  margin-bottom: 0;
}

.template-upload-instructions__spacer {
  height: clamp(4px, 1.2vw, 6px);
  flex-shrink: 0;
}
