/* ============================================================
   canvas.css — Канва-редактор (/canvas). Самодостаточно.
   ============================================================ */
body[data-page="canvas"] .studio-empty,
body[data-page="canvas"] .composer-wrap { display: none !important; }
body[data-page="canvas"] .studio-feed { padding: 0 !important; }

.cv-root { display: flex; flex-direction: column; width: 100%; height: calc(100vh - 90px); }

/* Панель инструментов */
.cv-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line, rgba(255,255,255,.08));
  background: var(--surface, #15151a);
}
.cv-tool {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 11px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line, rgba(255,255,255,.08));
  color: var(--text, #f4f4f6); font-family: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  transition: background .14s, border-color .14s;
}
.cv-tool svg { width: 18px; height: 18px; }
.cv-tool:hover { background: rgba(255,255,255,.08); }
.cv-tool-primary { background: #ffffff; color: #111111; border-color: transparent; }
.cv-tool-primary:hover { filter: brightness(.94); background: #fff; }
.cv-tool-sep { width: 1px; height: 26px; background: var(--line, rgba(255,255,255,.1)); margin: 0 4px; }
.cv-select {
  padding: 9px 12px; border-radius: 11px; background: rgba(255,255,255,.04);
  border: 1px solid var(--line, rgba(255,255,255,.08)); color: var(--text, #fff); font: inherit; font-size: 13px; cursor: pointer;
}
.cv-bg { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2, #a6a6b0); font-size: 13px; font-weight: 600; }
.cv-bg input[type="color"] { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; padding: 0; }

/* Рабочая область: сцена + инспектор */
.cv-workspace { flex: 1; display: flex; min-height: 0; }
.cv-stage-wrap { flex: 1; display: flex; align-items: flex-start; justify-content: center; overflow: auto; padding: 16px;
  background: repeating-conic-gradient(#101014 0% 25%, #16161c 0% 50%) 50% / 28px 28px; }
.cv-stage { position: relative; transform-origin: top center; box-shadow: 0 20px 60px -20px rgba(0,0,0,.7); overflow: hidden; }

/* Элементы на сцене */
.cv-el { position: absolute; cursor: move; user-select: none; box-sizing: border-box; }
.cv-el.sel { outline: 2px solid var(--accent, #d1fe17); outline-offset: 1px; }
.cv-el-text { display: flex; align-items: center; }
.cv-el-text .cv-text-inner { width: 100%; line-height: 1.2; overflow-wrap: break-word; }
.cv-el-image { background-size: cover; background-position: center; }
.cv-resize { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent, #d1fe17); border: 2px solid #14180a; cursor: nwse-resize; }

/* Инспектор */
.cv-inspector { width: 280px; flex: none; border-left: 1px solid var(--line, rgba(255,255,255,.08));
  background: var(--surface, #15151a); padding: 18px 16px; overflow-y: auto; }
.cv-insp-empty { color: var(--text-3, #8a8a93); font-size: 13.5px; line-height: 1.6; text-align: center; padding: 30px 8px; }
.cv-insp-title { font-family: var(--font-display, inherit); font-weight: 700; font-size: 16px; margin-bottom: 14px; }
.cv-lbl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3, #8a8a93); margin: 14px 0 6px; }
.cv-in { width: 100%; box-sizing: border-box; background: rgba(255,255,255,.04); border: 1px solid var(--line, rgba(255,255,255,.08));
  border-radius: 10px; padding: 9px 11px; color: var(--text, #fff); font: inherit; font-size: 13.5px; resize: none; }
.cv-in:focus { outline: none; border-color: var(--accent, #d1fe17); }
select.cv-in { cursor: pointer; }
input[type="range"].cv-in { padding: 0; }

.cv-seg2 { display: flex; gap: 5px; }
.cv-seg2 button { flex: 1; padding: 8px 4px; border-radius: 8px; border: 1px solid var(--line, rgba(255,255,255,.08));
  background: rgba(255,255,255,.03); color: var(--text-2, #c7c7cf); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.cv-seg2 button.on { background: #ffffff; color: #111111; border-color: transparent; }

.cv-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-swatch { width: 26px; height: 26px; border-radius: 7px; border: 1px solid rgba(255,255,255,.18); cursor: pointer; padding: 0; position: relative; }
.cv-swatch.on { box-shadow: 0 0 0 2px var(--accent, #d1fe17); }
.cv-swatch-custom { display: grid; place-items: center; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.cv-swatch-custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.cv-insp-actions { display: flex; flex-direction: column; gap: 7px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line, rgba(255,255,255,.08)); }
.cv-ibtn { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-start; padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line, rgba(255,255,255,.08)); color: var(--text, #fff); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.cv-ibtn svg { width: 16px; height: 16px; }
.cv-ibtn:hover { background: rgba(255,255,255,.08); }
.cv-ibtn.danger { color: #f87171; }
.cv-ibtn.danger:hover { background: rgba(248,113,113,.1); }

@media (max-width: 900px) {
  .cv-workspace { flex-direction: column; }
  .cv-inspector { width: 100%; border-left: 0; border-top: 1px solid var(--line); max-height: 40vh; }
  .cv-root { height: auto; }
}
/* «Новый чат» в канве не нужен */
body[data-page="canvas"] #studio-new, body[data-page="canvas"] .new-btn { display: none !important; }
