:root {
  --bg: #090b10;
  --panel: #11151d;
  --panel-2: #171c26;
  --panel-3: #1d2430;
  --line: #273141;
  --line-soft: #202838;
  --text: #eef2f8;
  --muted: #8d98aa;
  --muted-2: #657084;
  --accent: #7867ff;
  --accent-2: #9a8cff;
  --accent-soft: rgba(120, 103, 255, .16);
  --danger: #ff6d7a;
  --success: #69d09d;
  --shadow: 0 18px 55px rgba(0,0,0,.32);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}
button, input, select, textarea { font: inherit; }
button { user-select: none; }

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 58px 46px 1fr 44px;
  background: var(--bg);
}

.appbar, .editor-toolbar, .statusbar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  background: #0e1219;
}
.appbar { padding: 0 14px; gap: 14px; }
.brand-block { display: flex; align-items: center; gap: 10px; min-width: 250px; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px; background: linear-gradient(145deg, var(--accent), #5748e6);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 8px 25px rgba(120,103,255,.22);
  font-weight: 900; color: white; letter-spacing: -.04em;
}
.small-mark { width: 28px; height: 28px; font-size: 12px; }
.brand-name { font-weight: 750; letter-spacing: -.01em; }
.brand-meta { margin-top: 1px; color: var(--muted-2); font-size: 11px; }
.appbar-center { display: flex; align-items: center; gap: 6px; }
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.save-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; margin-right: 4px; }
.save-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(105,208,157,.12); }
.save-state.saving .save-dot { background: #f7c76e; box-shadow: 0 0 0 3px rgba(247,199,110,.12); }

.btn, .icon-btn, .tool-pill, .device-btn, .preview-device, .zoom-value {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  transition: .15s ease;
}
.btn { padding: 8px 13px; font-weight: 650; }
.btn:hover, .icon-btn:hover, .tool-pill:hover, .device-btn:hover, .preview-device:hover, .zoom-value:hover { background: var(--panel-3); border-color: #354256; }
.btn.primary { background: var(--accent); border-color: var(--accent); box-shadow: 0 8px 22px rgba(120,103,255,.2); }
.btn.primary:hover { background: #8575ff; }
.btn.secondary { background: #161c27; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; font-size: 15px; }
.icon-btn.small { width: 29px; height: 29px; font-size: 13px; }
.danger-hover:hover { color: var(--danger); border-color: rgba(255,109,122,.45); }
.toolbar-separator { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }

.editor-toolbar { padding: 0 12px; gap: 14px; background: #0c1016; }
.toolbar-group { display: flex; align-items: center; gap: 5px; }
.device-switcher { min-width: 360px; }
.device-btn { height: 30px; padding: 0 10px; color: var(--muted); }
.device-btn span { margin-left: 5px; }
.device-btn.active { color: #fff; background: var(--accent-soft); border-color: rgba(120,103,255,.55); }
.toolbar-center-info { flex: 1; display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.workspace-name { color: #c9c3ff; font-size: 9px; letter-spacing: .12em; }
.viewport-input { height: 27px; display:flex; align-items:center; border:1px solid var(--line); border-radius:7px; background:#0a0e14; overflow:hidden; }
.viewport-input input { width:58px; border:0; outline:0; background:transparent; color:#fff; padding:0 4px 0 7px; text-align:right; }
.viewport-input span { padding-right:7px; color:var(--muted-2); font-size:9px; }
.tool-pill, .zoom-value { height: 29px; padding: 0 9px; color: var(--muted); font-size: 12px; }
.tool-pill.active { color: #d9d4ff; background: var(--accent-soft); border-color: rgba(120,103,255,.36); }
.zoom-group { margin-left: auto; }
.zoom-value { min-width: 58px; }

.workspace { min-height: 0; display: grid; grid-template-columns: var(--left-panel-width, 270px) minmax(0,1fr) var(--right-panel-width, 320px); }
.panel { min-height: 0; background: var(--panel); }
.left-panel { border-right: 1px solid var(--line-soft); overflow: hidden; display: flex; flex-direction: column; }
.right-panel { border-left: 1px solid var(--line-soft); overflow: hidden; display: flex; flex-direction: column; }
.left-panel, .right-panel { position: relative; }
.panel-resize-handle { position: absolute; top: 0; bottom: 0; width: 8px; z-index: 20; cursor: col-resize; }
.left-panel .panel-resize-handle { right: 0; }
.right-panel .panel-resize-handle { left: 0; }
.panel-resize-handle:hover, .panel-resize-handle:focus-visible { background: rgba(120,103,255,.28); outline: none; }

.panel-tabs { height: 46px; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line-soft); padding: 7px; gap: 5px; }
.panel-tabs.five-tabs { grid-template-columns: repeat(5,minmax(0,1fr)); gap:2px; padding:7px 4px; }
.panel-tabs.five-tabs .panel-tab { padding:0 2px; font-size:9px; }
.panel-tab { border: 0; background: transparent; color: var(--muted); border-radius: 7px; cursor: pointer; font-weight: 650; }
.panel-tab.active { background: #1a2130; color: #fff; }
.left-view { display: none; min-height: 0; overflow: auto; flex: 1; }
.left-view.active { display: block; }
.search-wrap { margin: 12px 12px 4px; height: 35px; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: #0d1118; color: var(--muted); }
.search-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-wrap input::placeholder { color: #5f697a; }
.library-section { padding: 11px 12px 4px; }
.library-title { color: var(--muted); text-transform: uppercase; letter-spacing: .085em; font-size: 10px; font-weight: 800; margin-bottom: 8px; }
.element-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.element-card {
  min-height: 66px; border: 1px solid var(--line); background: #151b25; color: var(--text);
  border-radius: 9px; cursor: grab; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  transition: .15s ease;
}
.element-card:hover { transform: translateY(-1px); border-color: #3a4659; background: #1a2130; }
.element-card:active { cursor: grabbing; }
.element-card b { width: 26px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: #232b3a; color: #c8c1ff; font-size: 14px; }
.element-card span { font-size: 11px; color: #cbd2de; }
.element-card.wide { flex-direction: row; min-height: 52px; padding: 0 12px; justify-content: flex-start; }

.layer-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 8px 13px; color: var(--muted); font-size: 11px; }
.layers-tree { padding: 0 7px 20px; }
.layer-row {
  position: relative; height: 34px; display: flex; align-items: center; gap: 6px; border-radius: 7px;
  padding-right: 5px; color: #c8d0dc; cursor: pointer;
}
.layer-row:hover { background: #171d28; }
.layer-row.selected { background: var(--accent-soft); color: #f4f2ff; }
.layer-row.drag-over { outline: 1px dashed var(--accent-2); background: rgba(120,103,255,.1); }
.layer-indent { flex: 0 0 auto; }
.layer-type { width: 22px; text-align: center; color: #7f8ca0; }
.layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.layer-mini { width: 23px; height: 23px; border: 0; background: transparent; color: #687487; cursor: pointer; border-radius: 5px; opacity: 0; }
.layer-row:hover .layer-mini, .layer-row.selected .layer-mini { opacity: 1; }
.layer-mini:hover { background: #242d3c; color: #d9e0eb; }
.layer-row.locked .layer-name { color: #697486; }
.layer-row.hidden-layer { opacity: .5; }

.canvas-area { position: relative; min-width: 0; min-height: 0; background: #080a0f; overflow: hidden; }
.canvas-scroller { position: absolute; inset: 24px 0 0 24px; overflow: hidden; touch-action:none; cursor:grab; background-image:radial-gradient(circle at center,rgba(255,255,255,.05) 0 1px,transparent 1px); background-size:24px 24px; }
.canvas-scroller.is-panning, body.space-pan .canvas-scroller { cursor:grabbing; }
.canvas-stage { position:absolute; left:0; top:0; width:0; height:0; transform-origin:0 0; will-change:transform; }
.website-frame { position:absolute; left:0; top:0; width:1440px; min-height:120px; }
.page-canvas {
  position: relative; width: 100%; min-height: 240px; background: white; color: #151821; box-shadow: 0 24px 70px rgba(0,0,0,.42);
  transform-origin: top center;
}
.website-badge { position:absolute; left:0; top:-27px; height:22px; padding:0 8px; display:flex; align-items:center; border-radius:5px; background:#20283a; color:#b9c1cf; font-size:9px; font-weight:800; letter-spacing:.06em; pointer-events:none; }
.viewport-resizer { position:absolute; top:0; bottom:0; width:14px; border:0; background:transparent; cursor:ew-resize; z-index:60; }
.viewport-resizer::after { content:""; position:absolute; top:50%; width:5px; height:44px; transform:translateY(-50%); border-radius:999px; background:#7867ff; box-shadow:0 0 0 3px rgba(120,103,255,.18); opacity:.75; }
.viewport-resizer.left { left:-18px; }.viewport-resizer.left::after { right:0; }
.viewport-resizer.right { right:-18px; }.viewport-resizer.right::after { left:0; }
.scratch-layer { position:absolute; left:0; top:0; width:0; height:0; }
.scratch-item { position:absolute; width:220px; min-height:110px; padding:14px; border:1px solid #4a3f75; border-radius:10px; background:#1c1830; color:#e9e5ff; box-shadow:var(--shadow); }
.scratch-item p { margin:8px 0; color:#b8b0d6; line-height:1.4; white-space:pre-wrap; }
.scratch-item small { color:#80779c; text-transform:uppercase; font-size:8px; letter-spacing:.08em; }
.page-canvas.grid-visible {
  background-image: linear-gradient(rgba(80,90,110,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(80,90,110,.055) 1px, transparent 1px);
  background-size: 8px 8px;
}
.page-canvas.drop-active { outline: 2px solid var(--accent); outline-offset: 4px; }
.canvas-ruler { position: absolute; z-index: 5; background: #0b0e14; color: #4f5969; pointer-events: none; }
.top-ruler { left: 24px; right: 0; top: 0; height: 24px; border-bottom: 1px solid var(--line-soft); background-image: repeating-linear-gradient(90deg, transparent 0 47px, #303848 48px, transparent 49px); }
.left-ruler { left: 0; top: 24px; bottom: 0; width: 24px; border-right: 1px solid var(--line-soft); background-image: repeating-linear-gradient(0deg, transparent 0 47px, #303848 48px, transparent 49px); }
.canvas-toast { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); padding: 7px 10px; border: 1px solid var(--line); background: rgba(13,17,24,.92); color: var(--muted); border-radius: 7px; font-size: 11px; opacity: 0; transition: .2s; pointer-events: none; }
.canvas-toast.show { opacity: 1; }

.wb-node { position: relative; min-width: 12px; min-height: 12px; cursor:default; }
.wb-node.is-selected { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 3; }
.wb-node.is-hovered:not(.is-selected) { outline: 1px solid rgba(120,103,255,.42); outline-offset: -1px; }
.wb-node.is-locked { cursor: not-allowed; }
.wb-node.is-hidden-editor { opacity: .28; filter: grayscale(.35); }
.wb-node.drop-target { outline: 2px dashed var(--accent-2); outline-offset: -4px; background-color: rgba(120,103,255,.045) !important; }
.node-label {
  position: absolute; top: -22px; left: 0; z-index: 20; background: var(--accent); color: white;
  font-size: 10px; line-height: 18px; height: 18px; padding: 0 6px; border-radius: 4px 4px 0 0; pointer-events: none;
}
.resize-handle { position: absolute; width: 9px; height: 9px; background: white; border: 2px solid var(--accent); z-index: 25; border-radius: 2px; }
.resize-handle.se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.resize-handle.e { right: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.resize-handle.s { left: 50%; bottom: -5px; transform: translateX(-50%); cursor: ns-resize; }
.empty-container-hint { min-height: 64px; border: 1px dashed #ccd2dc; display: grid; place-items: center; color: #8a94a4; font-size: 12px; }

.wb-node > h1, .wb-node > h2, .wb-node > h3, .wb-node > p, .wb-node > a,
.preview-node > h1, .preview-node > h2, .preview-node > h3, .preview-node > p, .preview-node > a {
  margin: 0; padding: 0; font: inherit; line-height: inherit; color: inherit; text-align: inherit; text-decoration: inherit;
}
.wb-node > a, .preview-node > a { display: inherit; align-items: inherit; justify-content: inherit; width: 100%; height: 100%; }
.wb-node > img, .preview-node > img { display: block; width: 100%; height: 100%; min-height: inherit; object-fit: inherit; border-radius: inherit; }
.image-placeholder { width: 100%; min-height: inherit; height: 100%; display: grid; place-items: center; align-content: center; gap: 7px; background: linear-gradient(135deg,#eef0f4,#dde2ea); color: #7b8595; border-radius: inherit; }
.image-placeholder span { font-size: 28px; }
.image-placeholder small { font-size: 11px; }
.navbar-brand { font-weight: 800; }
.navbar-logo-wrap { display: inline-flex; align-items: center; min-width: 0; }
.navbar-logo { display: block; height: auto; max-width: min(42vw,100%); object-fit: contain; }
.navbar-links { display: flex; gap: 22px; color: #596174; font-size: 13px; }

.editable-text[contenteditable="true"] { outline: 1px dashed rgba(120,103,255,.55); outline-offset: 3px; }

.inspector-header { min-height: 64px; padding: 11px 12px 10px 14px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); font-size: 9px; font-weight: 800; }
.inspector-title { margin-top: 3px; font-weight: 720; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inspector-actions { display: flex; gap: 5px; }
.inspector-body { overflow: auto; flex: 1; padding-bottom: 24px; }
.empty-inspector { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 30px; color: var(--muted); }
.empty-inspector p { max-width: 210px; line-height: 1.45; font-size: 12px; }
.empty-illustration { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; border: 1px solid var(--line); background: #151b25; margin-bottom: 12px; color: #8f82ff; font-size: 22px; }
.inspector-section { border-bottom: 1px solid var(--line-soft); }
.inspector-section > summary { list-style: none; cursor: pointer; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 11px; }
.inspector-section > summary::-webkit-details-marker { display: none; }
.inspector-section > summary::after { content: '⌄'; color: var(--muted-2); transition: .15s; }
.inspector-section[open] > summary::after { transform: rotate(180deg); }
.inspector-content { padding: 0 12px 13px; }
.field { margin-bottom: 10px; }
.field:last-child { margin-bottom: 0; }
.field label { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: #0d1118; color: var(--text); border-radius: 7px; padding: 7px 8px; outline: none;
}
.field textarea { min-height: 70px; resize: vertical; line-height: 1.4; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(120,103,255,.65); box-shadow: 0 0 0 2px rgba(120,103,255,.08); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.four-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.unit-input { position: relative; }
.unit-input input { padding-right: 28px; }
.unit-input span { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: #5e6a7b; font-size: 9px; pointer-events: none; }
.color-row { display: grid; grid-template-columns: 36px 1fr; gap: 7px; }
.color-row input[type="color"] { padding: 2px; height: 32px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.segmented button { height: 30px; border: 1px solid var(--line); background: #10151d; color: var(--muted); border-radius: 6px; cursor: pointer; }
.segmented button.active { color: white; border-color: rgba(120,103,255,.5); background: var(--accent-soft); }
.inspector-note { color: var(--muted-2); font-size: 10px; line-height: 1.4; padding-top: 4px; }

.statusbar { border-top: 1px solid var(--line-soft); border-bottom: 0; padding: 0 10px; gap: 14px; color: #677386; font-size: 10px; }
.status-action { border:1px solid var(--line); background:#151b25; color:#aeb8c7; border-radius:6px; padding:4px 8px; cursor:pointer; font-size:10px; }
.status-spacer { flex: 1; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; }
.status-dot.online { background: var(--success); }

.preview-overlay { display: none; position: fixed; inset: 0; z-index: 100; background: #080a0f; grid-template-rows: 58px minmax(0, 1fr); overflow: hidden; }
.preview-overlay.open { display: grid; }
.preview-toolbar { display: flex; align-items: center; gap: 12px; padding: 0 14px; background: #0e1219; border-bottom: 1px solid var(--line); }
.preview-brand { display: flex; align-items: center; gap: 9px; min-width: 220px; }
.preview-devices { flex: 1; display: flex; justify-content: center; gap: 5px; }
.preview-device { height: 32px; padding: 0 11px; color: var(--muted); }
.preview-device.active { color: #fff; border-color: rgba(120,103,255,.6); background: var(--accent-soft); }
.custom-width { height: 32px; display: flex; align-items: center; border: 1px solid var(--line); background: #0c1017; border-radius: 8px; overflow: hidden; }
.custom-width input { width: 68px; height: 100%; border: 0; outline: 0; background: transparent; color: white; padding: 0 8px; }
.custom-width span { color: var(--muted); padding-right: 8px; font-size: 10px; }
.preview-viewport { min-width: 0; min-height: 0; overflow-x: auto; overflow-y: hidden; display: flex; justify-content: safe center; align-items: stretch; padding: 26px; }
.preview-page { flex: 0 0 auto; width: 1440px; height: 100%; min-height: 0; background: white; color: #151821; box-shadow: var(--shadow); }
.preview-frame { display: block; width: 100%; height: 100%; min-height: 0; border: 0; background: white; }
.components-list { padding:8px; display:grid; gap:6px; }
.component-row { min-height:48px; padding:8px 9px; display:grid; grid-template-columns:30px 1fr auto; align-items:center; gap:8px; border:1px solid var(--line); border-radius:8px; background:#151b25; }
.component-row span { width:26px; height:26px; display:grid; place-items:center; border-radius:6px; background:var(--accent-soft); color:#c9c3ff; }
.component-row small { display:block; margin-top:2px; color:var(--muted-2); }
.component-row button { border:0; background:#252e3d; color:#d9e0eb; border-radius:6px; width:27px; height:27px; cursor:pointer; }
.diagnostics-results { max-height:55vh; overflow:auto; padding:14px 16px; display:grid; gap:7px; }
.diagnostic-summary { padding:12px; border-radius:9px; background:#0d1219; border:1px solid var(--line); }
.diagnostic-item { padding:9px 10px; border-radius:8px; border:1px solid rgba(247,199,110,.25); background:rgba(247,199,110,.06); color:#e7d8b5; font-size:11px; }
.diagnostic-item.error { border-color:rgba(255,109,122,.3); background:rgba(255,109,122,.07); color:#ffc4ca; }
body.panels-hidden .left-panel, body.panels-hidden .right-panel { display:none; }
body.panels-hidden .workspace { grid-template-columns:1fr; }

@media (max-width: 1250px) {
  .workspace { grid-template-columns: var(--left-panel-width, 240px) minmax(0,1fr) var(--right-panel-width, 290px); }
  .device-btn span { display: none; }
  .device-switcher { min-width: 220px; }
}


/* Manual update control */
.statusbar {
  position: relative;
  min-height: 44px;
  padding: 0 10px;
  gap: 12px;
  z-index: 30;
}
.update-control {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  flex: 0 0 auto;
}
.update-check-btn {
  height: 34px;
  min-width: 250px;
  border: 1px solid rgba(120,103,255,.5);
  background: rgba(120,103,255,.12);
  color: var(--text);
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px;
  cursor: pointer;
  text-align: left;
  transition: .15s ease;
}
.update-folder-btn {
  height: 34px;
  width: 34px;
  margin-left: 5px;
  border: 1px solid rgba(120,103,255,.5);
  background: rgba(120,103,255,.12);
  color: var(--text);
  border-radius: 9px;
  cursor: pointer;
}
.update-folder-btn:hover {
  background: rgba(120,103,255,.2);
}
.update-check-btn:hover {
  background: rgba(120,103,255,.2);
  border-color: var(--accent-2);
}
.update-check-btn:disabled {
  cursor: default;
  opacity: .72;
}
.update-symbol {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(120,103,255,.22);
  color: #d9d4ff;
  font-size: 14px;
  font-weight: 800;
}
.update-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.update-copy strong {
  font-size: 10px;
  font-weight: 800;
  color: #f4f2ff;
  white-space: nowrap;
}
.update-copy small {
  margin-top: 3px;
  font-size: 8px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.update-check-btn.is-checking .update-symbol,
.update-check-btn.is-downloading .update-symbol {
  animation: updateSpin .9s linear infinite;
}
.update-check-btn.is-available,
.update-check-btn.is-ready {
  border-color: rgba(105,208,157,.55);
  background: rgba(105,208,157,.1);
}
.update-check-btn.is-available .update-symbol,
.update-check-btn.is-ready .update-symbol {
  background: rgba(105,208,157,.16);
  color: var(--success);
}
.update-check-btn.has-error {
  border-color: rgba(255,109,122,.55);
  background: rgba(255,109,122,.08);
}
.update-check-btn.has-error .update-symbol {
  background: rgba(255,109,122,.14);
  color: var(--danger);
}
.update-progress-track {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 2px;
  height: 2px;
  border-radius: 999px;
  background: #242c3a;
  overflow: hidden;
}
.update-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width .2s linear;
}
@keyframes updateSpin { to { transform: rotate(360deg); } }


/* ===== Frameless desktop workspace ===== */
.custom-titlebar {
  -webkit-app-region: drag;
  height: 58px;
  padding: 0 0 0 12px;
  border-bottom: 1px solid var(--line-soft);
  background: #0c1016;
}
.titlebar-drag { -webkit-app-region: drag; }
.no-drag,
.no-drag button,
.no-drag input,
.no-drag select { -webkit-app-region: no-drag; }

.appbar-center { margin-left: 8px; }
.appbar-actions { margin-left: auto; }
.top-action {
  height: 32px;
  border: 1px solid var(--line);
  background: #141a24;
  color: #cfd6e2;
  border-radius: 8px;
  padding: 0 10px;
  cursor: pointer;
  font-weight: 650;
  font-size: 11px;
}
.top-action:hover { background: #1a2230; border-color: #3a4659; color: #fff; }

.window-controls {
  height: 100%;
  display: flex;
  margin-left: 5px;
  border-left: 1px solid var(--line-soft);
}
.window-btn {
  width: 46px;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #aeb7c5;
  cursor: pointer;
  font-size: 14px;
}
.window-btn:hover { background: #1b2230; color: #fff; }
.window-btn.close:hover { background: #c42b1c; color: white; }

.panel-tabs.four-tabs {
  height: 48px;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px;
  gap: 3px;
}
.panel-tabs.four-tabs .panel-tab { font-size: 10px; padding: 0 4px; }

.panel-section-head {
  min-height: 62px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}
.panel-section-head > div { display: flex; flex-direction: column; gap: 2px; }
.panel-section-head strong { font-size: 12px; }
.panel-section-head small { color: var(--muted-2); font-size: 9px; }

.pages-list { padding: 8px; }
.page-row {
  display: grid;
  grid-template-columns: 26px minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}
.page-row:hover { background: #171d28; }
.page-row.active {
  background: var(--accent-soft);
  border-color: rgba(120,103,255,.3);
}
.page-icon {
  width: 24px; height: 24px; display: grid; place-items:center;
  border-radius: 6px; background: #222a38; color: #c7c0ff; font-size: 11px;
}
.page-copy { min-width:0; }
.page-copy strong { display:block; font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.page-copy small { display:block; color:var(--muted-2); font-size:9px; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.page-menu-btn {
  width: 26px; height:26px; border:0; border-radius:6px; background:transparent; color:var(--muted); cursor:pointer;
}
.page-menu-btn:hover { background:#252d3b; color:white; }

.asset-dropzone {
  margin: 10px;
  min-height: 88px;
  border: 1px dashed #364256;
  border-radius: 10px;
  background: #0d1118;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  gap:4px;
  cursor:pointer;
}
.asset-dropzone:hover { border-color: var(--accent); background: rgba(120,103,255,.06); }
.asset-dropzone b { font-size: 18px; color: #b8b0ff; }
.asset-dropzone span { font-size: 11px; color: #d5dbe6; font-weight:700; }
.asset-dropzone small { font-size: 8px; color: var(--muted-2); }

.assets-grid {
  padding: 0 10px 20px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px;
}
.asset-card {
  position:relative;
  min-width:0;
  border:1px solid var(--line);
  background:#141a24;
  border-radius:9px;
  overflow:hidden;
  cursor:pointer;
}
.asset-card:hover { border-color:#445168; transform:translateY(-1px); }
.asset-thumb {
  aspect-ratio: 4 / 3;
  background:#0a0d12;
  display:grid;
  place-items:center;
  overflow:hidden;
}
.asset-thumb img, .asset-thumb video { width:100%; height:100%; object-fit:cover; display:block; }
.asset-thumb .asset-file-icon { color:#8075ef; font-size:22px; }
.asset-meta { padding:7px; }
.asset-meta strong { display:block; font-size:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.asset-meta small { display:block; margin-top:2px; color:var(--muted-2); font-size:8px; }
.asset-add {
  position:absolute; right:5px; top:5px; width:24px; height:24px;
  border:1px solid rgba(255,255,255,.12); background:rgba(8,10,15,.82); color:white; border-radius:6px; cursor:pointer;
}

.dropdown-menu,
.context-menu {
  position: fixed;
  z-index: 250;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--line);
  background: #141a24;
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0,0,0,.42);
}
.dropdown-menu button,
.context-menu button {
  width:100%;
  min-height:34px;
  border:0;
  background:transparent;
  color:#dce2ec;
  border-radius:7px;
  text-align:left;
  padding:0 9px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  font-size:11px;
}
.dropdown-menu button:hover,
.context-menu button:hover { background:#202938; }
.context-menu button.danger:hover { background:rgba(255,109,122,.12); color:var(--danger); }
.menu-divider { display:block; height:1px; background:var(--line-soft); margin:5px 3px; }
.context-menu kbd { color:var(--muted-2); font:inherit; font-size:9px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(3,5,8,.68);
  backdrop-filter: blur(6px);
  display:grid;
  place-items:center;
}
.modal-card {
  width:min(620px, calc(100vw - 40px));
  border:1px solid var(--line);
  border-radius:14px;
  background:#121720;
  box-shadow:0 28px 100px rgba(0,0,0,.5);
  overflow:hidden;
}
.modal-card > header {
  min-height:72px;
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--line-soft);
}
.modal-card h2 { margin:3px 0 0; font-size:18px; }
.design-grid {
  padding:16px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.design-grid label {
  display:flex;
  flex-direction:column;
  gap:6px;
  color:var(--muted);
  font-size:10px;
}
.design-grid input,
.design-grid select {
  height:36px;
  border:1px solid var(--line);
  background:#0d1118;
  color:white;
  border-radius:8px;
  padding:0 8px;
}
.design-grid input[type=color] { padding:3px; }
.modal-actions {
  padding:14px 16px;
  border-top:1px solid var(--line-soft);
  display:flex;
  justify-content:flex-end;
  gap:8px;
}

.command-palette {
  position:fixed;
  inset:0;
  z-index:350;
  background:rgba(4,6,10,.58);
  backdrop-filter:blur(4px);
  padding-top:12vh;
  display:flex;
  justify-content:center;
  align-items:flex-start;
}
.command-box {
  width:min(640px, calc(100vw - 50px));
  border:1px solid #344057;
  background:#111720;
  border-radius:14px;
  box-shadow:0 30px 100px rgba(0,0,0,.55);
  overflow:hidden;
}
.command-search {
  height:54px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 14px;
  border-bottom:1px solid var(--line-soft);
}
.command-search span { color:#8e83ff; font-size:18px; }
.command-search input {
  flex:1;
  border:0;
  outline:0;
  background:transparent;
  color:white;
  font-size:14px;
}
.command-results { max-height:340px; overflow:auto; padding:6px; }
.command-item {
  min-height:42px;
  display:grid;
  grid-template-columns:28px 1fr auto;
  align-items:center;
  gap:8px;
  padding:0 9px;
  border-radius:8px;
  color:#dce2eb;
  cursor:pointer;
}
.command-item:hover, .command-item.active { background:#202939; }
.command-item .ci-icon { color:#9a8cff; }
.command-item small { color:var(--muted-2); }
.command-box footer {
  height:32px;
  border-top:1px solid var(--line-soft);
  display:flex;
  align-items:center;
  gap:14px;
  padding:0 12px;
  color:var(--muted-2);
  font-size:9px;
}

.page-canvas.outline-mode .wb-node:not(.is-selected) {
  outline: 1px dashed rgba(120,103,255,.24);
  outline-offset:-1px;
}
.canvas-node-dragging { opacity:.48 !important; }
.canvas-drop-before::before,
.canvas-drop-after::after {
  content:"";
  position:absolute;
  left:0;
  right:0;
  height:2px;
  background:var(--accent);
  z-index:40;
}
.canvas-drop-before::before { top:0; }
.canvas-drop-after::after { bottom:0; }

@media (max-width: 1380px) {
  .brand-block { min-width: 210px; }
  .top-action { padding:0 7px; font-size:10px; }
  .save-state { display:none; }
  .workspace { grid-template-columns: var(--left-panel-width, 240px) minmax(0,1fr) var(--right-panel-width, 300px); }
}


/* v0.4.0 content element internals */
.wb-node > video,
.preview-node > video { width:100%; min-height:inherit; display:block; border-radius:inherit; background:#0a0d12; }
.wb-node > audio,
.preview-node > audio { display:block; width:100%; min-height:54px; }
.wb-node > input,
.wb-node > textarea,
.preview-node > input,
.preview-node > textarea {
  width:100%;
  min-height:inherit;
  border:0;
  outline:0;
  resize:vertical;
  background:transparent;
  color:inherit;
  font:inherit;
  padding:0;
}
.wb-node > ul,
.preview-node > ul { margin:0; padding-left:1.3em; color:inherit; font:inherit; line-height:inherit; }
.wb-node > blockquote,
.preview-node > blockquote { margin:0; color:inherit; font:inherit; line-height:inherit; }
.page-actions { display:flex; align-items:center; gap:1px; }


/* v0.4.2 overlay safety */
[hidden] { display: none !important; }

.command-palette {
  background: rgba(4,6,10,.42);
  backdrop-filter: blur(2px);
}
.command-box {
  width: min(720px, calc(100vw - 64px));
}
.command-box::before {
  content: "Brze naredbe";
  display: block;
  padding: 12px 14px 0;
  color: #f4f6fb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
}
.command-search { height: 50px; }
.command-results:empty::after {
  content: "Počni pisati ili odaberi naredbu.";
  display: block;
  padding: 18px 12px;
  color: var(--muted-2);
  font-size: 11px;
}
body.overlay-open .custom-titlebar,
body.overlay-open .editor-toolbar,
body.overlay-open .workspace,
body.overlay-open .statusbar {
  pointer-events: none;
}
.saved-projects-list { display: grid; gap: 8px; max-height: min(55vh, 480px); overflow: auto; padding: 8px 20px 22px; }
.saved-project-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 16px; border: 1px solid #dfe2ee; border-radius: 12px; background: #fff; color: #20243a; text-align: left; cursor: pointer; }
.saved-project-row:hover, .saved-project-row:focus-visible { border-color: #7867ff; background: #f8f6ff; }
.saved-project-row.is-current { border-color: #7867ff; }
.saved-project-row small { color: #657084; }
