/* ---- page builder ---- */
.builder-root { display: flex; flex-direction: column; height: calc(100vh - 120px); min-height: 560px; }
.builder-toolbar-top { border: 1px solid var(--dm-border, #dfe3eb); border-radius: 12px; background: var(--dm-surface, #fff); padding: 10px 12px; }
.builder-logo { color: #1769e0; font-size: 1.2rem; }
.builder-page-select { width: auto; min-width: 220px; display: inline-block; }
.builder-lib { margin-top: 10px; border-top: 1px dashed var(--dm-border, #dfe3eb); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.builder-lib-row { display: flex; gap: 8px; flex-wrap: wrap; }
.builder-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--dm-border, #cfd6e1); background: var(--dm-surface-2, #f4f7fd); border-radius: 8px; padding: 7px 14px; cursor: grab; font-size: .85rem; font-weight: 600; color: var(--dm-text, #172b4d); user-select: none; }
.builder-chip:hover { border-color: #1769e0; color: #1769e0; }
.builder-chip:active { cursor: grabbing; }
.builder-body { flex: 1; display: flex; gap: 12px; margin-top: 12px; min-height: 0; }
.builder-menuview { width: 220px; flex: none; background: #fff; color: #172b4d; border: 1px solid #e3e7ef; border-radius: 12px; padding: 10px; overflow-y: auto; }
.builder-menuview-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #6b778c; border-bottom: 1px solid #edf0f5; padding-bottom: 6px; margin-bottom: 6px; }
.builder-menuview-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: .88rem; }
.builder-menuview-item.active { background: #e7f0ff; color: #1558b0; font-weight: 600; }
.builder-canvaswrap { flex: 1; min-width: 0; border: 1px solid var(--dm-border, #dfe3eb); border-radius: 12px; background: var(--dm-surface, #fff); overflow: auto; position: relative; }
.builder-canvas { position: relative; min-height: 100%; min-width: 100%; }
.builder-canvas-design { background-image: radial-gradient(circle, rgba(120,140,170,.14) 1px, transparent 1px); background-size: 25px 25px; }
.builder-hint { position: sticky; top: 18px; margin: 18px; padding: 14px 18px; border: 2px dashed #b9c6dd; border-radius: 12px; color: #6b778c; background: rgba(255,255,255,.6); font-size: .95rem; }
.builder-dropline { position: absolute; left: 10px; right: 10px; height: 4px; background: #1769e0; border-radius: 2px; pointer-events: none; z-index: 5; }
.builder-dragprev { position: absolute; pointer-events: none; z-index: 7; outline: 2px dashed #1769e0; outline-offset: 2px; border-radius: 8px; opacity: .88; overflow: hidden; background: rgba(23,105,224,.04); }
.builder-dragprev-in { width: 100%; }

/* canvas items */
.bp-stage { position: relative; }
.bp-item { position: absolute; left: 0; top: 0; }
.bp-item-inner { width: 100%; }
.bp-item-fixedh .bp-item-inner { height: 100%; overflow: auto; }
.bp-item-design { cursor: grab; }
.bp-item-design:active { cursor: grabbing; }
.bp-item img, .bp-item-design img { -webkit-user-drag: none; user-select: none; }
.bp-item-selected .bp-item-inner { outline: 2px solid #1769e0; outline-offset: 2px; border-radius: 6px; }
.bp-item-design.bp-item-pinned .bp-item-inner { outline: 1px dashed #b86b00; outline-offset: 3px; border-radius: 6px; }

/* design-mode stacking: group frames above covering bands (incl. overlay, so the
   group title + flow select stay clickable), children above their group frame;
   pinbar/resize handles stay on top of everything. */
.bp-item-design { z-index: 1; }
.bp-item-design:has(.bctl-group) { z-index: 30; }
.bp-item-design.bp-item-child { z-index: 40; }

/* the separate bar ABOVE each element */
.bp-pinbar { position: absolute; left: 0; top: 0; height: 30px; z-index: 30; box-shadow: 0 2px 8px rgba(23,43,77,.18); display: flex; align-items: center; gap: 2px; padding: 0 4px; background: var(--dm-surface-2, #f1f5fd); border: 1px solid var(--dm-border, #d5deee); border-radius: 8px; z-index: 6; opacity: 0; transition: opacity .12s ease; font-size: .75rem; }
.bp-item:hover + .bp-pinbar, .bp-pinbar:hover, .bp-pinbar-on { opacity: 1; }
.bp-pinbar { pointer-events: auto; }
.bp-pinbar { z-index: 50 !important; }
/* width resize handle (bottom-right of each design item) */
.bp-resize { position: absolute; left: 0; top: 0; width: 18px; height: 18px; cursor: nwse-resize; z-index: 40;
  background: linear-gradient(135deg, transparent 50%, #1769e0 50%); border-radius: 0 0 8px 0; opacity: .55; }
.bp-resize:hover { opacity: 1; }
.bp-resize { z-index: 60 !important; }
.bp-pb { border: 0; background: transparent; color: #52627a; border-radius: 6px; padding: 2px 7px; font-size: .74rem; font-weight: 700; line-height: 1.4; }
.bp-pb:hover { background: #e3ecfa; color: #1769e0; }
.bp-pb.active { color: #b86b00; background: #fff3dd; }
.bp-pb.danger:hover { color: #c9372c; background: #fdecec; }
.bp-pb-sep { width: 1px; height: 16px; background: var(--dm-border, #cfd6e1); margin: 0 3px; }
.bp-pb-flex { flex: 1; }
.bp-pb-label { color: #8a97ac; font-size: .72rem; padding-right: 4px; }

/* overlays */
.builder-overlay { position: fixed; inset: 0; z-index: 1200; background: rgba(23,43,77,.45); display: grid; place-items: center; }
.builder-dialog { width: min(720px, 94vw); max-height: 88vh; overflow-y: auto; }
.builder-yaml { font-size: .84rem; white-space: pre; }
.builder-yaml-help { font-size: .78rem; background: var(--dm-surface-2, #f4f6fb); border: 1px solid var(--dm-border, #e3e7ef); border-radius: 8px; padding: 8px 10px; margin: 6px 0 0; }
.builder-perm { position: fixed; z-index: 1300; width: 320px; }
.builder-perm-groups { display: flex; flex-direction: column; max-height: 180px; overflow-y: auto; border: 1px solid var(--dm-border, #e3e7ef); border-radius: 8px; padding: 6px 10px; }

/* built-in controls */
.bctl-carousel { position: relative; width: 100%; overflow: hidden; border-radius: 12px; background: #0e1524; }
.bctl-slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s ease; }
.bctl-slide.active { opacity: 1; }
.bctl-arrow { position: absolute; top: 50%; transform: translateY(-50%); border: 0; background: rgba(10,18,32,.45); color: #fff; font-size: 1.6rem; width: 40px; height: 48px; border-radius: 8px; z-index: 2; }
.bctl-arrow:hover { background: rgba(10,18,32,.7); }
.bctl-prev { left: 10px; } .bctl-next { right: 10px; }
.bctl-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; z-index: 2; }
.bctl-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; background: transparent; padding: 0; }
.bctl-dot.active { background: #fff; }
.bctl-rotator { position: relative; overflow: hidden; border-radius: 12px; }
.bctl-rotator img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s ease; position: absolute; inset: 0; }
.bctl-rotator img.active { opacity: 1; position: relative; }
.bctl-html img { max-width: 100%; }

/* visitor rendering */
.bp-visitor { position: relative; min-height: 120px; }

/* structural controls (design mode markers, invisible in the view) */
.bctl-sizer { border: 2px dashed #b9c6dd; border-radius: 10px; background: rgba(120,150,200,.06); display: flex; align-items: center; justify-content: center; min-width: 60px; min-height: 26px; color: #7a8aa0; font-size: .78rem; font-weight: 600; }
.bctl-sizer-x { height: 26px; }
.bctl-sizer-y { width: 100%; }
.bctl-sizer-block { height: 26px; border-style: dotted; }
.bctl-flowchanger { display: inline-flex; align-items: center; gap: 6px; border: 2px dashed #9fb6e8; background: rgba(70,120,220,.07); border-radius: 10px; padding: 6px 10px; }
.bctl-flowchanger-label { font-size: .78rem; color: #5566aa; font-weight: 600; margin-right: 2px; }
.bctl-flowdir { border: 1px solid #c4d2ee; background: #fff; color: #5566aa; border-radius: 6px; width: 30px; height: 26px; display: inline-grid; place-items: center; }
.bctl-flowdir:hover { border-color: #1769e0; color: #1769e0; }
.bctl-flowdir.active { background: #1769e0; border-color: #1769e0; color: #fff; }
.bctl-gap { border: 2px dashed #d8b26a; border-radius: 10px; background: repeating-linear-gradient(45deg, rgba(216,178,106,.10), rgba(216,178,106,.10) 10px, rgba(216,178,106,.04) 10px, rgba(216,178,106,.04) 20px); display: flex; align-items: center; justify-content: center; color: #a8852f; font-size: .78rem; font-weight: 600; min-width: 80px; }

/* path editor overlay (design mode) */
.bp-pathline { fill: none; stroke: #5a8dee; stroke-width: 2.5; stroke-dasharray: 7 5; }
.bp-pathpt { fill: #fff; stroke: #1769e0; stroke-width: 2.5; cursor: grab; pointer-events: auto; }
.bp-pathpt:hover { fill: #1769e0; }
.bp-pathnum { fill: #1769e0; font-size: 12px; font-weight: 700; pointer-events: none; user-select: none; font-family: inherit; }
/* pen mode = full overlay: the pinbar strip above the hovered item would
   swallow every click (its buttons are excluded from point-setting), so it
   is hidden while drawing — points are settable ANYWHERE incl. that strip */
.bp-penmode .bp-pinbar { display: none !important; }
/* hover effects — individual transform properties (scale/rotate) compose with
   the translate keyframes of shake, they never clobber each other */
@keyframes bpfx-shake {
    0%, 100% { translate: 0 0; }
    20% { translate: -6px 2px; }
    40% { translate: 5px -3px; }
    60% { translate: -4px -2px; }
    80% { translate: 4px 3px; }
}
.bpfx-shake { animation: bpfx-shake .45s ease-in-out infinite; }
.bpfx-shake-once { animation: bpfx-shake .45s ease-in-out 1; }
@keyframes bpfx-rot {
    from { rotate: 0deg; }
    to { rotate: var(--bpfx-deg, 15deg); }
}
.bpfx-rot { animation: bpfx-rot 1s ease-in-out infinite alternate; }
/* 2 iterations = hin und zurück, then it rests */
.bpfx-rot-once { animation: bpfx-rot 1s ease-in-out 2; }
/* color tint overlay (filter-like coloring of the whole element) */
.bpfx-tint { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
/* fx dialog color swatches: rectangular windows, checkerboard = transparent */
.bp-swatch { width: 26px; height: 20px; padding: 0; border-radius: 3px; border: 1px solid rgba(128,128,128,.55); cursor: pointer; flex: none; }
.bp-swatch-none {
    background:
        linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%),
        linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%),
        #fff !important;
    background-size: 8px 8px !important;
    background-position: 0 0, 4px 4px !important;
}
.bp-swatch-custom { position: relative; overflow: hidden; background: conic-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.bp-swatch-custom::-webkit-color-swatch-wrapper { padding: 0; }
.bp-swatch-custom::-webkit-color-swatch { border: none; opacity: 0; }
.bp-swatch-custom::-moz-color-swatch { border: none; opacity: 0; }
.bp-prio { width: 50px; height: 22px; font-size: .72rem; padding: 0 1px; border: 1px solid var(--dm-border, #d5deee); border-radius: 5px; background: var(--dm-surface-2, #f1f5fd); color: inherit; flex: none; }
.bp-prio:focus { outline: 1px solid #1769e0; }
.bp-palette { display: flex; flex-wrap: wrap; gap: 3px; width: 100%; padding: 4px 6px; margin: 2px 0 4px; background: var(--dm-surface-2, #f1f5fd); border: 1px solid var(--dm-border, #d5deee); border-radius: 6px; }

/* generated settings form (pencil) */
.bpe-rt-wrap { border: 1px solid var(--dm-border, #d5dce8); border-radius: 10px; overflow: hidden; }
.bpe-rt-bar { display: flex; gap: 2px; padding: 5px 7px; background: var(--dm-surface-2, #eef2f9); border-bottom: 1px solid var(--dm-border, #dde3ee); }
.bpe-rt-btn { border: 1px solid transparent; background: transparent; color: #52627a; border-radius: 6px; width: 30px; height: 26px; display: inline-grid; place-items: center; }
.bpe-rt-btn:hover { background: #fff; border-color: #c9d4e8; color: #1769e0; }
.bpe-rt { min-height: 110px; max-height: 260px; overflow-y: auto; padding: 10px 12px; background: var(--dm-surface, #fff); color: var(--dm-text, #172b4d); outline: none; font-size: .9rem; }
.bpe-rt:focus { box-shadow: inset 0 0 0 2px rgba(23,105,224,.35); }
.bpe-rt img { max-width: 100%; }
.bpe-rt ul { padding-left: 1.2em; margin-bottom: .5em; }

/* toolbox drag preview (native drag image) */
.bp-dragpreview { position: fixed; left: -9999px; top: 0; width: 300px; pointer-events: none; z-index: 1; opacity: .95; }
.bp-dragpreview .bctl-carousel, .bp-dragpreview .bctl-rotator { border-radius: 12px; overflow: hidden; }

/* flow changer = always-visible full-width line between the rows */
.bp-item-flowline { pointer-events: none; z-index: 26; }
.bp-item-flowline .bctl-flowline { pointer-events: auto; }
.bctl-flowline { display: flex; align-items: center; gap: 5px; width: 100%; height: 30px; }
.bctl-flowline-rule { flex: 1; height: 2px; background: repeating-linear-gradient(90deg, #5a8dee 0 14px, transparent 14px 24px); border-radius: 1px; }
.bctl-flowdir { flex: none; }
.bctl-flowdir.active { box-shadow: 0 0 0 2px rgba(23,105,224,.4); }

/* group box: nested canvas frame */
.bctl-group { width: 100%; height: 100%; min-height: 120px; border: 2px solid #7c9cd8; border-radius: 14px; background: rgba(90,140,230,.05); }
.bctl-group-title { display: flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: .8rem; font-weight: 700; color: #4a6cb3; border-bottom: 1px dashed #a9bfe8; }
.bctl-group-flow { margin-left: auto; min-width: 44px; width: auto; text-align: center; text-align-last: center; font-size: .88rem; line-height: 1.35; font-weight: 700; padding: 1px 8px; border: 1px solid var(--dm-border, #a9bfe8); border-radius: 6px; background: var(--dm-surface-2, rgba(255,255,255,.6)); color: inherit; cursor: pointer; appearance: none; -webkit-appearance: none; }
.bctl-group-flow:hover { border-color: #1769e0; }
.bctl-group-flow:focus { outline: none; border-color: #1769e0; box-shadow: 0 0 0 2px rgba(23,105,224,.25); }

/* hint overlay lives in the canvaswrap now (the canvas itself is imperatively re-rendered);
   purely informational - must never block drops on an empty canvas */
.builder-hint { position: absolute; top: 18px; left: 18px; right: 18px; z-index: 8; pointer-events: none; }
/* layout zones (centered/split): dotted design surface per zone */
.bp-no-dots { background-image: none !important; }
.bp-zone-frame { position: absolute; border-radius: 12px; border: 1px dashed rgba(120,150,200,.35); background-image: radial-gradient(circle, rgba(120,140,170,.14) 1px, transparent 1px); background-size: 25px 25px; pointer-events: none; }

/* visitor view: group box frame is invisible (size carrier only) */
.bctl-group-view { border-color: transparent !important; background: transparent !important; }
.bp-visitor .bctl-group-title { display: none; }

/* background layer: painted behind the foreground, never intercepts clicks */
.bp-item-bg { pointer-events: none; }
.bctl-hero { width: 100%; border-radius: 12px; }

/* group title-bar inner-padding slider (design mode only) */
.bctl-group-pad { width: 100px; height: 14px; padding: 0; margin: 0; accent-color: #1769e0; cursor: pointer; flex: none; }
.bctl-group-pad-val { font-size: .68rem; font-weight: 400; color: #6c757d; min-width: 30px; text-align: right; flex: none; }
/* device adaptation (builder toolbar + visitor scaler) */
.bp-adapt { width: 108px; }
.bp-dim { width: 74px; }
.bp-scaler { position: relative; }
/* cursor picker: button + rows that carry the cursor themselves */
.bp-curpick { position: relative; }
.bp-curbtn { width: 100%; background: var(--dm-surface-2, #f1f5fd); }
.bp-curlist { position: absolute; z-index: 80; left: 0; right: 0; max-height: 240px; overflow-y: auto; background: var(--dm-surface, #fff); border: 1px solid var(--dm-border, #d5deee); border-radius: 6px; box-shadow: 0 6px 18px rgba(10,18,32,.25); }
.bp-currow { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: .85rem; }
.bp-currow:hover { background: var(--dm-surface-2, #eef3fb); }
.bp-currow.active { background: rgba(23,105,224,.14); font-weight: 600; }
/* fx dialog: wider + sections as panels */
.builder-dialog { width: min(880px, 96vw); }
.bp-fxsec { background: var(--dm-surface-2, #f4f7fd); border: 1px solid var(--dm-border, #dfe6f2); border-radius: 10px; padding: 8px 12px 10px; margin-top: 10px; }
.builder-dialog .form-range { min-width: 0; }
/* smaller loop-mode icons */
.bp-loopbtn { font-size: .68rem; padding: .02rem .28rem !important; line-height: 1.5; }
/* lake panel */
.lake-card.active { border-color: #1769e0; box-shadow: 0 0 0 1px #1769e0 inset; }
.lake-wrap .card { background: var(--dm-surface, #fff); color: var(--dm-text, inherit); border-color: var(--dm-border, rgba(0,0,0,.125)); }
/* view content alignment + invisible mode */
.bctl-view-content { display: flex; flex-direction: column; }
.bctl-view-content[data-ax="center"] { align-items: center; text-align: center; }
.bctl-view-content[data-ax="right"] { align-items: flex-end; text-align: right; }
.bctl-view-content[data-ay="middle"] { justify-content: center; }
.bctl-view-content[data-ay="bottom"] { justify-content: flex-end; }
.bctl-view-invisible { background: transparent !important; border: none !important; box-shadow: none !important; }
/* loading badge: small overlay, always top-left inside the view — and it
   only becomes visible at all after JS removes .d-none (4s fetch delay) */
.bctl-view { position: relative; }
.bctl-view-loading { position: absolute; top: 8px; left: 8px; z-index: 5;
    display: none; align-items: center; gap: .4rem;
    padding: .25rem .6rem; border-radius: .375rem; font-size: .75rem;
    background: rgba(0, 0, 0, .65); color: #ddd;
    backdrop-filter: blur(2px); }
.bctl-view-loading:not(.d-none) { display: flex; }
/* view content alignment + invisible mode */
.bctl-view-content { display: flex; flex-direction: column; }
.bctl-view-content[data-ax="center"] { align-items: center; text-align: center; }
.bctl-view-content[data-ax="right"] { align-items: flex-end; text-align: right; }
.bctl-view-content[data-ay="middle"] { justify-content: center; }
.bctl-view-content[data-ay="bottom"] { justify-content: flex-end; }
.bctl-view-invisible { background: transparent !important; border: none !important; box-shadow: none !important; }

/* anchor ghost: dashed chip in the designer, invisible (geometry-carrying)
   marker in the visitor view */
.bctl-anchor { display: flex; align-items: center; gap: 3px; width: 25px; height: 25px;
    overflow: hidden; border: 1px dashed #1769e0; border-radius: 6px;
    background: rgba(23, 105, 224, .12); color: #1769e0; font-size: 10px;
    padding: 0 3px; white-space: nowrap; }
.bctl-anchor i { font-size: 11px; flex: none; }
.bctl-anchor span { overflow: hidden; text-overflow: ellipsis; }
.bctl-anchor-live { visibility: hidden; }

/* pinbar focus discipline: while ONE bar is hovered, no other bar may pop
   up over it; the hovered bar always paints topmost */
.bp-stage:has(.bp-pinbar:hover) .bp-pinbar:not(:hover):not(.bp-pinbar-on) { opacity: 0 !important; }
.bp-pinbar:hover { z-index: 70 !important; }

/* while an element is being dragged (from its toolbar or the item itself),
   every OTHER toolbar stays hidden; only the dragged element's bar remains */
.bp-bardrag .bp-pinbar { opacity: 0 !important; pointer-events: none !important; }
.bp-bardrag .bp-pinbar.bp-pinbar-on { opacity: 1 !important; pointer-events: auto !important; }

/* shape: frameless ("invisible mode" is inherent), SVG centered on both
   axes; the image drives the height (adjust-to-content) */
.bctl-shape { width: 100%; min-height: 40px; display: flex; align-items: center; justify-content: center; }
.bctl-shape img.bctl-shape-img { width: 100%; height: auto; display: block; }
.bctl-shape-empty { border: 1px dashed #8aa4c8; border-radius: 8px; color: #8aa4c8; min-height: 90px; }
.bctl-shape-ph { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .72rem; padding: 8px; text-align: center; }
.bctl-shape-ph i { font-size: 26px; }

/* html element: alignment (flex only when non-default; X also via text-align
   so plain block content aligns without becoming flex items) */
.bctl-html[data-ax="center"] { text-align: center; }
.bctl-html[data-ax="right"] { text-align: right; }
/* full width stays full width — X alignment happens via text-align INSIDE
   the stretched content (text center = element center), Y via flex */
.bctl-html-flex { display: flex; flex-direction: column; }
.bctl-html-flex[data-ay="middle"] { justify-content: center; }
.bctl-html-flex[data-ay="bottom"] { justify-content: flex-end; }

/* no text selection anywhere in the rendered page */
.bp-visitor, .bp-visitor * { user-select: none; -webkit-user-select: none; }

/* fixed-height items: the inner wrapper fills the item so flex alignment
   inside html elements has the full box to center in */
.bp-item-fixedh .bp-item-inner { height: 100%; }
.bp-item .bctl-html-flex { height: 100%; }

/* vertical centering must hit the TEXT middle: strip the outer children's
   block margins inside the flex wrapper (asymmetric margins would shift the
   content off the exact center) */
.bctl-html-flex > :first-child { margin-top: 0; }
.bctl-html-flex > :last-child { margin-bottom: 0; }

/* draggable settings / fx dialogs */
.builder-dialog .card-header { cursor: grab; }
.builder-dialog.bp-dlg-dragging .card-header { cursor: grabbing; }
.builder-dialog.bp-dlg-dragging { user-select: none; }

/* the pinbar itself drags the element: grab cursor (buttons keep pointer) */
.bp-pinbar { cursor: grab; }
.bp-pinbar:active { cursor: grabbing; }
.bp-pinbar button, .bp-pinbar select, .bp-pinbar input { cursor: pointer; }

/* fx category dot: category contains effects */
.bp-fxdot { color: #4dabf7; font-size: .55rem; margin-left: 5px; vertical-align: middle; }

/* pinbar hide grace period: 1.5s after the pointer leaves before the bar
   fades — hovering back during the wait cancels the hide (show is instant) */
.bp-pinbar { transition: opacity .12s ease 1.5s !important; }
.bp-item:hover + .bp-pinbar, .bp-pinbar:hover, .bp-pinbar-on { transition-delay: 0s !important; }

/* unset range: greyed slider signalling the inherited state */
.bp-range-unset { opacity: .35; }

/* optical centering: trim the line boxes to the actual text ink so flex
   centers the VISIBLE text, not the (line-height inflated) line box */
.bctl-html-flex, .bctl-html-flex > * {
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
}

/* fx/settings dialog: keep OK/Cancel reachable — the body scrolls when the
   content (effect categories, OnAnchor entries) grows past the viewport */
.builder-dialog .card-body { max-height: calc(100vh - 150px); overflow-y: auto; }

/* showcase: label buttons + content pane / accordion */
.bctl-showcase { display: flex; gap: 10px; width: 100%; height: 100%; }
.bctl-showcase[data-align="left"] { flex-direction: row; }
.bctl-showcase[data-align="right"] { flex-direction: row-reverse; }
.bctl-showcase[data-align="top"] { flex-direction: column; }
.bctl-showcase[data-align="bottom"] { flex-direction: column-reverse; }
.bctl-sc-btns { display: flex; flex-direction: column; gap: 6px; }
.bctl-showcase[data-align="top"] .bctl-sc-btns, .bctl-showcase[data-align="bottom"] .bctl-sc-btns { flex-direction: row; flex-wrap: wrap; }
.bctl-sc-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
    padding: 8px 14px; border: 1px solid var(--dm-border, #d5deee); border-radius: 8px;
    background: var(--dm-surface-2, #f4f7fd); color: inherit; text-align: left; cursor: pointer; }
.bctl-sc-btn .bctl-sc-lbl { font-weight: 600; font-size: .85rem; }
.bctl-sc-btn .bctl-sc-sub { font-size: .72rem; opacity: .65; }
.bctl-sc-btn.active { background: #1769e0; border-color: #1769e0; color: #fff; }
.bctl-showcase-pane { flex: 1; min-width: 0; min-height: 0; overflow: auto;
    border: 1px solid var(--dm-border, #d5deee); border-radius: 8px; padding: 10px 12px;
    background: var(--dm-surface, #fff); }
.bctl-sc-pane { min-height: 100%; }
.bctl-showcase.bctl-sc-acc { flex-direction: column; }
.bctl-showcase.bctl-sc-acc .bctl-sc-btn { width: 100%; }
.bctl-sc-acc-panel { padding: 8px 12px; border: 1px solid var(--dm-border, #d5deee);
    border-top: none; border-radius: 0 0 8px 8px; margin-top: -6px; margin-bottom: 6px; }

/* background overlays anchored OUTSIDE the live grid: unscaled, unclipped
   viewport layer so they stay exactly where the builder placed them */
.bp-bganchor { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: visible; }
.bp-bganchor-item { position: absolute; pointer-events: none; width: max-content; }

/* toolbox template chips: dashed amber, distinct from plain controls */
.builder-tpl-chip { border: 1px dashed #c98a00 !important; background: rgba(255,193,7,.14) !important; }

/* content controls: heading / text / image */
.bctl-heading-tag { line-height: 1.2; }
.bctl-text { line-height: 1.5; }
.bctl-text p:last-child { margin-bottom: 0; }
.bctl-image img.bctl-image-img { display: block; max-width: 100%; height: auto; }
.bctl-image-empty { min-height: 90px; border: 1px dashed #8aa4c8; border-radius: 8px; color: #8aa4c8; display: flex; align-items: center; justify-content: center; }
.bctl-image-ph { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .72rem; padding: 8px; text-align: center; }
.bctl-image-ph i { font-size: 26px; }

/* ================= showcase v2: templates, effects, pager, search ================= */
/* NOTE: no flex-wrap here — a WRAPPING COLUMN flex container gets a
   definite-ish height in Chrome and spills its children into side-by-side
   columns instead of stacking them */
.bctl-showcase { --sc-accent: #1769e0; display: flex; gap: 12px; width: 100%; height: 100%; }
.bctl-showcase[data-style] { flex-direction: column; }
/* NOTE: these need the .bctl-showcase prefix — a bare class loses the
   specificity fight against .bctl-showcase[data-style] (0,2,0) */
.bctl-showcase.bctl-sc-nav-top { flex-direction: column; }
/* "bottom" must NOT reverse the whole column (that would drag the search bar
   to the bottom too) — keep the column order and move only nav/pager down */
.bctl-showcase.bctl-sc-nav-bottom { flex-direction: column; }
.bctl-sc-nav-bottom .bctl-sc-nav { order: 3; }
.bctl-sc-nav-bottom .bctl-sc-cardgrid { order: 3; }   /* Karten-Raster: "Leiste unten" = Karten unter dem Textfenster */
.bctl-sc-nav-bottom .bctl-sc-pager { order: 2; }
/* wrap ONLY in row layouts (search full-row + nav/pane side by side) —
   a wrapping COLUMN container misbehaves in Chrome (see note above) */
.bctl-showcase.bctl-sc-nav-left { flex-direction: row; flex-wrap: wrap; }
.bctl-showcase.bctl-sc-nav-right { flex-direction: row-reverse; flex-wrap: wrap; }

/* search: full width, ALWAYS first (above nav AND text window), no matter
   the nav justification. In row layouts it needs a full-row basis (basis =
   width there); in column layouts plain width:100% is enough */
.bctl-sc-search { order: -1; width: 100%; max-width: 100%; height: 38px; min-height: 38px; align-self: flex-start;
    margin-bottom: 4px; border-radius: 20px !important; padding-left: 14px; }
.bctl-showcase.bctl-sc-nav-left .bctl-sc-search, .bctl-showcase.bctl-sc-nav-right .bctl-sc-search { flex: 0 0 100%; }

/* nav buttons (shared) */
.bctl-sc-nav { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
/* left/right nav = fixed side column for ALL templates (a content-sized nav
   would claim the full row — long pill labels make max-content ~100%) */
.bctl-showcase.bctl-sc-nav-left .bctl-sc-nav, .bctl-showcase.bctl-sc-nav-right .bctl-sc-nav { flex-direction: column; flex: 0 0 220px; min-width: 0; }
.bctl-sc-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
    padding: 9px 16px; border: 1px solid var(--dm-border, #d5deee); border-radius: 12px;
    background: var(--dm-surface-2, #f4f7fd); color: inherit; text-align: left; cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease; }
.bctl-sc-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(23,43,77,.12); }
.bctl-sc-txt { display: flex; flex-direction: column; min-width: 0; }
.bctl-sc-btn .bctl-sc-lbl { font-weight: 600; font-size: .86rem; }
.bctl-sc-btn .bctl-sc-sub { font-size: .72rem; opacity: .62; }
.bctl-sc-btn .bctl-sc-ic { font-size: 1.05rem; color: var(--sc-accent); margin-bottom: 2px; }
.bctl-sc-btn .bctl-sc-icimg { width: 22px; height: 22px; object-fit: contain; margin-bottom: 2px; }
.bctl-sc-thumb { display: block; margin: -3px -6px 5px; }
.bctl-sc-thumb-img { width: 100%; height: 74px; object-fit: cover; border-radius: 8px; display: block; }
.bctl-sc-btn.active { background: var(--sc-accent); border-color: var(--sc-accent); color: #fff; }
.bctl-sc-btn.active .bctl-sc-ic { color: #fff; }
.bctl-sc-btn.active .bctl-sc-sub { opacity: .82; }

/* pills: modern chip look — icon and text on ONE row (no height overlap with
   long labels), only lightly rounded */
.bctl-sc-pills .bctl-sc-btn { flex-direction: row; align-items: center; gap: 8px; border-radius: 12px; padding: 8px 16px; }
.bctl-sc-pills .bctl-sc-btn .bctl-sc-ic, .bctl-sc-pills .bctl-sc-btn .bctl-sc-icimg { margin-bottom: 0; flex: none; }
.bctl-sc-pills .bctl-sc-btn .bctl-sc-thumb { margin: -3px 0; flex: 0 0 46px; }
.bctl-sc-pills .bctl-sc-btn .bctl-sc-thumb-img { height: 46px; width: 46px; }
.bctl-sc-pills .bctl-sc-btn.active { box-shadow: 0 6px 18px color-mix(in srgb, var(--sc-accent) 45%, transparent); }

/* tabs: underline look */
.bctl-sc-tabs .bctl-sc-btn { border: none; border-bottom: 3px solid transparent; border-radius: 10px 10px 0 0; background: transparent; }
.bctl-sc-tabs .bctl-sc-btn.active { background: transparent; color: var(--sc-accent); border-bottom-color: var(--sc-accent); }
.bctl-sc-tabs .bctl-sc-btn.active .bctl-sc-sub { opacity: .7; }

/* sidebar: emphasised vertical list */
.bctl-sc-sidebar .bctl-sc-nav { gap: 6px; }
.bctl-sc-sidebar .bctl-sc-btn { width: 100%; flex-direction: row; align-items: center; gap: 10px; }
.bctl-sc-sidebar .bctl-sc-btn .bctl-sc-thumb { flex: 0 0 64px; margin: 0; }
.bctl-sc-sidebar .bctl-sc-btn .bctl-sc-thumb-img { height: 48px; }
.bctl-sc-sidebar .bctl-sc-btn.active { border-left: 4px solid #fff; }

/* content pane */
.bctl-showcase-pane { flex: 1; min-width: 0; min-height: 0; overflow: auto;
    border: 1px solid var(--dm-border, #d5deee); border-radius: 14px; padding: 14px 16px;
    background: var(--dm-surface, #fff); box-shadow: 0 2px 10px rgba(23,43,77,.05); }
.bctl-sc-slides { position: relative; }
.bctl-sc-slide .bctl-sc-content > :last-child { margin-bottom: 0; }

/* accordion */
.bctl-showcase.bctl-sc-acc { flex-direction: column; gap: 0; }
.bctl-showcase.bctl-sc-acc .bctl-sc-btn { width: 100%; border-radius: 12px; margin-bottom: 6px; flex-direction: row; align-items: center; gap: 10px; }
.bctl-showcase.bctl-sc-acc .bctl-sc-btn.active { border-radius: 12px 12px 0 0; margin-bottom: 0; }
.bctl-sc-acc-panel { padding: 10px 14px; border: 1px solid var(--dm-border, #d5deee); border-top: none;
    border-radius: 0 0 12px 12px; margin: -6px 0 8px; background: var(--dm-surface, #fff); }

/* cards grid — the box grows with its content: no fixed height, no scrollbar */
.bctl-showcase[data-style="cards"] { height: auto; }
.bctl-showcase[data-style="cards"] .bctl-sc-slides { overflow: visible; }
.bctl-sc-cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.bctl-sc-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
    padding: 12px; border: 1px solid var(--dm-border, #d5deee); border-radius: 14px; cursor: pointer;
    background: var(--dm-surface-2, #f4f7fd); color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.bctl-sc-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(23,43,77,.14); }
.bctl-sc-card.active { border-color: var(--sc-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sc-accent) 35%, transparent); }
.bctl-sc-card .bctl-sc-lbl { font-weight: 600; font-size: .86rem; }
.bctl-sc-card .bctl-sc-sub { font-size: .72rem; opacity: .62; }
.bctl-sc-card .bctl-sc-ic { font-size: 1.4rem; color: var(--sc-accent); }
.bctl-sc-card-img { display: block; width: 100%; margin: -2px 0 4px; }
.bctl-sc-card-photo { width: 100%; height: 84px; object-fit: cover; border-radius: 10px; display: block; }

/* media on top of a slide (non-slider styles) */
.bctl-sc-media-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; display: block; margin-bottom: 8px; }

/* slider */
.bctl-sc-slider { position: relative; display: block; }
.bctl-sc-slider .bctl-sc-slides { border-radius: 14px; overflow: hidden; background: #0e1524; }
.bctl-sc-slider .bctl-sc-slide { position: absolute; inset: 0; }
.bctl-sc-slider .bctl-sc-slide .bctl-sc-media { position: absolute; inset: 0; }
.bctl-sc-slider .bctl-sc-media-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bctl-sc-slider .bctl-sc-slide .bctl-sc-content { position: absolute; left: 0; right: 0; bottom: 0;
    padding: 18px 20px; color: #fff; background: linear-gradient(transparent, rgba(8,12,24,.82)); }
.bctl-sc-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
    width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,.85); color: #172b4d; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.bctl-sc-arrow:hover { background: #fff; }
.bctl-sc-slider .bctl-sc-prev { left: 12px; }
.bctl-sc-slider .bctl-sc-next { right: 12px; }
.bctl-sc-dots { display: flex; justify-content: center; gap: 7px; margin-top: 10px; }
.bctl-sc-dot { width: 10px; height: 10px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,.55); padding: 0; }
.bctl-sc-dot.active { background: var(--sc-accent); transform: scale(1.25); }

/* pager (non-slider): ALWAYS a full-width centered row BELOW the text window,
   no matter the nav justification */
.bctl-sc-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; width: 100%; }
.bctl-showcase.bctl-sc-nav-left .bctl-sc-pager, .bctl-showcase.bctl-sc-nav-right .bctl-sc-pager { flex: 0 0 100%; }
.bctl-sc-pager .bctl-sc-prev, .bctl-sc-pager .bctl-sc-next { position: static; transform: none;
    width: 30px; height: 30px; background: var(--dm-surface-2, #f4f7fd); border: 1px solid var(--dm-border, #d5deee); box-shadow: none; }
.bctl-sc-count { font-size: .78rem; opacity: .7; font-variant-numeric: tabular-nums; }

/* switch effects */
@keyframes bpscFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bpscSlide { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.bctl-sc-anim-fade { animation: bpscFade .35s ease; }
.bctl-sc-anim-slide { animation: bpscSlide .35s ease; }
.bctl-sc-slider .bctl-sc-anim-fade { animation: bpscFade .5s ease; }
.bctl-sc-slider .bctl-sc-anim-slide { animation: bpscSlide .5s ease; }

/* showcase button templates: the saved template REPLACES the default button
   look — strip all default button chrome, keep click/active behaviour */
.bctl-sc-btn.bctl-sc-btn-tpl { background: none; border: none; padding: 0; border-radius: 0;
    color: inherit; text-align: inherit; box-shadow: none; min-width: 0;
    overflow: visible; max-width: 100%;
    align-items: stretch; }   /* base buttons use flex-start — that shrinks the
    template wrapper to fit-content (a few px) instead of the button width */
.bctl-sc-btn-tpl .bctl-sc-tplel { width: 100%; height: 100%; }   /* fill the
    positioning box so stored heights + align_y/flex + {this} height rules work */
.bctl-sc-tplel > .bctl-html-flex { height: 100%; }   /* canvas: .bp-item .bctl-html-flex */
.bctl-sc-btn-tpl .bctl-sc-tplel > * { max-width: 100%; }
.bctl-sc-btn.bctl-sc-btn-tpl:hover { transform: none; box-shadow: none; }
/* template buttons render their OWN selected state (template effects/css) —
   no extra select frame */
.bctl-sc-btn.bctl-sc-btn-tpl.active { background: none; border: none; color: inherit;
    box-shadow: none; border-radius: 0; }
.bctl-sc-btn.bctl-sc-btn-tpl .bctl-sc-tplel { display: block; min-width: 0; }
.bctl-sc-sidebar .bctl-sc-btn.bctl-sc-btn-tpl,
.bctl-showcase.bctl-sc-nav-left .bctl-sc-btn.bctl-sc-btn-tpl,
.bctl-showcase.bctl-sc-nav-right .bctl-sc-btn.bctl-sc-btn-tpl { width: 100%; }

/* receiver flags: mouse receiver shows a pointer inside template buttons */
.bctl-sc-btn-tpl [data-mouse] { cursor: pointer; }
