/* Card designer (Фото → Конструктор карточек). Uses the portal's glass tokens. */
.cd { display: flex; flex-direction: column; gap: 12px; }
.cd button, .cd input, .cd select, .cd textarea { font-family: inherit; }
.cd-loading { padding: 40px; text-align: center; color: var(--muted); }
.cd-loading.error { color: var(--red); }
.cd-i { width: 18px; height: 18px; flex: none; display: block; }
.cd-tb .cd-i { width: 17px; height: 17px; }

/* slides and top actions */
.cd-head { display: flex; gap: 10px; align-items: center; }
.cd-head .cd-gen-go { flex: none; }
.cd-slides { flex: 1 1 auto; min-width: 0; display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.cd-slide { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--edge, rgba(0,0,0,.12));
  background: var(--surface-soft, rgba(255,255,255,.6)); color: var(--ink, #1d1b17); font-weight: 600; font-size: 13px; line-height: 1; cursor: pointer; white-space: nowrap; }
.cd-slide b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(29,27,23,.1); font-size: 11px; }
.cd-slide.saved b { background: var(--green, #3f8f5a); color: #fff; }
.cd-slide.on { background: var(--dark, #1f1e1b); color: #fff; border-color: var(--dark, #1f1e1b); }
.cd-slide.on b { background: rgba(255,255,255,.2); }
.cd-top { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: space-between; }
.cd-card { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; min-width: 0; }
.cd-card-label { font-size: 13px; color: var(--muted); }
.cd-card select { width: auto; max-width: 190px; min-width: 0; }
.cd-card select[data-cd="variant"] { max-width: 330px; }
/* owner 2026-11-29 «текст не влазит в поле»: the portal's selects keep 46 px for the arrow — too much for the narrow settings
   column («По центру» was cut). Compact fields inside the designer: the arrow 10 px from the edge, the text gets the room. */
.glass .cd select { padding-left: 12px; padding-right: 30px; background-position: right 10px center; background-size: 14px 14px; font-size: 13px; }
.glass .cd .cd-right input[type="number"], .glass .cd .cd-right input[type="text"] { padding: 0 10px; font-size: 13px; }
.cd-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cd-ico { padding-left: 10px; padding-right: 10px; }
.cd-more { position: relative; }
.cd-more > summary { list-style: none; cursor: pointer; }
.cd-more > summary::-webkit-details-marker { display: none; }
.cd-more > summary::after { content: "▾"; margin-left: 6px; font-size: 11px; opacity: .6; }
.cd-more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 290px; display: grid; gap: 2px; padding: 6px; border-radius: 14px;
  background: var(--surface-strong, #fff); border: 1px solid rgba(29,27,23,.12); box-shadow: 0 12px 32px rgba(20,18,16,.18); }
.cd-more-menu button, .cd-more-ver { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink, #1d1b17); font-size: 13px; text-align: left; cursor: pointer; box-sizing: border-box; }
.cd-more-menu button:hover, .cd-more-ver:hover { background: rgba(29,27,23,.06); }
.cd-more-ver select { flex: 1; min-width: 0; }
.cd-more-help { margin: 4px 0 0; padding: 8px 10px 4px; border-top: 1px solid rgba(29,27,23,.08); font-size: 12px; line-height: 1.4; color: var(--muted); }
.cd-actions .button[disabled] { opacity: .4; pointer-events: none; }
.cd-snap.on { color: #b3127c; background: rgba(255,47,179,.08); }
.cd-snap.on::after { content: "вкл."; margin-left: auto; font-size: 11px; font-weight: 600; }

/* three columns */
.cd-main { display: grid; grid-template-columns: 256px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.cd-left, .cd-right { background: var(--surface, rgba(255,255,255,.7)); border: 1px solid var(--edge, rgba(0,0,0,.1)); border-radius: 18px; padding: 12px;
  max-height: calc(100vh - 150px); overflow-y: auto; overflow-x: hidden; min-width: 0; box-sizing: border-box; }
.cd-right h3 { margin: 0 0 10px; font-size: 15px; }
.cd-right h4 { margin: 16px 0 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }

/* left: tabs, add tiles, layers */
.cd-tabs { display: flex; gap: 3px; padding: 3px; margin-bottom: 10px; border-radius: 12px; background: rgba(29,27,23,.07); }
/* owner 2026-11-29 «текст не влазит в поле»: the tab grows with its word, its own font size, never touching the pill's edges */
.cd-tabs button { flex: 1 1 auto; min-width: 0; border: 0; border-radius: 9px; padding: 7px 10px; background: transparent; color: var(--muted);
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; cursor: pointer; }
.cd-tabs button.on { background: #fff; color: var(--ink, #1d1b17); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.cd-sect + .cd-sect { margin-top: 10px; }
.cd-sect h5 { margin: 0 0 6px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.cd-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.cd-tile { display: grid; justify-items: center; gap: 5px; min-width: 0; padding: 6px 6px 8px; border: 1px solid transparent; border-radius: 12px;
  background: rgba(255,255,255,.45); color: var(--ink, #1d1b17); cursor: pointer; font-size: 11px; line-height: 1.2; text-align: center; }
.cd-tile:hover { background: #fff; border-color: rgba(29,27,23,.12); }
.cd-tile span { display: block; max-width: 100%; min-width: 0; overflow-wrap: break-word; hyphens: auto; }
/* owner 2026-11-29: the add list as a catalog — every item drawn as it will look on the slide */
.cd-prev { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 8px; background: #1b1b1f radial-gradient(120% 90% at 50% 0%, #2c2c31, #141417); }
.cd-tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cd-tile.sym .cd-prev { aspect-ratio: 1; }
.cd-add-search { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 0 10px; border-radius: 10px; background: rgba(255,255,255,.6);
  border: 1px solid rgba(29,27,23,.1); color: var(--muted); }
.cd-add-search .cd-i { width: 15px; height: 15px; flex: none; }
.cd-add-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0; font-size: 13px; outline: none; color: var(--ink, #1d1b17); }
.cd-cats { display: grid; gap: 6px; }
.cd-cat { display: grid; grid-template-columns: 80px minmax(0, 1fr) 14px; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; border: 1px solid transparent;
  border-radius: 12px; background: rgba(255,255,255,.45); color: var(--ink, #1d1b17); cursor: pointer; text-align: left; }
.cd-cat:hover { background: #fff; border-color: rgba(29,27,23,.12); }
.cd-cat-prevs { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; width: 80px; height: 52px; }
.cd-cat-prevs .cd-prev { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 6px; }
.cd-cat-prevs .cd-prev:first-child { grid-row: 1 / 3; }
.cd-cat-name { display: grid; gap: 2px; min-width: 0; font-size: 13px; font-weight: 600; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; }
.cd-cat-name small { font-size: 11px; font-weight: 500; color: var(--muted); }
.cd-cat > .cd-i { width: 14px; height: 14px; color: var(--muted); }
.cd-add-back { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 6px; padding: 5px 10px 5px 6px; border: 0; border-radius: 9px;
  background: rgba(29,27,23,.06); color: var(--ink, #1d1b17); font-size: 12px; font-weight: 600; cursor: pointer; }
.cd-add-back .cd-i { width: 14px; height: 14px; }
.cd-add-title { margin: 4px 0 8px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.cd-pair { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 8px; align-items: center; }
.cd-pair input[type=number] { min-width: 0; padding-left: 10px; padding-right: 6px; }
.cd-addbtn { display: inline-flex; align-items: center; gap: 6px; width: 100%; justify-content: center; }
.cd-addbtn .cd-i { width: 16px; height: 16px; }
.cd-selbar-empty { font-size: 12px; color: var(--muted); }
.cd-layers { display: grid; gap: 2px; }
.cd-layer { display: flex; align-items: center; gap: 4px; padding: 5px 4px 5px 2px; border-radius: 9px; cursor: pointer; font-size: 13px; position: relative; }
.cd-layer:hover { background: rgba(29,27,23,.06); }
.cd-layer.on { background: var(--dark, #1f1e1b); color: #fff; }
.cd-layer.off span { opacity: .45; }
.cd-layer.dragging { opacity: .4; }
.cd-layer.drop-above { box-shadow: inset 0 2px 0 #4da3ff; }
.cd-layer.drop-below { box-shadow: inset 0 -2px 0 #4da3ff; }
.cd-layer span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-layer em { font-style: normal; font-size: 10px; padding: 1px 5px; border-radius: 6px; background: rgba(224,0,42,.15); color: #b0001f; }
.cd-layer.on em { color: #fff; background: rgba(255,255,255,.2); }
.cd-layer button { border: 0; background: transparent; color: inherit; padding: 3px; border-radius: 6px; cursor: pointer; opacity: .55; }
.cd-layer button:hover { opacity: 1; background: rgba(127,127,127,.2); }
.cd-layer button .cd-i { width: 15px; height: 15px; }
.cd-grip { cursor: grab; opacity: .4; display: flex; }
.cd-grip .cd-i { width: 14px; height: 14px; }
.cd-gl { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cd-layer-bg { margin-top: 4px; padding-left: 10px; border-top: 1px dashed rgba(29,27,23,.15); border-radius: 0 0 9px 9px; color: var(--muted); }
.cd-empty, .cd-note { font-size: 12px; color: var(--muted); }
.cd-note { margin: 8px 0; line-height: 1.35; }

/* stage and the bar above it */
.cd-stage-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.cd-selbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; width: 100%; min-height: 34px; }
.cd-sel-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.cd-tbg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 11px; background: var(--surface, rgba(255,255,255,.7)); border: 1px solid var(--edge, rgba(0,0,0,.1)); }
.cd-tb { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 9px; background: transparent; color: var(--ink, #1d1b17); cursor: pointer; }
.cd-tb:hover { background: rgba(29,27,23,.08); }
.cd-tb[disabled], .cd-tb[data-off] { opacity: .3; pointer-events: none; }
.cd-tb[data-danger]:hover { color: #c4001f; background: rgba(224,0,42,.1); }
.cd-color i { position: absolute; right: 4px; bottom: 4px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.cd-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.cd-stage { position: relative; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 50px -20px rgba(0,0,0,.45); background: #0a0a0c; touch-action: none; }
.cd-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cd-over { position: absolute; inset: 0; cursor: default; }
.cd-box { position: absolute; outline: 1.5px solid #4da3ff; outline-offset: 0; pointer-events: none; }
.cd-box.locked { outline-style: dashed; outline-color: #ffb020; }
.cd-box.member { outline: 1px solid rgba(77,163,255,.6); }
.cd-box.multi { outline: 1.5px dashed #4da3ff; }
.cd-box.multi.grouped { outline-style: solid; outline-width: 2px; }
.cd-h { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 3px; background: #fff; border: 1.5px solid #4da3ff; pointer-events: auto; box-sizing: border-box; }
.cd-h-nw { left: 0; top: 0; cursor: nwse-resize; } .cd-h-n { left: 50%; top: 0; cursor: ns-resize; } .cd-h-ne { left: 100%; top: 0; cursor: nesw-resize; }
.cd-h-e { left: 100%; top: 50%; cursor: ew-resize; } .cd-h-se { left: 100%; top: 100%; cursor: nwse-resize; } .cd-h-s { left: 50%; top: 100%; cursor: ns-resize; }
.cd-h-sw { left: 0; top: 100%; cursor: nesw-resize; } .cd-h-w { left: 0; top: 50%; cursor: ew-resize; }
.cd-rot { left: 50%; top: -30px; border-radius: 50%; cursor: grab; }
.cd-rot::after { content: ""; position: absolute; left: 4px; top: 10px; width: 1.5px; height: 18px; background: #4da3ff; }

/* inspector fields */
.cd-f { display: grid; gap: 4px; margin-bottom: 8px; font-size: 12px; color: var(--muted); min-width: 0; }
.cd-f input, .cd-f select, .cd-right textarea { width: 100%; box-sizing: border-box; font-size: 13px; line-height: 1.3; }
.cd-f input[type="color"] { height: 34px; padding: 2px; }
.cd-right textarea { min-height: 54px; resize: vertical; margin-bottom: 6px; }
.cd-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.cd-check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 4px 0; }
.cd-sec { margin-top: 14px; border-top: 1px solid rgba(29,27,23,.1); padding-top: 8px; }
.cd-sec summary { cursor: pointer; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; padding: 4px 0 8px; }
.cd-callout { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: rgba(77,163,255,.1); font-size: 12px; line-height: 1.35; }
.cd-callout .text-button { display: block; margin-top: 4px; font-size: 12px; }
.cd-bigbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; }
.cd-bigbtns .button { justify-content: center; gap: 6px; }
.cd-list { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.cd-tokens { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; }
.cd-tokens button { border: 1px solid rgba(29,27,23,.15); background: rgba(255,255,255,.6); border-radius: 8px; padding: 3px 7px; font-size: 12px; font-weight: 500; line-height: 1.2; cursor: pointer; }
.cd-tokens button:hover { background: #fff; }
.cd-assets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.cd-asset { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; aspect-ratio: 3/4; cursor: pointer; background: #222; }
.cd-asset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cd-asset.on { border-color: #4da3ff; }
.cd-upload { display: grid; place-items: center; align-content: center; gap: 4px; aspect-ratio: 3/4; border: 1.5px dashed rgba(29,27,23,.3); border-radius: 10px;
  font-size: 12px; color: var(--muted); cursor: pointer; }
.cd-upload svg { width: 18px; height: 18px; }
.cd-del { font-size: 12px; margin-bottom: 8px; }

/* gradient presets and font picker */
.cd-grads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.cd-grad { display: grid; gap: 3px; min-width: 0; padding: 0; border: 0; background: transparent; cursor: pointer; font-size: 10.5px; font-weight: 500; line-height: 1.15;
  color: var(--muted); text-align: center; }
.cd-grad img { width: 100%; aspect-ratio: 3/4; display: block; border-radius: 8px; border: 2px solid transparent; box-sizing: border-box; }
.cd-grad span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.3em; }
.cd-grad.on img { border-color: #4da3ff; }
.cd-grad.on span { color: var(--ink, #1d1b17); font-weight: 700; }
.cd-fonts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.cd-font { display: grid; gap: 2px; min-width: 0; padding: 0; border: 0; background: transparent; cursor: pointer; font-size: 10.5px; font-weight: 500; line-height: 1.15;
  color: var(--muted); text-align: left; }
.cd-font img { width: 100%; aspect-ratio: 260/64; display: block; border-radius: 7px; border: 2px solid transparent; box-sizing: border-box; }
.cd-font span { padding: 0 2px; overflow-wrap: anywhere; }  /* the whole name, on two lines when long (was cut with «…») */
.cd-font.on img { border-color: #4da3ff; }
.cd-font.on span { color: var(--ink, #1d1b17); font-weight: 700; }

/* template sets */
.cd-wide { width: 100%; justify-content: center; gap: 6px; margin-bottom: 6px; font-size: 13px; }
.cd-sets { display: grid; gap: 8px; margin-top: 10px; }
.cd-set { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.5); border: 1px solid rgba(29,27,23,.08); }
.cd-set canvas { width: 60px; height: 80px; border-radius: 6px; background: #0a0a0c; display: block; }
.cd-set b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-set span { display: block; font-size: 11px; color: var(--muted); margin: 2px 0 6px; }
.cd-set .button { padding: 5px 10px; font-size: 12px; }
.cd-set .cd-del { display: block; margin: 4px 0 0; }
/* generate dialog */
.cd-gen-search { display: flex; gap: 8px; }
.cd-gen-search input { flex: 1; min-width: 0; font-size: 14px; }
.cd-chip { justify-self: start; margin-top: 2px; padding: 1px 6px; border-radius: 6px; font-size: 10.5px; background: rgba(29,27,23,.07); color: var(--muted); }
.cd-chip.ready { background: rgba(63,143,90,.14); color: #2f6f45; }
.cd-chip.queued, .cd-chip.running { background: rgba(255,176,32,.18); color: #8a5a00; }
.cd-chip.error { background: rgba(224,0,42,.12); color: #b0001f; }
.cd-gen-status { margin: 0; font-size: 13px; font-weight: 600; }
/* pages: «Генерация карточек» and «Согласование карточек» */
.cd-page { gap: 14px; }
.cd-page-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.cd-page-head .cd-gen-search { flex: 1 1 360px; max-width: 640px; }
.cd-page-actions { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.cd-tree { display: grid; gap: 6px; }
.cd-tm { border: 1px solid var(--edge, rgba(0,0,0,.1)); border-radius: 14px; background: var(--surface, rgba(255,255,255,.7)); overflow: hidden; }
.cd-tm-row, .cd-ts-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; }
.cd-tm-row img { width: 44px; height: 36px; object-fit: contain; background: #fff; border-radius: 6px; }
.cd-tm-row b { font-size: 14px; }
.cd-tm-toggle { border: 0; background: transparent; cursor: pointer; font-size: 14px; width: 22px; color: var(--muted); }
.cd-tm-meta { font-size: 12px; color: var(--muted); }
.cd-tc { margin: 0 12px 6px 34px; border-left: 2px solid rgba(29,27,23,.12); }
.cd-tc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 12px; }
.cd-tc-row img { width: 36px; height: 30px; object-fit: contain; background: #fff; border-radius: 6px; }
.cd-tc-row b { font-size: 13px; }
.cd-ts { margin: 0 12px 6px 34px; border-left: 2px solid rgba(29,27,23,.08); }
.cd-ts-one { margin-left: 34px; cursor: pointer; font-size: 13px; }
.cd-ts-one:hover, .cd-ts-one + .cd-ts-one:hover { background: rgba(29,27,23,.04); }
.cd-ts-row b { font-size: 13px; }
.cd-tp { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 5px 12px 5px 34px; font-size: 13px; cursor: pointer; }
.cd-tp:hover { background: rgba(29,27,23,.04); }
.cd-st { font-size: 11px; padding: 1px 7px; border-radius: 7px; background: rgba(29,27,23,.07); color: var(--muted); white-space: nowrap; }
.cd-st.generating { background: rgba(255,176,32,.18); color: #8a5a00; }
.cd-st.review { background: rgba(77,163,255,.16); color: #1d5fa8; }
.cd-st.approved { background: rgba(63,143,90,.16); color: #2f6f45; }
.cd-st.rejected, .cd-st.error { background: rgba(224,0,42,.12); color: #b0001f; }
.cd-page-foot { position: sticky; bottom: 8px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-radius: 16px; background: var(--surface-strong, #fbf8f2); box-shadow: 0 10px 30px -12px rgba(0,0,0,.35); }
.cd-page-foot .cd-note { margin: 4px 0 0; }
.cd-page-foot .button[disabled] { opacity: .45; pointer-events: none; }
.cd-ap-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.cd-ap-tab { border: 1px solid var(--edge, rgba(0,0,0,.12)); background: var(--surface-soft, rgba(255,255,255,.6)); border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.cd-ap-tab.on { background: var(--dark, #1f1e1b); color: #fff; }
.cd-ap-tab b { margin-left: 4px; }
.cd-ap-list { display: grid; gap: 10px; }
.cd-ap-item { display: grid; grid-template-columns: auto minmax(160px, 260px) minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px;
  border-radius: 16px; border: 1px solid var(--edge, rgba(0,0,0,.1)); background: var(--surface, rgba(255,255,255,.7)); }
.cd-ap-gen { display: flex; gap: 8px; }
.cd-ap-item figure { margin: 0; display: grid; gap: 4px; }
.cd-ap-gen canvas { width: 165px; height: 220px; border-radius: 10px; background: #0a0a0c; display: block; }
.cd-ap-item figcaption { font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px; }
.cd-ap-item figcaption button { border: 0; border-radius: 6px; padding: 1px 6px; font-size: 11px; cursor: pointer; background: rgba(29,27,23,.07); }
.cd-ap-item figcaption button.on { background: var(--dark, #1f1e1b); color: #fff; }
.cd-ap-orig img { width: 100%; max-height: 220px; object-fit: contain; background: #fff; border-radius: 10px; }
.cd-ap-info { display: grid; gap: 6px; align-content: start; font-size: 13px; }
.cd-ap-info .cd-st { justify-self: start; }
.cd-ap-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.cd-ap-pager { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.cd-ap-pager button { min-width: 32px; border: 1px solid var(--edge, rgba(0,0,0,.12)); border-radius: 8px; background: transparent; padding: 4px 8px; cursor: pointer; }
.cd-ap-pager button.on { background: var(--dark, #1f1e1b); color: #fff; }
@media (max-width: 900px) { .cd-ap-item { grid-template-columns: 1fr; } }
/* marketplace fields over the slide */
.cd-mp-btn.on { border-color: #ffb020; background: rgba(255,176,32,.12); }
.cd-mp-zone { position: absolute; pointer-events: none; box-sizing: border-box; border: 2px dashed var(--mp); background: color-mix(in srgb, var(--mp) 18%, transparent); border-radius: 6px; }
.cd-mp-zone b { position: absolute; left: 3px; top: 3px; max-width: calc(100% - 6px); font: 600 9px/1.15 system-ui, sans-serif; color: #111; background: var(--mp); padding: 1px 4px; border-radius: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-mp-zone.o b { left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: none; } /* round icon zones: label in the middle */
.cd-mp-zone:not(.o) b { left: 6%; top: 50%; transform: translateY(-50%); } /* pills and buttons: label inside the rounded shape */
.cd-mp-legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; max-width: 100%; }
.cd-mp-chip { border: 2px solid var(--mp); background: transparent; border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; opacity: .5; }
.cd-mp-chip.on { background: color-mix(in srgb, var(--mp) 25%, transparent); opacity: 1; }
/* smart guides while dragging */
.cd-guide { position: absolute; background: #ff2fb3; pointer-events: none; box-shadow: 0 0 0 .5px rgba(0,0,0,.25); }
.cd-guide.v { width: 1px; margin-left: -.5px; }
.cd-guide.h { height: 1px; margin-top: -.5px; }
.cd-guide.page.v { background: repeating-linear-gradient(180deg, #ff2fb3 0 5px, transparent 5px 9px); }
.cd-guide.page.h { background: repeating-linear-gradient(90deg, #ff2fb3 0 5px, transparent 5px 9px); }
.cd-gap { position: absolute; pointer-events: none; }
.cd-gap.h { height: 0; border-top: 1px solid #ff2fb3; }
.cd-gap.v { width: 0; border-left: 1px solid #ff2fb3; }
.cd-gap.h::before, .cd-gap.h::after { content: ""; position: absolute; top: -4px; width: 1px; height: 7px; background: #ff2fb3; }
.cd-gap.h::before { left: 0; } .cd-gap.h::after { right: 0; }
.cd-gap.v::before, .cd-gap.v::after { content: ""; position: absolute; left: -4px; width: 7px; height: 1px; background: #ff2fb3; }
.cd-gap.v::before { top: 0; } .cd-gap.v::after { bottom: 0; }
.cd-gap b, .cd-match b { position: absolute; padding: 2px 5px; border-radius: 5px; background: #ff2fb3; color: #fff; font: 700 10px/1.1 system-ui, sans-serif; white-space: nowrap; }
.cd-gap.h b { left: 50%; top: 0; transform: translate(-50%, -130%); }
.cd-gap.v b { top: 50%; left: 0; transform: translate(6px, -50%); }
.cd-match { position: absolute; outline: 1px dashed #ff2fb3; pointer-events: none; }
.cd-match b { left: 0; top: 0; transform: translateY(-120%); }

/* laptops: tools and the slide side by side, the settings panel under them (the slide stays on the first screen) */
@media (max-width: 1180px) {
  .cd-main { grid-template-columns: 256px minmax(0, 1fr); }
  .cd-right { grid-column: 1 / -1; max-height: 70vh; }
  .cd-tile { font-size: 10.5px; }
  .cd-grads { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
}
@media (max-width: 760px) {
  .cd-main { grid-template-columns: 1fr; }
  .cd-card { flex-wrap: wrap; width: 100%; }
  .cd-card select, .cd-card select[data-cd="variant"] { flex: 1 1 100%; max-width: none; }  /* phones: the whole model and size, each on its own row */
  .cd-left { max-height: none; }
  .cd-tiles { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}

/* owner 2026-11-29: a set opens with all its slides at once */
.cd-set canvas, .cd-set b[data-cd] { cursor: pointer; }
.cd-setview { position: fixed; inset: 0; z-index: 60; background: rgba(12,12,14,.62); display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow: auto; }
.cd-setview-card { width: min(1180px, 100%); background: var(--panel, #f6f3ee); border-radius: 18px; padding: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.cd-setview-card header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.cd-setview-card header div { flex: 1 1 220px; min-width: 0; }
.cd-setview-card header b { display: block; font-size: 17px; }
.cd-setview-card header span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-setview-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .cd-setview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cd-setview { padding: 12px 8px; } .cd-setview-card { padding: 12px; } .cd-setview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.cd-setview-grid figure { margin: 0; }
.cd-setview-grid canvas { width: 100%; height: auto; aspect-ratio: 3 / 4; border-radius: 10px; background: #0a0a0c; display: block; }
.cd-setview-grid figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: center; }

/* owner 2026-11-29 «сделать интерфейс логичным и удобным»: hint, recent items, drag onto the slide, icons by picture */
.cd-add-hint { margin: -2px 0 10px; font-size: 12px; line-height: 1.35; color: var(--muted); }
.cd-recent { margin-bottom: 12px; }
.cd-tile[draggable="true"] { cursor: grab; }
.cd-dragging .cd-stage { outline: 2px dashed rgba(77,163,255,.55); outline-offset: 4px; }
.cd-stage.cd-drop { outline: 2px solid #4da3ff; outline-offset: 4px; }
.cd-iconpick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 2px 0 12px; }
.cd-ipick { display: grid; place-items: center; padding: 3px; border: 2px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; }
.cd-ipick .cd-prev { aspect-ratio: 1; border-radius: 7px; }
.cd-ipick:hover { border-color: rgba(29,27,23,.15); }
.cd-ipick.on { border-color: #4da3ff; }
.cd-ipick-none { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 7px; background: rgba(29,27,23,.07); color: var(--muted); font-size: 18px; }
.cd-tiles.cd-recent { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.cd-recent .cd-tile { padding: 3px; }

/* owner 2026-11-30: Apple-like icon styles — the Apple palette for a tile in one click */
.cd-swatches { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.cd-sw { width: 26px; height: 26px; padding: 0; border-radius: 8px; border: 1px solid rgba(0,0,0,.14); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.cd-sw:hover { transform: translateY(-1px); }
.cd-sw.on { outline: 2px solid #1b1b1f; outline-offset: 2px; }

/* owner 2026-11-30: one editor for shapes, plates and badge plates — ready looks as chips */
.cd-looks { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-look { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px 6px 7px; border-radius: 999px; border: 1px solid rgba(27,27,31,.14);
  background: rgba(255,255,255,.7); font: inherit; font-size: 13px; color: #1b1b1f; cursor: pointer; white-space: nowrap; }
.cd-look.on { background: #1b1b1f; color: #fff; border-color: #1b1b1f; }
.cd-look i { width: 18px; height: 18px; border-radius: 6px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.cd-look-glass { background: linear-gradient(135deg, rgba(40,40,46,.9), rgba(14,14,17,.55)); }
.cd-look-red { background: linear-gradient(135deg, rgba(255,31,69,.75), rgba(255,31,69,.25)); }
.cd-look-custom { background: conic-gradient(#ff3b30, #ffcc00, #34c759, #007aff, #af52de, #ff3b30); }

/* owner 2026-11-30: the set that is on the slides now — marked, and «Обновить набор» writes the edits back into it */
.cd-set.on { border-color: rgba(27,27,31,.55); box-shadow: 0 0 0 1px rgba(27,27,31,.35); background: rgba(255,255,255,.78); }
.cd-set-now { display: inline-block; margin: 3px 0 0; padding: 2px 8px; border-radius: 999px; background: #1b1b1f; color: #fff; font-style: normal; font-size: 11px; }
.cd-set .text-button { display: block; margin: 4px 0 0; }
.cd-set b { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.25; }
.cd-set .text-button { text-align: left; line-height: 1.3; font-size: 12px; }

/* owner 2026-11-30: filters in «Генерация карточек» and a visible way into the colours of a model */
.cd-gen-filters { display: grid; gap: 8px; margin: 12px 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface, rgba(255,255,255,.6)); border: 1px solid var(--edge, rgba(0,0,0,.08)); }
.cd-flabel { font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 6px; }
.cd-fsum { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; }
.cd-tm-open { border: 1px solid rgba(29,27,23,.16); background: rgba(255,255,255,.8); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; color: inherit; white-space: nowrap; }
.cd-tm-open[aria-expanded="true"] { background: #1b1b1f; color: #fff; border-color: #1b1b1f; }
.cd-ff { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: rgba(255,31,69,.12); color: #c8102e; font-style: normal; font-size: 11px; font-weight: 700; vertical-align: 1px; }

/* owner 2026-11-30 «чтобы весь ряд карточек был виден, без промотки»: all slides as equal tiles in one row — the number
   above the name, so even «Характеристики» fits without breaking the word; a narrow window wraps the tiles, never scrolls */
.cd-head { display: block; }
.cd-slides { display: grid; grid-template-columns: repeat(auto-fit, minmax(113px, 1fr)); gap: 5px; overflow: visible; padding: 0; }
.cd-slide { min-width: 0; flex-direction: column; justify-content: center; gap: 4px; padding: 6px 5px 7px; border-radius: 14px; font-size: 12px; line-height: 1.15; white-space: nowrap; text-align: center; }
.cd-slide b { flex: none; width: 18px; height: 18px; font-size: 10.5px; }
.cd-slide span { max-width: 100%; }
.cd-actions .cd-gen-go { margin-right: 4px; }
@media (max-width: 520px) { .cd-slides { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 4px; } .cd-slide { font-size: 11.5px; padding: 5px 4px 6px; } }

/* owner 2026-11-30 «Это что за уродство? Ты сделай нормальные фильтры»: one compact bar — a three-way switch, a drop-down and
   two-handle range sliders */
.cd-gen-filters { gap: 10px; padding: 14px 16px; }
.cd-fbar { display: grid; grid-template-columns: minmax(170px, 230px) minmax(170px, 220px) repeat(3, minmax(160px, 1fr)); gap: 14px 26px; align-items: end; }
.cd-fgrp { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cd-flabel { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0; }
.cd-seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(29,27,23,.07); gap: 2px; }
.cd-seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; color: inherit; cursor: pointer; white-space: nowrap; }
.cd-seg button small { margin-left: 6px; font-size: 11px; font-weight: 500; color: var(--muted); }
.cd-seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.glass .cd .cd-fgrp select { height: 38px; width: 100%; }
.cd-frange-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cd-frange-head b { font-size: 13px; white-space: nowrap; }
.cd-dual { position: relative; height: 26px; }
.cd-dual-track { position: absolute; left: 9px; right: 9px; top: 11px; height: 4px; border-radius: 2px; background: rgba(29,27,23,.14); }
.cd-dual-track i { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: #1b1b1f; }
.cd .cd-dual input[type="range"] { position: absolute; inset: 0; width: 100%; height: 26px; margin: 0; padding: 0; background: none; border: 0; box-shadow: none;
  pointer-events: none; -webkit-appearance: none; appearance: none; outline: none; }
.cd .cd-dual input[type="range"]::-webkit-slider-runnable-track { background: none; border: 0; height: 26px; }
.cd .cd-dual input[type="range"]::-moz-range-track { background: none; border: 0; }
.cd .cd-dual input[type="range"]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: 4px;
  border-radius: 50%; background: #fff; border: 2px solid #1b1b1f; box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab; }
.cd .cd-dual input[type="range"]::-moz-range-thumb { pointer-events: auto; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid #1b1b1f; cursor: grab; }
.cd .cd-dual input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(27,27,31,.18); }
.cd-dual.off { opacity: .4; }
.cd-fsum { padding-top: 2px; border-top: 1px solid rgba(29,27,23,.08); padding-top: 10px; }
@media (max-width: 1180px) { .cd-fbar { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.cd-frange-head b.all { color: var(--muted); font-weight: 600; }

/* owner 2026-12-01: the value beside every slider (it can be typed) and the slider's range under it */
.cd-range { display: flex; gap: 6px; align-items: center; min-width: 0; }
.cd-range input[type="range"] { flex: 1 1 auto; min-width: 0; width: auto; }
.cd-f .cd-range input.cd-range-n { flex: 0 0 60px; width: 60px; -moz-appearance: textfield; appearance: textfield; min-width: 0; height: 26px; min-height: 0; padding: 2px 5px; border-radius: 7px; font-size: 12px; line-height: 1; text-align: right; box-shadow: none; }
.cd-range-lim { display: flex; justify-content: space-between; font-size: 10px; line-height: 1; color: var(--muted); opacity: .75; margin-top: -1px; }
.cd-range input.cd-range-n::-webkit-inner-spin-button, .cd-range input.cd-range-n::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
