/* «Креатив» в разделе «Создать»: заголовок 28/700, поиск пресета, фильтр-чипы, строка
   «Фото или видео — предложу пресеты», сетка 2 / 3 / 4 колонки, карточка GenForm и результат.
   Только токены ДС Moment. Внутри продукта, без hero и своей шапки. */

.cr-home {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 2px 0 10px;
}

.cr-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.4px;
  line-height: 1.15;
  color: var(--m-text);
}

/* ---------- Поиск пресета ---------- */

.cr-search-field {
  display: flex;
  margin: 0;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  box-sizing: border-box;
  border: 1px solid var(--m-line);
  border-radius: 14px;
  background: var(--m-card);
  transition: border-color var(--m-dur-tap) var(--m-ease-out), background var(--m-dur-tap);
}
.cr-search-field:focus-within {
  border-color: var(--m-accent-line);
  background: var(--m-raised);
}
.cr-search-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--m-muted);
}
.cr-search-ico svg {
  width: 20px;
  height: 20px;
}
.cr-search-field input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--m-text);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
}
.cr-search-field input::placeholder {
  color: var(--m-dim);
}
.cr-search-field input::-webkit-search-cancel-button {
  filter: grayscale(1);
}

/* ---------- Фильтр-чипы ---------- */

.cr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}
.cr-chip {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--m-line);
  border-radius: 999px;
  background: var(--m-card);
  color: var(--m-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--m-dur-tap), background var(--m-dur-tap), color var(--m-dur-tap);
}
.cr-chip:hover {
  color: var(--m-text);
  border-color: var(--m-accent-line);
}
.cr-chip[data-state="active"] {
  border-color: var(--m-accent-line);
  background: var(--m-accent-deep);
  color: var(--m-accent-text);
}

/* ---------- Строка файла ---------- */

.cr-drop {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 46px;
  padding: 6px 10px 6px 12px;
  box-sizing: border-box;
  border: 1px dashed var(--m-line);
  border-radius: 14px;
  background: var(--m-deep);
}
.cr-drop-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--m-raised);
  color: var(--m-accent-text);
}
.cr-drop-ico svg {
  width: 16px;
  height: 16px;
}
.cr-drop-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--m-muted);
  overflow-wrap: anywhere;
}
.cr-drop-btn {
  flex: none;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--m-line);
  border-radius: 10px;
  background: var(--m-raised);
  color: var(--m-text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.cr-drop-btn:hover {
  border-color: var(--m-accent-line);
}

.cr-drop-sug {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.cr-drop-sug[hidden] {
  display: none;
}
.cr-drop-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--m-dim);
}
.cr-drop-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--m-line);
  border-radius: 999px;
  background: var(--m-card);
  color: var(--m-text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.cr-drop-chip:hover {
  border-color: var(--m-accent-line);
}
.cr-drop-chip > span:first-child {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--m-accent-text);
}
.cr-drop-chip svg {
  width: 15px;
  height: 15px;
}
.cr-drop-empty {
  margin: 0;
  font-size: 12.5px;
  color: var(--m-muted);
}

/* ---------- Сетка пресетов ---------- */

.cr-grid,
.cr-skeleton {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}
.cr-cell {
  min-width: 0;
}

.cr-tile {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--m-line);
  border-radius: 16px;
  background: var(--m-card);
  color: var(--m-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--m-dur-tap) var(--m-ease-out), background var(--m-dur-tap), transform var(--m-dur-tap) var(--m-ease-out);
}
.cr-tile:hover,
.cr-tile:focus-visible {
  border-color: var(--m-accent-line);
  background: var(--m-raised);
}
.cr-tile:active {
  transform: scale(.99);
}
.cr-tile--locked {
  cursor: default;
  opacity: .58;
  background: var(--m-deep);
}
.cr-tile--locked:hover {
  border-color: var(--m-line);
  background: var(--m-deep);
}
.cr-tile--locked .cr-tile-cover {
  filter: grayscale(.35);
}

