/* The site editor (page-builder.php). The page itself is the canvas; the panel only holds what doesn't fit on it. */
body { overflow: hidden; background: var(--bg-alt); }
.se { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.se-top { display: flex; align-items: center; gap: 14px; flex: none; height: 58px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
.se-back { font-size: 1.125rem; color: var(--text-muted); padding: 6px; }
.se-name { min-width: 0; overflow: hidden; font-size: .9375rem; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.se-state { margin-left: 4px; font-size: .8125rem; color: var(--text-muted); white-space: nowrap; }
.se-state.err { color: #dc2626; }
.se-mid { display: flex; gap: 4px; margin: 0 auto; }
.se-right { display: flex; align-items: center; gap: 8px; flex: none; }
.se-icon { width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 1rem; cursor: pointer; }
.se-icon:hover:not(:disabled) { background: var(--bg-alt); }
.se-icon.on { background: var(--text); color: var(--bg); }
.se-icon:disabled { opacity: .3; cursor: default; }
.se-btn { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: .875rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.se-btn:hover { border-color: var(--text); }
.se-btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.se-btn.block { display: block; width: 100%; text-align: center; }
.se-main { display: flex; flex: 1; min-height: 0; }
.se-stage { position: relative; flex: 1; min-width: 0; display: flex; justify-content: center; padding: 16px; overflow: hidden; }
.se-frame { position: relative; width: 100%; height: 100%; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 30px rgba(0, 0, 0, .1); transition: width .2s ease; }
.se-frame.mobile { width: 390px; max-width: 100%; }
.se-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.se-frame iframe.loading { visibility: hidden; }

/* Panel */
.se-panel { flex: none; width: 340px; display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-left: 1px solid var(--border); }
.se-tabs { display: flex; flex: none; border-bottom: 1px solid var(--border); }
.se-tabs button { flex: 1; padding: 13px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); font-size: .875rem; font-weight: 600; cursor: pointer; }
.se-tabs button.on { color: var(--text); border-bottom-color: var(--text); }
.se-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.se-head { display: flex; align-items: center; gap: 8px; margin: -4px 0 14px; }
.se-head h2 { flex: 1; font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
.se-hint { margin-bottom: 14px; color: var(--text-muted); font-size: .8125rem; line-height: 1.45; }
.se-f { display: block; margin-bottom: 13px; }
.se-l { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; font-size: .8125rem; font-weight: 500; color: var(--text); }
.se-f input[type=text], .se-f textarea, .se-f select, .se-row input[type=text] { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: .875rem; }
.se-f textarea { min-height: 76px; line-height: 1.45; resize: vertical; }
.se-f input:focus, .se-f textarea:focus, .se-f select:focus, .se-row input:focus { outline: none; border-color: var(--text); }
.se-check { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: .875rem; cursor: pointer; }
.se-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.se-row input[type=text] { min-width: 0; padding: 8px 9px; }
.se-row .time { flex: 0 0 86px; }
.se-stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.se-x { flex: none; width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--text-muted); cursor: pointer; }
.se-x:hover { background: var(--bg-alt); color: var(--text); }
.se-more { margin-top: 8px; border-top: 1px solid var(--border); }
.se-more summary { padding: 13px 0; font-size: .875rem; font-weight: 600; cursor: pointer; }
.se-color { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; font-size: .875rem; }
.se-color div { display: flex; align-items: center; gap: 6px; }
.se-color input[type=color] { width: 34px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: none; cursor: pointer; }
.se-pills { display: flex; gap: 4px; margin-bottom: 13px; }
.se-pills button { flex: 1; padding: 7px 4px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); font-size: .8125rem; cursor: pointer; }
.se-pills button.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.se-img { margin-bottom: 13px; }
.se-img img { display: block; width: 100%; max-height: 150px; object-fit: cover; margin-bottom: 7px; border-radius: 8px; background: var(--bg-alt); }
.se-crop { margin-bottom: 8px; }
.se-crop-stage { position: relative; overflow: hidden; border-radius: 8px; cursor: move; touch-action: none; user-select: none; background: var(--bg-alt); }
.se-img .se-crop-stage img, .se-crop-stage img { display: block; width: 100%; height: auto; max-height: none; margin: 0; border-radius: 0; object-fit: fill; pointer-events: none; }
.se-crop-box { position: absolute; box-sizing: border-box; border: 2px solid #fff; box-shadow: 0 0 0 999px rgba(0, 0, 0, .52); pointer-events: none; }
.se-crop-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .75rem; }
.se-crop-row input { flex: 1; min-width: 0; }
.se-crop-row .se-link { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.se-crop-hint { margin: 4px 0 0; font-size: .75rem; opacity: .65; }
.se-gallery div.on img { outline: 2px solid currentColor; outline-offset: 1px; }
.se-gallery img[data-galcrop] { cursor: pointer; }
.se-img-btns { display: flex; gap: 6px; }
.se-img-btns .se-btn { flex: 1; text-align: center; }
.se-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.se-gallery div { position: relative; }
.se-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 7px; }
.se-gallery button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; cursor: pointer; }

/* Section list */
.se-list { list-style: none; margin: 0 0 12px; }
.se-item { display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-radius: 8px; cursor: pointer; }
.se-item:hover, .se-item.on { background: var(--bg-alt); }
.se-item.drop-above { box-shadow: 0 -2px 0 #2f6df6; }
.se-item.drop-below { box-shadow: 0 2px 0 #2f6df6; }
.se-item.off .se-item-name { opacity: .45; text-decoration: line-through; }
.se-grip { padding: 4px; color: var(--text-muted); cursor: grab; }
.se-item-name { flex: 1; min-width: 0; padding: 7px 2px; font-size: .9375rem; }
.se-add-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.se-add-grid button { padding: 11px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: .875rem; cursor: pointer; }
.se-add-grid button:hover { border-color: var(--text); }
.se-cap { margin: 16px 0 8px; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.se-ways { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.se-way { padding: 0 0 6px; border: 0; background: none; color: var(--text); font-size: .75rem; cursor: pointer; }
.se-way i { display: block; height: 42px; margin-bottom: 5px; border: 2px solid var(--border); border-radius: 9px; }
.se-way.on i { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }

/* Layout choice */
.se-layouts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.se-layout { padding: 8px 6px 7px; border: 1.5px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); font-size: .75rem; cursor: pointer; }
.se-layout:hover { border-color: var(--text-muted); }
.se-layout.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.se-layout svg { display: block; width: 100%; height: auto; margin-bottom: 5px; }

/* Maps help */
.se-q { width: 19px; height: 19px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: none; color: var(--text-muted); font-size: .75rem; font-weight: 600; line-height: 1; cursor: pointer; }
.se-q:hover, .se-q.on { border-color: var(--text); color: var(--text); }
.se-help { margin: 8px 0 4px; padding: 12px; border-radius: 10px; background: var(--bg-alt); font-size: .8125rem; line-height: 1.45; }
.se-help ol { margin: 0 0 10px; padding-left: 18px; list-style: decimal; }
.se-help li { margin-bottom: 4px; }
.se-help img { display: block; width: 100%; margin-top: 8px; border-radius: 8px; }

@media (max-width: 900px) {
  .se-main { flex-direction: column; }
  .se-stage { flex: 1 1 50%; padding: 8px; }
  .se-panel { width: auto; flex: 1 1 50%; border-left: 0; border-top: 1px solid var(--border); }
  .se-name, .se-state { display: none; }
}
@media (max-width: 560px) {   /* a phone: Preview, Save and Publish must all fit; undo and the device switch wait for a bigger screen */
  .se-top { gap: 6px; padding: 0 8px; }
  .se-mid, .se-right .se-icon { display: none; }
  .se-right { flex: 1 1 auto; justify-content: flex-end; min-width: 0; gap: 6px; }
  .se-right .btn { padding: 8px 10px; font-size: .8125rem; }
}
