:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Inter,Arial,sans-serif; background:var(--bg); color:var(--text); }

/* ===== Nav ===== */
.ls-nav { background:var(--surface); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:50; }
.ls-nav__inner { max-width:1200px; margin:0 auto; padding:12px 24px; display:flex; align-items:center; gap:24px; }
.ls-nav__brand { font-weight:700; font-size:18px; text-decoration:none; color:var(--text); display:flex; align-items:center; gap:8px; }
.ls-nav__brand i { color:var(--primary); }
.ls-nav__brand span { color:var(--primary); }
.ls-nav__links { display:flex; gap:6px; margin-left:auto; }
.ls-nav__links a { padding:8px 14px; border-radius:8px; color:var(--muted); text-decoration:none; font-size:14px; transition:.15s; }
.ls-nav__links a:hover { background:#f3f4f6; color:var(--text); }

/* ===== Page ===== */
.ls-main { padding:32px 0; }
.ls-page { max-width:1200px; margin:0 auto; padding:0 24px; }
.ls-page__head { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; }
.ls-page__head h1 { margin:0; font-size:28px; }

/* ===== Buttons ===== */
.ls-btn { display:inline-flex; align-items:center; gap:6px; background:var(--primary); color:#fff; border:none; padding:10px 18px; border-radius:8px; font-size:14px; font-weight:500; cursor:pointer; text-decoration:none; transition:.15s; }
.ls-btn:hover { background:var(--primary-hover); color:#fff; }
.ls-btn--sm { padding:7px 12px; font-size:13px; }
.ls-btn--ghost { background:transparent; color:var(--text); border:1px solid var(--border); }
.ls-btn--ghost:hover { background:#f3f4f6; color:var(--text); }
.ls-btn--danger { background:transparent; color:var(--danger); border:1px solid #fecaca; }
.ls-btn--danger:hover { background:#fee2e2; color:var(--danger); }

/* ===== Cards / Grid ===== */
.ls-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:18px; }
.ls-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:18px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:12px; }
.ls-card h3 { margin:0 0 8px; font-size:16px; }
.ls-card__title { font-weight:600; font-size:16px; }
.ls-card__meta { display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-size:13px; color:var(--muted); }
.ls-card__slug { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px; }
.ls-card__actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:auto; }

.ls-badge { display:inline-flex; align-items:center; gap:4px; background:#f3f4f6; color:var(--muted); padding:3px 8px; border-radius:999px; font-size:12px; }
.ls-badge--ok { background:#dcfce7; color:var(--ok); }

.ls-empty { text-align:center; padding:80px 20px; color:var(--muted); }
.ls-empty i { font-size:48px; display:block; margin-bottom:12px; }

/* ===== Settings ===== */
.ls-settings { display:flex; flex-direction:column; gap:18px; max-width:720px; }

/* ===== Auth ===== */
.ls-auth-body { background:linear-gradient(135deg,#eef2ff 0%,#f7f8fa 100%); min-height:100vh; }
.ls-auth { max-width:420px; margin:0 auto; padding:64px 20px; }
.ls-auth__brand { font-size:22px; font-weight:700; text-align:center; margin-bottom:24px; color:var(--text); }
.ls-auth__brand i, .ls-auth__brand span { color:var(--primary); }
.ls-auth__card { background:#fff; padding:32px; border-radius:14px; box-shadow:0 12px 40px rgba(16,24,40,.08); border:1px solid var(--border); }
.ls-auth__card h2 { margin:0 0 18px; font-size:22px; }
.ls-auth__alt { text-align:center; margin-top:14px; font-size:14px; color:var(--muted); }
.ls-auth__alt a { color:var(--primary); text-decoration:none; }

.ls-nav__user { margin-left:8px; padding:6px 12px; color:var(--muted); font-size:13px; display:flex; align-items:center; gap:6px; }
.ls-nav__role { background:var(--primary); color:#fff; padding:1px 7px; border-radius:999px; font-size:10px; font-weight:600; text-transform:uppercase; }

/* ===== Editor (light modern) ===== */
.ls-main:has(.ed) { padding:0; }
.ed { display:flex; flex-direction:column; height:100vh; background:#f5f6f8; color:#1f2937; }
.ed * { box-sizing:border-box; }

/* Top toolbar */
.ed__top { display:grid; grid-template-columns:1fr auto 1fr; gap:12px; padding:8px 12px; background:#ffffff; border-bottom:1px solid #e5e7eb; min-height:48px; align-items:center; }
.ed__top-left, .ed__top-center, .ed__top-right { display:flex; align-items:center; gap:6px; min-width:0; }
.ed__top-right { justify-content:flex-end; }
.ed__top-divider { width:1px; height:20px; background:#e5e7eb; margin:0 4px; flex-shrink:0; }

.ed__top-icon { color:#6b7280; padding:6px 10px; border-radius:6px; text-decoration:none; transition:.15s; flex-shrink:0; }
.ed__top-icon:hover { background:#f3f4f6; color:#111827; }

.ed__top-title { font-size:14px; font-weight:500; border:1px solid transparent; background:transparent; color:#111827; padding:6px 10px; border-radius:6px; width:200px; transition:.15s; min-width:0; }
.ed__top-title:hover { background:#f3f4f6; }
.ed__top-title:focus { background:#fff; border-color:#4f46e5; outline:none; box-shadow:0 0 0 3px rgba(79,70,229,.12); }
.ed__top-slug { color:#6b7280; font-family:ui-monospace,monospace; font-size:12px; flex-shrink:0; }
.ed__top-slug input { border:none; background:transparent; color:#6b7280; font-family:inherit; font-size:inherit; padding:4px 6px; border-radius:4px; width:120px; }
.ed__top-slug input:hover, .ed__top-slug input:focus { background:#f3f4f6; color:#111827; outline:none; }

.ed__top-btn { display:inline-flex; align-items:center; gap:6px; background:transparent; color:#374151; border:1px solid transparent; padding:6px 10px; border-radius:6px; cursor:pointer; font-size:13px; text-decoration:none; transition:.15s; flex-shrink:0; }
.ed__top-btn:hover { background:#f3f4f6; color:#111827; }
.ed__top-btn.is-active { background:#eef2ff; color:#4f46e5; }
.ed__top-btn--primary { background:#4f46e5; color:#fff; padding:6px 16px; }
.ed__top-btn--primary:hover { background:#4338ca; color:#fff; }
.ed__top-btn span { font-size:12px; }

.ed__top-status { font-size:12px; color:#6b7280; padding:0 8px; min-width:100px; text-align:right; flex-shrink:0; }

.ed__top-switch { display:flex; align-items:center; gap:6px; padding:6px 12px; border:1px solid #e5e7eb; border-radius:6px; cursor:pointer; font-size:12px; color:#374151; background:#fff; }
.ed__top-switch input { margin:0; accent-color:#4f46e5; }

/* Body */
.ed__body { flex:1; display:grid; grid-template-columns:280px 1fr 320px; min-height:0; }
.ed__sidebar { background:#ffffff; border-right:1px solid #e5e7eb; padding:16px; overflow-y:auto; overflow-x:hidden; }
.ed__sidebar--right { border-right:none; border-left:1px solid #e5e7eb; }
.ed__panel-title { display:flex; align-items:center; gap:6px; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.5px; color:#6b7280; margin:0 0 10px; padding-bottom:6px; border-bottom:1px solid #f3f4f6; white-space:nowrap; overflow:hidden; }
.ed__panel-title.mt-3 { margin-top:18px; }
.ed__panel-title i { color:#4f46e5; }

/* Library */
.ed__lib { display:flex; flex-direction:column; gap:14px; }
.ed__lib-cat { display:flex; align-items:center; gap:6px; font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.5px; color:#9ca3af; padding:0 4px; }
.ed__lib-cat i { color:#4f46e5; font-size:11px; }
.ed__lib-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.ed__lib-item { display:flex; flex-direction:column; align-items:center; gap:6px; padding:12px 6px; background:#fafafa; border:1px solid #e5e7eb; border-radius:8px; cursor:grab; transition:.15s; font-size:11px; color:#374151; text-align:center; line-height:1.2; }
.ed__lib-item:hover { background:#4f46e5; color:#fff; border-color:#4f46e5; transform:translateY(-1px); }
.ed__lib-item i { font-size:18px; }
.ed__lib-item:active { cursor:grabbing; }

.ed__ai textarea, .ed__ai select { font-size:13px; }

/* Canvas */
.ed__canvas-wrap { background:#eef0f3; overflow:auto; padding:24px; }
.ed__canvas-frame { background:#fff; margin:0 auto; min-height:100%; box-shadow:0 4px 24px rgba(16,24,40,.08); border-radius:8px; transition:max-width .25s; max-width:100%; overflow:hidden; }
.ed__canvas-frame[data-device="desktop"] { max-width:1200px; }
.ed__canvas-frame[data-device="tablet"]  { max-width:768px; }
.ed__canvas-frame[data-device="phone"]   { max-width:390px; }
.ed__canvas { min-height:100%; }
.ed__empty { padding:120px 20px; text-align:center; color:#9ca3af; }
.ed__empty i { font-size:64px; display:block; margin-bottom:16px; opacity:.4; }
.ed__empty p { color:#6b7280; }

.ed__block-wrap { position:relative; cursor:pointer; transition:outline .12s; outline:2px solid transparent; outline-offset:-2px; }
.ed__block-wrap:hover { outline-color:rgba(79,70,229,.3); }
.ed__block-wrap.is-selected { outline-color:#4f46e5; }
.ed__block-toolbar { position:absolute; top:8px; right:8px; display:none; background:#fff; border:1px solid #e5e7eb; border-radius:6px; box-shadow:0 4px 12px rgba(0,0,0,.12); z-index:5; }
.ed__block-wrap:hover .ed__block-toolbar, .ed__block-wrap.is-selected .ed__block-toolbar { display:flex; }
.ed__block-toolbar button, .ed__block-toolbar .ed__handle { background:none; border:none; padding:6px 9px; cursor:pointer; font-size:13px; color:#374151; display:inline-flex; align-items:center; }
.ed__block-toolbar button:hover { background:#f3f4f6; }

/* Properties */
.ed__props-head { display:flex; justify-content:space-between; padding-bottom:10px; border-bottom:1px solid #f3f4f6; margin-bottom:14px; font-weight:600; color:#111827; font-size:14px; }
.ed__props-type { font-family:ui-monospace,monospace; font-size:10px; color:#6b7280; background:#f3f4f6; padding:3px 8px; border-radius:4px; align-self:center; }
.ed__hint { color:#6b7280; font-size:13px; padding:20px 8px; text-align:center; line-height:1.5; }

.ed__field { display:flex; flex-direction:column; gap:4px; margin-bottom:12px; }
.ed__field-label { font-size:11px; color:#6b7280; font-weight:500; text-transform:uppercase; letter-spacing:.3px; }

.ed__list, .ed__rep { display:flex; flex-direction:column; gap:6px; }
.ed__list-row { display:flex; gap:6px; }
.ed__rep-item { background:#fafafa; border:1px solid #e5e7eb; border-radius:6px; padding:10px; }
.ed__rep-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; font-size:11px; color:#6b7280; }

@media (max-width:1280px) {
  .ed__body { grid-template-columns:240px 1fr 280px; }
}
@media (max-width:1024px) {
  .ed__body { grid-template-columns:220px 1fr 260px; }
}

/* ===== Drag & drop ===== */
.ed__drop { height:6px; border-radius:4px; transition:.15s; margin:0 12px; }
.ed__drop.is-over { height:48px; background:rgba(79,70,229,.18); border:2px dashed #4f46e5; margin:8px 12px; }
.ed__drop--first.is-over { margin-top:12px; }
.ed__block-wrap.is-dragging { opacity:.4; }
.ed__handle { cursor:grab; padding:6px 10px; color:#9ca3af; user-select:none; font-weight:bold; }
.ed__handle:active { cursor:grabbing; }
.ed__del { color:#dc2626 !important; }

/* ===== Inline editing ===== */
.ed__canvas [data-edit] { transition:outline .12s, background .12s; outline:1px dashed transparent; outline-offset:2px; cursor:text; }
.ed__canvas [data-edit]:hover { outline-color:rgba(79,70,229,.5); background:rgba(79,70,229,.04); }
.ed__canvas [data-edit]:focus { outline:2px solid #4f46e5; background:rgba(79,70,229,.06); }
.ed__canvas [data-edit-image] { transition:outline .12s; outline:2px solid transparent; outline-offset:-2px; cursor:pointer; position:relative; }
.ed__canvas [data-edit-image]:hover { outline-color:#4f46e5; }
.ed__canvas [data-edit-image]:hover::after { content:'📷 Заменить'; position:absolute; top:8px; left:8px; background:#4f46e5; color:#fff; padding:4px 10px; border-radius:4px; font-size:12px; font-weight:500; pointer-events:none; }
.ls-hero[data-edit-image] { cursor:pointer; }
.ls-hero[data-edit-image]:hover { outline:2px solid #4f46e5; outline-offset:-2px; }

/* ===== Canvas zoom ===== */
.ed__canvas-frame { transform-origin:top center; }
.ed__zoom { display:inline-flex; align-items:center; gap:2px; background:#f3f4f6; border:1px solid #e5e7eb; border-radius:6px; padding:2px; }
.ed__zoom button { background:transparent; border:none; color:#374151; padding:4px 8px; cursor:pointer; border-radius:4px; font-size:13px; }
.ed__zoom button:hover { background:#fff; color:#111827; }
.ed__zoom-val { font-size:12px; color:#6b7280; padding:0 8px; min-width:48px; text-align:center; }

/* ===== Themes panel (slide-out) ===== */
.ed__themes-panel { position:fixed; top:48px; right:0; bottom:0; width:340px; background:#fff; color:#1f2937; border-left:1px solid #e5e7eb; box-shadow:-8px 0 32px rgba(16,24,40,.08); z-index:200; display:flex; flex-direction:column; animation:slideIn .2s ease-out; }
@keyframes slideIn { from{transform:translateX(100%)} to{transform:translateX(0)} }
.ed__themes-head { display:flex; justify-content:space-between; align-items:center; padding:14px 16px; border-bottom:1px solid #e5e7eb; }
.ed__themes-head h3 { margin:0; font-size:14px; color:#111827; display:flex; align-items:center; gap:8px; }
.ed__themes-head i { color:#4f46e5; }
.ed__themes-body { padding:16px; overflow-y:auto; flex:1; }
.ed__themes-presets { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.ed__theme-preset { background:#fafafa; border:1px solid #e5e7eb; border-radius:8px; padding:10px; cursor:pointer; transition:.15s; }
.ed__theme-preset:hover { border-color:#4f46e5; }
.ed__theme-preset__swatches { display:flex; gap:3px; margin-bottom:8px; }
.ed__theme-preset__swatch { width:18px; height:18px; border-radius:4px; }
.ed__theme-preset__name { font-size:12px; color:#374151; }

/* ===== Zero Block editor ===== */
.ls-canvas-block { position:relative; }
.ed__zero-overlay { position:absolute; inset:0; pointer-events:none; }
.ed__zero-toolbar { position:sticky; top:0; background:#252525; color:#fff; padding:8px 12px; display:flex; gap:6px; z-index:10; border-bottom:1px solid #1a1a1a; pointer-events:auto; flex-wrap:wrap; }
.ed__zero-toolbar button { background:#3a3a3a; color:#fff; border:none; padding:6px 12px; border-radius:6px; font-size:12px; cursor:pointer; display:inline-flex; align-items:center; gap:4px; }
.ed__zero-toolbar button:hover { background:#4f46e5; }
.ed__zero-elem { position:absolute; cursor:move; outline:1px dashed transparent; transition:outline .12s; }
.ed__zero-elem:hover { outline-color:rgba(79,70,229,.5); }
.ed__zero-elem.is-selected { outline:2px solid #4f46e5; }
.ed__zero-elem .ed__zero-resize { position:absolute; right:-6px; bottom:-6px; width:14px; height:14px; background:#4f46e5; border:2px solid #fff; border-radius:50%; cursor:nwse-resize; display:none; }
.ed__zero-elem.is-selected .ed__zero-resize { display:block; }
.ed__zero-grid { position:absolute; inset:0; pointer-events:none; background-image:linear-gradient(rgba(0,0,0,.04) 1px,transparent 1px),linear-gradient(90deg,rgba(0,0,0,.04) 1px,transparent 1px); background-size:20px 20px; }

/* ===== Image / images fields ===== */
.ed__image-field { display:flex; flex-direction:column; gap:4px; }
.ed__image-preview { width:100%; aspect-ratio:16/9; background:#f3f4f6; border-radius:6px; overflow:hidden; display:flex; align-items:center; justify-content:center; color:#9ca3af; font-size:12px; }
.ed__image-preview img { width:100%; height:100%; object-fit:cover; }
.ed__image-actions { display:flex; gap:4px; margin-top:4px; }
.ed__image-actions .ls-btn { flex:1; font-size:11px; padding:5px 8px; }

.ed__images-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:4px; }
.ed__images-cell { position:relative; aspect-ratio:1; border-radius:4px; overflow:hidden; }
.ed__images-cell img { width:100%; height:100%; object-fit:cover; display:block; }
.ed__images-del { position:absolute; top:2px; right:2px; width:20px; height:20px; border-radius:4px; border:none; background:rgba(0,0,0,.6); color:#fff; cursor:pointer; font-size:11px; display:flex; align-items:center; justify-content:center; }

/* ===== Repeater mini buttons ===== */
.ed__rep-mini { background:none; border:none; padding:2px 6px; cursor:pointer; color:var(--muted); font-size:13px; }
.ed__rep-mini:hover { color:var(--primary); }
.ed__rep-del:hover { color:var(--danger); }

/* ===== Media library modal ===== */
.ed__media-modal { position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:9999; display:flex; align-items:center; justify-content:center; padding:24px; }
.ed__media-dlg { background:#fff; border-radius:12px; width:100%; max-width:900px; max-height:80vh; display:flex; flex-direction:column; overflow:hidden; }
.ed__media-head { display:flex; justify-content:space-between; align-items:center; padding:18px 24px; border-bottom:1px solid var(--border); }
.ed__media-head h3 { margin:0; font-size:18px; }
.ed__media-close { background:none; border:none; font-size:20px; cursor:pointer; color:var(--muted); }
.ed__media-actions { padding:14px 24px; border-bottom:1px solid var(--border); }
.ed__media-grid { padding:24px; overflow:auto; display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:12px; flex:1; }
.ed__media-cell { position:relative; aspect-ratio:1; border-radius:8px; overflow:hidden; cursor:pointer; border:2px solid transparent; transition:.15s; }
.ed__media-cell:hover { border-color:var(--primary); }
.ed__media-cell img { width:100%; height:100%; object-fit:cover; }
.ed__media-cell-del { position:absolute; top:6px; right:6px; width:24px; height:24px; border-radius:50%; border:none; background:rgba(0,0,0,.6); color:#fff; cursor:pointer; font-size:12px; }
.ed__media-empty { grid-column:1/-1; text-align:center; padding:40px; color:var(--muted); }