.cr-tile-cover {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--cr-cover-bg, #1B1F2A);
  color: var(--cr-cover-ink, #C7BFFB);
}
.cr-tile-cover svg {
  display: block;
  width: 100%;
  height: 100%;
}
.cr-tile-cover[data-tone="violet"] { --cr-cover-bg: #1C1830; --cr-cover-ink: #C7BFFB; }
.cr-tile-cover[data-tone="blue"] { --cr-cover-bg: #16243B; --cr-cover-ink: #9CCBFF; }
.cr-tile-cover[data-tone="peach"] { --cr-cover-bg: #2A1A24; --cr-cover-ink: #FBC1D3; }
.cr-tile-cover[data-tone="mint"] { --cr-cover-bg: #112421; --cr-cover-ink: #8AF0DB; }
.cr-tile-cover[data-tone="amber"] { --cr-cover-bg: #231F14; --cr-cover-ink: #F3D891; }

.cr-tile-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px 12px;
}
.cr-tile-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.1px;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cr-tile-desc {
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--m-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-tile-meta {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--m-dim);
}
.cr-soon {
  align-self: flex-start;
  display: inline-block;
  margin-top: 1px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--m-raised);
  color: var(--m-muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}

.cr-tile--skel {
  pointer-events: none;
}
.cr-tile--skel .cr-tile-cover {
  background: var(--m-raised);
  animation: cr-shimmer var(--m-loop-shimmer) infinite;
}
.cr-tile--skel .cr-tile-body b,
.cr-tile--skel .cr-tile-body em,
.cr-tile--skel .cr-tile-body small {
  display: block;
  height: 10px;
  border-radius: 6px;
  background: var(--m-raised);
  animation: cr-shimmer var(--m-loop-shimmer) infinite;
}
.cr-tile--skel .cr-tile-body b { width: 62%; height: 14px; }
.cr-tile--skel .cr-tile-body em { width: 92%; }
.cr-tile--skel .cr-tile-body small { width: 44%; }

.cr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 16px;
  border: 1px dashed var(--m-line);
  border-radius: 16px;
  background: var(--m-card);
  text-align: center;
}
.cr-empty-ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--m-raised);
  color: var(--m-muted);
}
.cr-empty-ico svg { width: 20px; height: 20px; }
.cr-empty b { font-size: 15px; font-weight: 700; }
.cr-empty p { max-width: 340px; margin: 0; font-size: 13px; line-height: 1.45; color: var(--m-muted); }

/* ---------- Карточка пресета ---------- */
body[data-cr-open="1"] {
  overflow: hidden;
}

.cr-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(5, 7, 11, .68);
  animation: cr-fade var(--m-dur-fade) var(--m-ease-out) both;
}

.cr-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 92dvh;
  min-height: 0;
  border: 1px solid var(--m-line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--m-card);
  box-shadow: 0 -18px 60px rgba(0, 0, 0, .45);
  animation: cr-up var(--m-dur-sheet) var(--m-ease-out) both;
  overflow: hidden;
}

.cr-sheet-head {
  display: flex;
  height: auto;
  margin: 0;
  align-items: flex-start;
  gap: 10px;
  flex: none;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--m-line-soft);
}
.cr-sheet-ic {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--m-accent-deep);
  color: var(--m-accent-text);
}
.cr-sheet-ic svg { width: 20px; height: 20px; }
.cr-sheet-ht {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.cr-sheet-kicker {
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--m-muted);
}
.cr-sheet-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.2px;
  line-height: 1.2;
  color: var(--m-text);
  overflow-wrap: anywhere;
}
.cr-sheet-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--m-line);
  border-radius: 11px;
  background: var(--m-raised);
  color: var(--m-muted);
  cursor: pointer;
}
.cr-sheet-x svg { width: 17px; height: 17px; }
.cr-sheet-x:hover { color: var(--m-text); border-color: var(--m-accent-line); }

.cr-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 14px max(18px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.cr-card-desc {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--m-muted);
}

.cr-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* ---------- Файл ---------- */

