/* Visual CMS v3 — интерфейс редактора. В публичном режиме используется только .cms-try */
.cms-ui, .cms-ui * { box-sizing: border-box; font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; letter-spacing: normal; text-transform: none; }
.cms-ui svg { width: 16px; height: 16px; flex: none; }

/* подсветка редактируемого */
.cms-editing [data-cms-k]:not(img) { outline: 1px dashed transparent; outline-offset: 3px; border-radius: 3px; transition: outline-color .15s, background-color .15s; cursor: text; }
.cms-editing [data-cms-k]:not(img):hover { outline-color: rgba(45, 91, 255, .55); }
.cms-editing [data-cms-k]:not(img):focus { outline: 2px solid #2d5bff; background-color: rgba(45, 91, 255, .06); }
.cms-editing img[data-cms-k] { cursor: pointer; transition: outline-color .15s, filter .15s; outline: 2px solid transparent; outline-offset: -2px; }
.cms-editing img[data-cms-k]:hover { outline-color: #2d5bff; filter: brightness(.92); }
.cms-editing .cms-selected { outline: 2px solid #2d5bff !important; outline-offset: 3px; }
.cms-editing img.cms-selected { outline-offset: -2px; }

/* верхняя панель */
.cms-bar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 2147483000; display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 16px;
  background: rgba(17, 17, 24, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 16px 40px rgba(0, 0, 0, .28); color: #fff; max-width: calc(100vw - 16px); overflow-x: auto; }
.cms-bar button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: #e5e7eb; padding: 9px 12px; border-radius: 11px; font: 600 13px/1 Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.cms-bar button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.cms-bar button.cms-primary { background: #2d5bff; color: #fff; }
.cms-bar button.cms-primary:hover { background: #1f47e0; }
.cms-bar button:disabled { opacity: .6; cursor: wait; }
.cms-bar button.cms-unsaved { position: relative; }
.cms-bar button.cms-unsaved::after { content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 0 2px #111118; }
.cms-badge { font: 700 11px/1 Inter, system-ui, sans-serif; text-transform: uppercase !important; letter-spacing: .08em !important; padding: 7px 10px; border-radius: 9px; background: rgba(255, 255, 255, .1); color: #c7d2fe; margin-right: 2px; white-space: nowrap; }
.cms-badge.demo { background: #fbbf24; color: #111; }

/* боковая панель */
.cms-panel { position: fixed; right: 14px; top: 14px; z-index: 2147483000; width: min(340px, calc(100vw - 28px)); max-height: calc(100vh - 100px); overflow: auto;
  background: #fff; color: #111; border-radius: 18px; padding: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); border: 1px solid #e5e7eb; display: grid; gap: 12px; font-size: 14px; }
.cms-panel[hidden] { display: none; }
.cms-ph { display: flex; justify-content: space-between; align-items: center; }
.cms-ph b { font-size: 15px; }
.cms-x { border: 0; background: #f3f4f6; border-radius: 9px; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; color: #111; }
.cms-panel label { display: grid; gap: 6px; font: 600 12px/1.3 Inter, system-ui, sans-serif; color: #4b5563; }
.cms-panel input, .cms-panel textarea { width: 100%; border: 1px solid #d1d5db; border-radius: 10px; padding: 10px 12px; font: 400 14px/1.4 Inter, system-ui, sans-serif; color: #111; background: #fff; resize: vertical; }
.cms-panel input:focus, .cms-panel textarea:focus { outline: 2px solid #2d5bff; outline-offset: -1px; border-color: transparent; }
.cms-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cms-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #d1d5db; background: #fff; color: #111; padding: 10px 14px; border-radius: 10px; font: 600 13px/1 Inter, system-ui, sans-serif; cursor: pointer; }
.cms-btn:hover { background: #f9fafb; }
.cms-btn.cms-primary { background: #2d5bff; border-color: #2d5bff; color: #fff; }
.cms-btn.cms-primary:hover { background: #1f47e0; }
.cms-btn.cms-ghost { border-color: transparent; color: #6b7280; }
.cms-hint { font-size: 12px; color: #6b7280; line-height: 1.45; margin: 0; }
.cms-thumb { border-radius: 12px; overflow: hidden; background: #f3f4f6; aspect-ratio: 16 / 10; }
.cms-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cms-hist { display: grid; gap: 8px; }
.cms-hi { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; }
.cms-hi b { display: block; font-size: 13px; }
.cms-hi span { font-size: 12px; color: #6b7280; }

/* уведомления */
.cms-toast { position: fixed; left: 50%; bottom: 80px; transform: translate(-50%, 20px); z-index: 2147483001; opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100vw - 32px);
  background: #111118; color: #fff; padding: 12px 18px; border-radius: 12px; font: 500 14px/1.4 Inter, system-ui, sans-serif; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); text-align: center; }
.cms-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* кнопка «Попробовать редактор» (публичный режим) */
.cms-try { position: fixed; left: 16px; bottom: 16px; z-index: 99990; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; text-decoration: none;
  background: #111118; color: #fff; padding: 11px 16px 11px 13px; border-radius: 16px; box-shadow: 0 14px 34px rgba(0, 0, 0, .28); transition: transform .2s; }
.cms-try:hover { transform: translateY(-2px); }
.cms-try svg { grid-row: span 2; width: 20px; height: 20px; color: #fbbf24; }
.cms-try span { font: 700 14px/1.2 Inter, system-ui, sans-serif; }
.cms-try small { font: 400 12px/1.2 Inter, system-ui, sans-serif; color: #a1a1aa; }
@media (max-width: 640px) {
  .cms-bar button span { display: none; }
  .cms-try { left: 10px; bottom: 74px; padding: 10px 12px; }
  .cms-try small { display: none; }
  .cms-panel { top: auto; bottom: 72px; right: 10px; left: 10px; width: auto; max-height: 55vh; }
  .cms-toast { bottom: 132px; }
}