.cr-file {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px;
  border: 1px dashed var(--m-line);
  border-radius: 15px;
  background: var(--m-deep);
}
.cr-file:has(.cr-file-row) {
  border-style: solid;
}
.cr-file[data-drop="1"] {
  border-color: var(--m-accent-line);
  background: var(--m-accent-deep);
}
.cr-file-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cr-file-label {
  font-size: 14px;
  font-weight: 650;
  color: var(--m-text);
}
.cr-file-note {
  font-size: 11.5px;
  color: var(--m-muted);
}
.cr-file-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--m-muted);
}
.cr-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: flex-start;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--m-line);
  border-radius: 11px;
  background: var(--m-raised);
  color: var(--m-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.cr-file-btn svg { width: 16px; height: 16px; }
.cr-file-btn:hover { border-color: var(--m-accent-line); }
.cr-file-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.cr-file-thumb,
.cr-file-ext {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--m-raised);
  color: var(--m-muted);
  object-fit: cover;
  overflow: hidden;
}
.cr-file-ext svg { width: 19px; height: 19px; }
.cr-file-tx {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.cr-file-tx b {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-file-tx small { font-size: 11.5px; color: var(--m-muted); }
.cr-file-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--m-muted);
  cursor: pointer;
}
.cr-file-x svg { width: 15px; height: 15px; }
.cr-file-x:hover { color: var(--m-text); background: var(--m-raised); }
.cr-file-skip {
  margin: 0;
  font-size: 13px;
  color: var(--m-muted);
}
.cr-file-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.cr-file-foot:empty { display: none; }
.cr-file-link {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--m-accent-text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cr-file-msg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--m-error-line);
  border-radius: 12px;
  background: var(--m-error-deep);
}
.cr-file-msg[hidden] { display: none; }
.cr-file-msg p {
  flex: 1 1 220px;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--m-error-text);
}
.cr-file-msg .cr-btn {
  flex: none;
}
.cr-file-err {
  margin: 0;
  padding: 0 2px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--m-error);
}
.cr-file-err[hidden] { display: none; }

.cr-before {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 0 2px;
  font-size: 12.5px;
  color: var(--m-muted);
}
.cr-before b {
  font-size: 14px;
  font-weight: 700;
  color: var(--m-text);
}
.cr-output {
  margin: 0;
  padding: 0 2px;
  font-size: 12.5px;
  color: var(--m-muted);
}

.cr-gf-host {
  min-width: 0;
}
.cr-gf-host .gv-surface { padding: 0; background: none; }
.cr-gf-host .cx-gf-head { display: none; }
.cr-gf-host .cx-gf-form {
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.cr-gf-host .cx-gf-foot { border-top-color: var(--m-line-soft); }

.cr-start {
  width: 100%;
  min-height: 46px;
  font-size: 15px;
}

/* Цена у кнопки «Создать»: запуск = согласие на трату до estimate×1,5. */
.cr-consent {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid var(--m-accent-line);
  border-radius: 13px;
  background: var(--m-accent-deep);
  color: var(--m-text);
}
.cr-consent-sum {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-size: 12.5px;
  color: var(--m-muted);
}
.cr-consent-sum b {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--m-text);
  font-variant-numeric: tabular-nums;
}
.cr-consent-note {
  flex: 1 1 100%;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--m-muted);
}
.cr-consent small {
  flex: 1 1 190px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--m-muted);
}

/* ---------- Ход работы ---------- */
.cr-running {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 8px;
}
.cr-run-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--m-text);
}
.cr-run-progress {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cr-run-bar {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: var(--m-line-soft);
  overflow: hidden;
}
.cr-run-bar i {
  display: block;
  width: var(--cr-run-fill, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--m-accent);
  transition: width 220ms var(--m-ease-out);
}
.cr-run-progress[data-indeterminate="1"] .cr-run-bar i {
  width: 38%;
  animation: cr-run-slide 1.25s var(--m-ease-out) infinite;
}
@keyframes cr-run-slide {
  from { transform: translateX(-110%); }
  to { transform: translateX(300%); }
}
.cr-run-foot {
  display: flex;
  justify-content: flex-start;
  margin-top: 2px;
}
.cr-run-foot .cr-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cr-run-foot svg { width: 14px; height: 14px; }
.cr-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cr-step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 26px;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--m-muted);
}
.cr-step-dot {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border: 1px solid var(--m-line);
  border-radius: 50%;
  background: var(--m-deep);
  color: var(--m-accent-text);
}
.cr-step-dot svg { width: 13px; height: 13px; }
.cr-step[data-state="now"] { color: var(--m-text); }
.cr-step[data-state="now"] .cr-step-dot {
  border-color: var(--m-accent-line);
  background: var(--m-accent-deep);
  animation: cr-pulse var(--m-loop-live) var(--m-ease-out) infinite;
}
.cr-step[data-state="done"] { color: var(--m-text); }
.cr-step[data-state="done"] .cr-step-dot {
  border-color: var(--m-accent-line);
  background: var(--m-accent-deep);
  color: var(--m-accent-text);
}
.cr-run-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--m-muted);
}

/* ---------- Результат ---------- */
.cr-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cr-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cr-result-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--m-success) 15%, var(--m-card));
  color: var(--m-success);
  font-size: 12px;
  font-weight: 700;
}
.cr-result-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.cr-variants {
  display: inline-flex;
  gap: 4px;
}
.cr-variant {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 36px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--m-line);
  border-radius: 9px;
  background: var(--m-deep);
  color: var(--m-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.cr-variant[data-state="active"] {
  border-color: var(--m-accent-line);
  background: var(--m-accent-deep);
  color: var(--m-accent-text);
}
.cr-variant-check {
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
}
.cr-variant-check svg {
  width: 13px;
  height: 13px;
}

.cr-blocks {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}
.cr-text {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--m-line);
  border-radius: 14px;
  background: var(--m-deep);
}
.cr-text-head {
  display: flex;
  height: auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cr-text-head b {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.cr-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--m-line);
  border-radius: 9px;
  background: var(--m-raised);
  color: var(--m-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.cr-copy svg { width: 14px; height: 14px; }
.cr-copy:hover { color: var(--m-text); border-color: var(--m-accent-line); }
.cr-text-body {
  margin: 0;
  font: inherit;
  font-size: 14px;
  line-height: 1.52;
  color: var(--m-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cr-img,
.cr-video {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  min-width: 0;
}
.cr-blocks[data-images]:has(.cr-img) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
.cr-blocks[data-images="1"]:has(.cr-img) {
  grid-template-columns: minmax(0, 1fr);
}
.cr-blocks:empty {
  display: none;
}
.cr-img-open {
  display: block;
  width: 100%;
  aspect-ratio: var(--cr-ar, 4 / 5);
  padding: 0;
  border: 1px solid var(--m-line);
  border-radius: 13px;
  background: var(--m-deep);
  cursor: zoom-in;
  overflow: hidden;
}
.cr-img-open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cr-img figcaption,
.cr-video figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--m-muted);
}
.cr-img figcaption span,
.cr-video figcaption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-img figcaption .cr-img-size {
  flex: none;
  color: var(--m-muted);
  opacity: .8;
  font-variant-numeric: tabular-nums;
}
.cr-ui {
  min-width: 0;
}
.cr-ui[hidden] { display: none; }
.cr-ui .gv-surface {
  padding: 0;
  background: none;
}
.cr-img-dl {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--m-line);
  border-radius: 8px;
  background: var(--m-raised);
  color: var(--m-muted);
  cursor: pointer;
}
.cr-img-dl svg { width: 14px; height: 14px; }
.cr-img-dl:hover { color: var(--m-text); }
.cr-video video {
  display: block;
  width: 100%;
  max-height: 46vh;
  border: 1px solid var(--m-line);
  border-radius: 13px;
  background: #000;
}

.cr-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
}
.cr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--m-line);
  border-radius: 11px;
  background: var(--m-raised);
  color: var(--m-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--m-dur-tap), background var(--m-dur-tap), transform var(--m-dur-tap);
}
.cr-btn:hover { border-color: var(--m-accent-line); }
.cr-btn:active { transform: scale(.98); }
.cr-btn--primary {
  border-color: transparent;
  background: var(--m-accent);
  color: #fff;
}
.cr-btn--primary:hover {
  border-color: transparent;
  background: var(--m-accent-soft);
}
.cr-btn--outline {
  border-color: var(--m-accent-line);
  background: transparent;
  color: var(--m-accent-text);
}
.cr-btn--outline:hover {
  background: var(--m-accent-deep);
}
.cr-text-btn {
  min-height: 34px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--m-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cr-text-btn:hover { color: var(--m-text); }
.cr-status {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--m-muted);
}
.cr-status[hidden] { display: none; }

.cr-return {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px;
  border: 1px solid var(--m-line);
  border-radius: 13px;
  background: var(--m-deep);
}
.cr-return label {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--m-text);
}
.cr-return textarea {
  width: 100%;
  min-height: 64px;
  margin: 0;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid var(--m-line);
  border-radius: 10px;
  background: var(--m-card);
  color: var(--m-text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
}
.cr-return-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ---------- Ошибка ---------- */
.cr-error {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--m-peach-line);
  border-radius: 14px;
  background: var(--m-peach-deep);
}
.cr-error-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border: 1px solid var(--m-peach-line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--m-peach) 14%, var(--m-peach-deep));
  color: var(--m-peach);
}
.cr-error-ico svg { width: 16px; height: 16px; }
.cr-error > div:not(.cr-actions) { flex: 1 1 180px; min-width: 0; }
.cr-error b { display: block; margin-bottom: 2px; font-size: 14px; font-weight: 700; color: var(--m-peach-text); }
.cr-error p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--m-muted); }
.cr-error-hint { margin-top: 5px; font-size: 12.5px; color: var(--m-peach-text); }
.cr-error-money { margin-top: 5px; font-size: 12.5px; color: var(--m-muted); }
.cr-error .cr-actions { width: 100%; margin-top: 2px; }
/* needs_approval: новая оценка и причина, «Продолжить» + «Отменить». */
.cr-approval {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--m-accent-line);
  border-radius: 14px;
  background: var(--m-accent-deep);
}
.cr-approval-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--m-accent-deep);
  color: var(--m-accent-text);
}
.cr-approval-ico svg { width: 17px; height: 17px; }
.cr-approval-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
}
.cr-approval-q {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--m-text);
  overflow-wrap: anywhere;
}
.cr-approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cr-approval-actions .cr-btn { min-height: 42px; }
.cr-approval .cr-status { margin: 0; }
@media (max-width: 420px) {
  .cr-approval-actions .cr-btn { flex: 1 1 132px; }
}

/* ---------- Выбор проекта ---------- */
.cr-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--m-accent-line);
  border-radius: 14px;
  background: var(--m-deep);
}
.cr-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cr-pick-head b { font-size: 14px; font-weight: 700; }
.cr-pick-note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--m-muted); }
.cr-pick-list { display: flex; flex-direction: column; gap: 5px; }
.cr-pick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid var(--m-line);
  border-radius: 10px;
  background: var(--m-card);
  color: var(--m-text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.cr-pick-row:hover { border-color: var(--m-accent-line); }
.cr-pick-new { border-style: dashed; color: var(--m-accent-text); }
.cr-pick-row span:last-child { display: grid; place-items: center; color: var(--m-dim); }
.cr-pick-row svg { width: 16px; height: 16px; }
.cr-pick-status { margin: 0; font-size: 12.5px; color: var(--m-muted); }
.cr-pick-status[hidden] { display: none; }

/* ---------- Просмотр на весь экран ---------- */
.cr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: rgba(3, 4, 7, .96);
  animation: cr-fade var(--m-dur-fade) var(--m-ease-out) both;
}
.cr-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: none;
  padding: 12px 14px;
  color: var(--m-text);
  font-size: 13px;
}
.cr-lightbox-bar > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-lightbox-acts { display: flex; gap: 6px; flex: none; }
.cr-lightbox-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--m-line);
  border-radius: 10px;
  background: var(--m-card);
  color: var(--m-text);
  cursor: pointer;
}
.cr-lightbox-btn svg { width: 17px; height: 17px; }
.cr-lightbox-img {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 12px 16px;
  border: 0;
  background: none;
  cursor: zoom-out;
}
.cr-lightbox-img img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  object-fit: contain;
}

/* ---------- Кадрирование ---------- */
.cr-crop {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(3, 4, 7, .88);
  animation: cr-fade var(--m-dur-fade) var(--m-ease-out) both;
}
.cr-crop-sheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 720px;
  max-height: 92dvh;
  padding: 14px;
  box-sizing: border-box;
  border: 1px solid var(--m-line);
  border-radius: 18px;
  background: var(--m-card);
  overflow: auto;
}
.cr-crop-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cr-crop-head b { flex: 1 1 auto; font-size: 15px; font-weight: 700; }
.cr-crop-head span { font-size: 12px; color: var(--m-accent-text); }
.cr-crop-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 8px;
  box-sizing: border-box;
  border-radius: 12px;
  background: var(--m-deep);
  overflow: hidden;
  touch-action: none;
}
.cr-crop-stage img {
  display: block;
  max-width: 100%;
  max-height: 56vh;
  user-select: none;
  pointer-events: none;
}
.cr-crop-frame {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--m-accent-soft);
  box-shadow: 0 0 0 9999px rgba(3, 4, 7, .55);
  background-image:
    linear-gradient(to right, rgba(232,234,240,.22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(232,234,240,.22) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
  cursor: grab;
  touch-action: none;
}
.cr-crop-frame:active { cursor: grabbing; }
.cr-crop-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--m-muted);
}
.cr-crop-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

@keyframes cr-shimmer {
  0% { opacity: .45; }
  50% { opacity: .9; }
  100% { opacity: .45; }
}
@keyframes cr-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes cr-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cr-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--m-accent) 32%, transparent); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* 3 колонки — от 900, 4 — от 1440. 390 — две. */
@media (min-width: 900px) {
  .cr-grid,
  .cr-skeleton {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
  .cr-tile-body { padding: 11px 13px 13px; }
}
@media (min-width: 1440px) {
  .cr-grid,
  .cr-skeleton {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* На ПК «Создать» — в обычной оболочке с боковой панелью, но сетке нужно больше 640 px. */
@media (min-width: 761px) {
  body[data-nav-k-desk="1"] #app #pc-root[data-desk] .nav-k-desk-main > .nav-k-screen.nav-k-create--creative {
    width: 100%;
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
  }
  .cr-overlay { align-items: center; padding: 24px; box-sizing: border-box; }
  .cr-sheet {
    max-width: 680px;
    max-height: 88vh;
    border-bottom: 1px solid var(--m-line);
    border-radius: 20px;
    animation-name: cr-fade;
  }
  .cr-sheet-head { padding: 16px 18px 12px; }
  .cr-sheet-body { padding: 15px 18px 20px; }
}

@media (max-width: 390px) {
  .cr-actions .cr-btn { flex: 1 1 auto; }
  .cr-drop-text { font-size: 12.5px; }
  .cr-title { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .cr-overlay,
  .cr-sheet,
  .cr-lightbox,
  .cr-crop,
  .cr-tile--skel .cr-tile-cover,
  .cr-tile--skel .cr-tile-body > *,
  .cr-run-progress[data-indeterminate="1"] .cr-run-bar i,
  .cr-step[data-state="now"] .cr-step-dot {
    animation: none !important;
  }
  .cr-run-progress[data-indeterminate="1"] .cr-run-bar i {
    width: 100%;
    transform: none;
  }
  .cr-tile,
  .cr-chip,
  .cr-drop-btn,
  .cr-sheet-x,
  .cr-btn,
  .cr-variant,
  .cr-search-field {
    transition: none !important;
  }
  .cr-tile:active,
  .cr-btn:active {
    transform: none;
  }
}

/* v230s: текст результата — markdown тем же рендером, что в ленте; без сырых ** и `. */
.cr-text-body.cr-md { white-space: normal; }
.cr-text-body.cr-md > :first-child { margin-top: 0; }
.cr-text-body.cr-md > :last-child { margin-bottom: 0; }
.cr-text-body.cr-md p,
.cr-text-body.cr-md ul,
.cr-text-body.cr-md ol,
.cr-text-body.cr-md blockquote { margin: 0 0 8px; }
.cr-text-body.cr-md ul,
.cr-text-body.cr-md ol { padding-left: 20px; }
.cr-text-body.cr-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--m-surface-2, rgba(255, 255, 255, 0.06));
}
.cr-text-body.cr-md pre { margin: 0 0 8px; white-space: pre-wrap; }
.cr-text-body.cr-md a { color: var(--m-accent); }

/* Приватный файл media API: пока грузится — тихая подложка, а не битая иконка; ошибка — текст и «Повторить». */
.cr-img[data-media="loading"] .cr-img-open { cursor: progress; }
.cr-img-wait {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--m-surface-2, rgba(255, 255, 255, 0.05));
  animation: cr-img-wait 1.4s ease-in-out infinite;
}
@keyframes cr-img-wait { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cr-img-wait { animation: none; } }
.cr-img-open--err {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.cr-media-err {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--m-text-2, var(--m-text));
}
.cr-img-dl:disabled { opacity: 0.4; cursor: default; }
