/* =========================================================
   Jalpi Page Builder — Prism Studio Theme (Light)
   Light canvas · White topbar · Indigo accent · Rose CTA
   Layout: full-width canvas + single right Inspector panel
   ========================================================= */

:root {
  /* ── Backgrounds ──────────────────────────────────────── */
  --jalpi-bg:           #eef0f5;
  --jalpi-surface:      #ffffff;
  --jalpi-surface-2:    #f9fafb;
  --jalpi-surface-3:    #f3f4f6;
  --jalpi-surface-4:    #e5e7eb;

  /* ── Borders ──────────────────────────────────────────── */
  --jalpi-border:       rgba(15,23,42,0.08);
  --jalpi-border-2:     rgba(15,23,42,0.13);
  --jalpi-border-3:     rgba(15,23,42,0.22);

  /* ── Text ─────────────────────────────────────────────── */
  --jalpi-text:         #111827;
  --jalpi-text-muted:   #6b7280;
  --jalpi-text-dim:     #9ca3af;

  /* ── Aliases for legacy/undefined tokens ──────────────────
     These were referenced (notably by the Icon Picker modal,
     .jalpi-ip__*) but never defined, so they fell back to dark
     values and made the picker render as a dark modal inside the
     light editor. Defining them here as light-theme aliases fixes
     the picker (and a few other spots: Global Styles nav, dynamic-
     tag hover) without touching the ~100 usage sites. */
  --jalpi-panel:        var(--jalpi-surface);      /* was #1e1e24 (dark) */
  --jalpi-text-1:       var(--jalpi-text);         /* was #e4e4e7 (light-on-dark) */
  --jalpi-text-2:       var(--jalpi-text-muted);   /* was #a1a1aa */
  --jalpi-text-3:       var(--jalpi-text-dim);     /* was #71717a */
  --jalpi-hover:        var(--jalpi-surface-3);    /* subtle light hover bg */
  --jalpi-input-bg:     var(--jalpi-surface-2);    /* was rgba(255,255,255,0.05) */

  /* ── Topbar (light) ──────────────────────────────────── */
  --jalpi-topbar-bg:       #ffffff;
  --jalpi-topbar-surface:  #f9fafb;
  --jalpi-topbar-text:     #111827;
  --jalpi-topbar-muted:    #6b7280;
  --jalpi-topbar-border:   #e5e7eb;

  /* ── Accent — Black ───────────────────────────────────── */
  --jalpi-accent:       #1a1a1a;
  --jalpi-accent-hover: #000000;
  --jalpi-accent-rgb:   26,26,26;
  --jalpi-accent-dim:   rgba(26,26,26,0.08);

  /* ── CTA — Black ──────────────────────────────────────── */
  --jalpi-cta:          #1a1a1a;
  --jalpi-cta-hover:    #000000;
  --jalpi-cta-rgb:      26,26,26;

  /* ── Status ───────────────────────────────────────────── */
  --jalpi-success:      #059669;
  --jalpi-danger:       #dc2626;
  --jalpi-warning:      #d97706;

  /* ── Dimensions ───────────────────────────────────────── */
  --jalpi-topbar-h:     52px;
  --jalpi-sidebar-w:    300px;
  --jalpi-radius:       8px;
  --jalpi-radius-sm:    5px;
  --jalpi-radius-lg:    12px;
  --jalpi-radius-xl:    24px;

  /* ── Shadows ──────────────────────────────────────────── */
  --jalpi-shadow:       0 2px 8px rgba(15,23,42,0.08), 0 1px 3px rgba(15,23,42,0.05);
  --jalpi-shadow-lg:    0 12px 48px rgba(15,23,42,0.14), 0 4px 16px rgba(15,23,42,0.08);

  /* ── Font ─────────────────────────────────────────────── */
  --jalpi-font:  -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --jalpi-mono:  "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;
}

#jalpi-editor-root *, #jalpi-editor-root *::before, #jalpi-editor-root *::after {
  box-sizing: border-box;
}

/* =========================================================
   Root Layout
   ========================================================= */

.jalpi-editor {
  display:        flex;
  flex-direction: column;
  height:         100vh;
  background:     var(--jalpi-bg);
  color:          var(--jalpi-text);
  font-family:    var(--jalpi-font);
  font-size:      13px;
  overflow:       hidden;
}

.jalpi-editor__body {
  display:    flex;
  flex:       1;
  overflow:   hidden;
  min-height: 0;
}

/* Left sidebar — kept for legacy structure support */
.jalpi-editor__sidebar {
  width:          var(--jalpi-sidebar-w);
  flex-shrink:    0;
  background:     var(--jalpi-surface);
  border-right:   1px solid var(--jalpi-border);
  overflow-y:     auto;
  overflow-x:     hidden;
  display:        flex;
  flex-direction: column;
}

.jalpi-editor__sidebar--right {
  border-right:  none;
  border-left:   1px solid var(--jalpi-border);
  background:    var(--jalpi-surface);
  width:         var(--jalpi-sidebar-w);
}

.jalpi-editor__canvas-area {
  flex:           1;
  overflow:       hidden;
  display:        flex;
  flex-direction: column;
}

/* =========================================================
   Inspector Panel (right — combines Structure + Inspect)
   ========================================================= */

.jalpi-editor__inspector {
  width:          var(--jalpi-sidebar-w);
  flex-shrink:    0;
  background:     var(--jalpi-surface);
  border-left:    1px solid var(--jalpi-border);
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
}

/* Two-tab nav at the very top of the inspector */
.jalpi-inspector-nav {
  display:     flex;
  flex-shrink: 0;
  background:  var(--jalpi-surface-2);
  border-bottom: 1px solid var(--jalpi-border);
  padding:     4px;
  gap:         3px;
}

.jalpi-inspector-nav__btn {
  flex:            1;
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             6px;
  padding:         8px 6px;
  background:      transparent;
  border:          1px solid transparent;
  border-radius:   var(--jalpi-radius);
  color:           var(--jalpi-text-muted);
  font-size:       11px;
  font-weight:     600;
  letter-spacing:  0.03em;
  cursor:          pointer;
  transition:      all 0.16s;
  font-family:     var(--jalpi-font);
}

.jalpi-inspector-nav__btn:hover {
  color:      var(--jalpi-text);
  background: var(--jalpi-surface-3);
}

.jalpi-inspector-nav__btn.is-active {
  background:   var(--jalpi-accent-dim);
  color:        var(--jalpi-accent);
  border-color: rgba(var(--jalpi-accent-rgb), 0.25);
}

.jalpi-inspector-body {
  flex:       1;
  overflow-y: auto;
  overflow-x: hidden;
  display:    flex;
  flex-direction: column;
  min-height: 0;
}

/* =========================================================
   Top Bar  — Deep-indigo slab
   ========================================================= */

.jalpi-topbar {
  height:        var(--jalpi-topbar-h);
  background:    var(--jalpi-topbar-bg);
  border-bottom: 1px solid var(--jalpi-topbar-border);
  display:       flex;
  align-items:   center;
  padding:       0 14px;
  gap:           8px;
  flex-shrink:   0;
  z-index:       100;
}

.jalpi-topbar__left,
.jalpi-topbar__center,
.jalpi-topbar__right {
  display:     flex;
  align-items: center;
  gap:         6px;
}

.jalpi-topbar__left   { flex: 1; gap: 8px; }
.jalpi-topbar__center { flex: 1; justify-content: center; }
.jalpi-topbar__right  { flex: 1; justify-content: flex-end; gap: 4px; }

/* Logo */
.jalpi-topbar__logo {
  display:         flex;
  align-items:     center;
  gap:             8px;
  text-decoration: none;
  font-weight:     800;
  font-size:       14px;
  letter-spacing:  -0.03em;
  border-radius:   var(--jalpi-radius);
  transition:      opacity 0.15s;
}

.jalpi-topbar__logo span {
  background:              linear-gradient(110deg, #1a1a1a 0%, #444444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip:         text;
}

.jalpi-topbar__logo:hover { opacity: 0.8; }

.jalpi-topbar__divider {
  width:       1px;
  height:      18px;
  background:  var(--jalpi-topbar-border);
  flex-shrink: 0;
}

.jalpi-topbar__title {
  color:         var(--jalpi-topbar-muted);
  font-size:     12px;
  font-weight:   500;
  max-width:     160px;
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
}

.jalpi-topbar__dirty {
  color:       #fbbf24;
  font-size:   9px;
  line-height: 1;
}

/* Breakpoint switcher — light capsule */
.jalpi-topbar__center {
  background:    #f3f4f6;
  border:        1px solid #e5e7eb;
  border-radius: 999px;
  padding:       3px;
  gap:           1px;
}

.jalpi-topbar__bp-btn {
  background:    transparent;
  border:        none;
  color:         var(--jalpi-topbar-muted);
  border-radius: 999px;
  padding:       5px 13px;
  cursor:        pointer;
  display:       flex;
  align-items:   center;
  justify-content: center;
  transition:    all 0.18s;
  line-height:   1;
}

.jalpi-topbar__bp-btn:hover {
  color:      var(--jalpi-topbar-text);
  background: #e9eaec;
}

.jalpi-topbar__bp-btn.is-active {
  background: var(--jalpi-accent);
  color:      #fff;
  box-shadow: 0 2px 12px rgba(var(--jalpi-accent-rgb), 0.55);
}

.jalpi-topbar__bp-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
}

/* Zoom cluster */
.jalpi-topbar__zoom-btn {
  background:    #f3f4f6;
  border:        1px solid #e5e7eb;
  color:         var(--jalpi-topbar-muted);
  border-radius: var(--jalpi-radius-sm);
  padding:       4px 10px;
  cursor:        pointer;
  font-size:     12px;
  font-weight:   600;
  transition:    all 0.15s;
  line-height:   1;
}

.jalpi-topbar__zoom-btn:hover {
  color:        var(--jalpi-topbar-text);
  background:   #e9eaec;
  border-color: #d1d5db;
}

.jalpi-topbar__zoom-label {
  color:       var(--jalpi-topbar-muted);
  font-size:   11px;
  min-width:   34px;
  text-align:  center;
  font-weight: 600;
}

/* Topbar button overrides — light topbar */
.jalpi-topbar .jalpi-btn--ghost {
  color:   var(--jalpi-topbar-muted);
  padding: 5px 8px;
}

.jalpi-topbar .jalpi-btn--ghost:hover:not(:disabled) {
  color:      var(--jalpi-topbar-text);
  background: #f3f4f6;
}

.jalpi-topbar .jalpi-btn--secondary {
  background:   #f3f4f6;
  color:        var(--jalpi-topbar-text);
  border-color: #e5e7eb;
}

.jalpi-topbar .jalpi-btn--secondary:hover:not(:disabled) {
  background:   #e9eaec;
  border-color: #d1d5db;
}

/* =========================================================
   Shared Buttons
   ========================================================= */

.jalpi-btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             6px;
  padding:         7px 16px;
  border-radius:   var(--jalpi-radius);
  border:          1px solid transparent;
  cursor:          pointer;
  font-size:       12px;
  font-weight:     600;
  line-height:     1;
  letter-spacing:  0.01em;
  transition:      all 0.18s;
  white-space:     nowrap;
  font-family:     var(--jalpi-font);
}

.jalpi-btn:disabled { opacity: 0.38; cursor: not-allowed; }

/* CTA — Rose (Publish) */
.jalpi-btn--primary {
  background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
  color:      #fff;
  border:     none;
  box-shadow: 0 3px 12px rgba(var(--jalpi-cta-rgb), 0.38);
}

.jalpi-btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #000000, #1a1a1a);
  box-shadow: 0 5px 20px rgba(var(--jalpi-cta-rgb), 0.55);
  transform:  translateY(-1px);
}

/* Secondary — Save */
.jalpi-btn--secondary {
  background:   var(--jalpi-surface-2);
  color:        var(--jalpi-text);
  border-color: var(--jalpi-border-2);
}

.jalpi-btn--secondary:hover:not(:disabled) {
  background:   var(--jalpi-surface-3);
  border-color: var(--jalpi-border-3);
}

/* Ghost — undo/redo */
.jalpi-btn--ghost {
  background:    transparent;
  color:         var(--jalpi-text-muted);
  border:        none;
  padding:       5px 8px;
  border-radius: var(--jalpi-radius-sm);
}

.jalpi-btn--ghost:hover:not(:disabled) {
  color:      var(--jalpi-text);
  background: var(--jalpi-surface-3);
}

/* Violet accent inline */
.jalpi-btn--teal {
  background:   rgba(var(--jalpi-accent-rgb), 0.09);
  color:        var(--jalpi-accent);
  border:       1px solid rgba(var(--jalpi-accent-rgb), 0.22);
}

.jalpi-btn--teal:hover:not(:disabled) {
  background:   rgba(var(--jalpi-accent-rgb), 0.16);
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 12px rgba(var(--jalpi-accent-rgb), 0.2);
}

/* =========================================================
   Layers Panel
   ========================================================= */

.jalpi-layers {
  display:        flex;
  flex-direction: column;
  height:         100%;
  position:       relative;
}

/* ── Header ── */
.jalpi-layers__header {
  display:       flex;
  align-items:   center;
  gap:           6px;
  padding:       8px 8px 8px 10px;
  border-bottom: 1px solid var(--jalpi-border);
  flex-shrink:   0;
}

/* Search bar */
.jalpi-layers__search {
  display:       flex;
  align-items:   center;
  gap:           6px;
  flex:          1;
  padding:       5px 8px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border);
  border-radius: var(--jalpi-radius-sm);
  transition:    border-color 0.13s, box-shadow 0.13s;
}

.jalpi-layers__search:focus-within {
  border-color: rgba(var(--jalpi-accent-rgb), 0.45);
  box-shadow:   0 0 0 2px rgba(var(--jalpi-accent-rgb), 0.08);
  background:   var(--jalpi-surface);
}

.jalpi-layers__search svg { color: var(--jalpi-text-dim); flex-shrink: 0; }

.jalpi-layers__search-input {
  flex:        1;
  border:      none;
  background:  transparent;
  font-size:   11.5px;
  color:       var(--jalpi-text);
  font-family: var(--jalpi-font);
  outline:     none;
  min-width:   0;
}

.jalpi-layers__search-input::placeholder { color: var(--jalpi-text-dim); }

.jalpi-layers__search-clear {
  display:       flex;
  align-items:   center;
  background:    transparent;
  border:        none;
  cursor:        pointer;
  color:         var(--jalpi-text-dim);
  padding:       1px;
  border-radius: 3px;
  transition:    color 0.1s;
}

.jalpi-layers__search-clear:hover { color: var(--jalpi-text); }

/* Header controls */
.jalpi-layers__controls {
  display:     flex;
  align-items: center;
  gap:         2px;
  flex-shrink: 0;
}

.jalpi-layers__ctrl {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           24px;
  height:          24px;
  background:      transparent;
  border:          none;
  border-radius:   var(--jalpi-radius-sm);
  cursor:          pointer;
  color:           var(--jalpi-text-dim);
  transition:      all 0.12s;
}

.jalpi-layers__ctrl:hover { background: var(--jalpi-surface-3); color: var(--jalpi-text); }

.jalpi-layers__add-btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           24px;
  height:          24px;
  background:      rgba(var(--jalpi-accent-rgb), 0.1);
  color:           var(--jalpi-accent);
  border:          1px solid rgba(var(--jalpi-accent-rgb), 0.25);
  border-radius:   var(--jalpi-radius-sm);
  font-size:       16px;
  line-height:     1;
  cursor:          pointer;
  font-weight:     400;
  transition:      all 0.13s;
  font-family:     var(--jalpi-font);
}

.jalpi-layers__add-btn:hover {
  background:  rgba(var(--jalpi-accent-rgb), 0.18);
  border-color: var(--jalpi-accent);
}

/* ── List ── */
.jalpi-layers__list {
  flex:       1;
  overflow-y: auto;
  padding:    3px 0;
}

.jalpi-layers__empty {
  padding:    32px 16px;
  text-align: center;
  color:      var(--jalpi-text-muted);
}

.jalpi-layers__empty p {
  margin:      0 0 12px;
  font-size:   12px;
  line-height: 1.6;
}

/* ── Layer Row ── */
.jalpi-layer__row {
  display:       flex;
  align-items:   center;
  gap:           3px;
  height:        28px;
  cursor:        pointer;
  padding-right: 4px;
  border-left:   2px solid transparent;
  position:      relative;
  transition:    background 0.1s, border-left-color 0.1s;
  user-select:   none;
}

.jalpi-layer__row:hover { background: rgba(var(--jalpi-accent-rgb), 0.04); }

.jalpi-layer__row.is-selected {
  background:        linear-gradient(90deg, rgba(var(--jalpi-accent-rgb), 0.1), transparent 80%);
  border-left-color: var(--jalpi-accent);
}

/* Drop-indicator lines */
.jalpi-layer__row.is-drop-before::before,
.jalpi-layer__row.is-drop-after::after {
  content:    '';
  position:   absolute;
  left:       0;
  right:      0;
  height:     2px;
  background: var(--jalpi-accent);
  border-radius: 1px;
  z-index:    10;
}

.jalpi-layer__row.is-drop-before::before { top:    -1px; }
.jalpi-layer__row.is-drop-after::after   { bottom: -1px; }

/* Dragging source */
.jalpi-layer__row.is-dragging { opacity: 0.35; }

/* Hidden / locked states in layers */
.jalpi-layer__row.is-hidden .jalpi-layer__name  { opacity: 0.45; text-decoration: line-through; }
.jalpi-layer__row.is-locked .jalpi-layer__name  { opacity: 0.6; }
.jalpi-layer__row.is-locked .jalpi-layer__drag  { cursor: not-allowed; opacity: 0.3; }

/* ── Drag handle ── */
.jalpi-layer__drag {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           14px;
  height:          20px;
  color:           var(--jalpi-text-dim);
  opacity:         0;
  cursor:          grab;
  flex-shrink:     0;
  transition:      opacity 0.1s;
}

.jalpi-layer__row:hover .jalpi-layer__drag  { opacity: 1; }
.jalpi-layer__drag.is-disabled           { cursor: not-allowed; }

/* ── Expand button ── */
.jalpi-layer__expand {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           16px;
  height:          16px;
  background:      transparent;
  border:          none;
  color:           var(--jalpi-text-dim);
  cursor:          pointer;
  flex-shrink:     0;
  padding:         0;
  border-radius:   3px;
  transition:      color 0.1s, background 0.1s;
}

.jalpi-layer__expand:hover { background: var(--jalpi-surface-3); color: var(--jalpi-text); }
.jalpi-layer__expand--spacer { pointer-events: none; }

/* ── Type icon ── */
.jalpi-layer__icon {
  color:       var(--jalpi-text-dim);
  font-size:   10px;
  width:       15px;
  text-align:  center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Label ── */
.jalpi-layer__name {
  flex:          1;
  font-size:     13px;
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
  color:         var(--jalpi-text);
  min-width:     0;
}

.jalpi-layer__name-input {
  flex:          1;
  font-size:     11.5px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-accent);
  border-radius: var(--jalpi-radius-sm);
  color:         var(--jalpi-text);
  padding:       1px 5px;
  outline:       none;
  font-family:   var(--jalpi-font);
  min-width:     0;
  box-shadow:    0 0 0 2px rgba(var(--jalpi-accent-rgb), 0.12);
}

/* ── Quick-action buttons ── */
.jalpi-layer__quick {
  display:    flex;
  align-items: center;
  gap:         1px;
  opacity:    0;
  transition: opacity 0.1s;
  flex-shrink: 0;
}

.jalpi-layer__row:hover .jalpi-layer__quick,
.jalpi-layer__row.is-selected .jalpi-layer__quick { opacity: 1; }

/* Always show quick buttons for active states */
.jalpi-layer__row.is-hidden .jalpi-layer__quick,
.jalpi-layer__row.is-locked .jalpi-layer__quick  { opacity: 1; }

.jalpi-layer__qbtn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           20px;
  height:          20px;
  background:      transparent;
  border:          none;
  border-radius:   var(--jalpi-radius-sm);
  cursor:          pointer;
  color:           var(--jalpi-text-dim);
  transition:      all 0.1s;
  padding:         0;
}

.jalpi-layer__qbtn:hover         { background: var(--jalpi-surface-3); color: var(--jalpi-text); }
.jalpi-layer__qbtn.is-active     { color: var(--jalpi-accent); }
.jalpi-layer__qbtn.is-active.is-locked { color: #f59e0b; }

/* =========================================================
   Layers Context Menu (.jalpi-lctx)
   ========================================================= */

.jalpi-lctx {
  position:      fixed;
  z-index:       9999;
  background:    var(--jalpi-surface);
  border:        1px solid var(--jalpi-border);
  border-radius: 10px;
  box-shadow:    0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.1);
  padding:       4px;
  min-width:     148px;
  animation:     jalpi-lctx-in 0.12s ease both;
}

@keyframes jalpi-lctx-in {
  from { opacity: 0; transform: scale(0.94) translateY(-4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.jalpi-lctx__item {
  display:       flex;
  align-items:   center;
  gap:           8px;
  width:         100%;
  padding:       6px 10px;
  background:    transparent;
  border:        none;
  border-radius: 6px;
  cursor:        pointer;
  font-size:     12px;
  font-family:   var(--jalpi-font);
  color:         var(--jalpi-text);
  text-align:    left;
  white-space:   nowrap;
  transition:    background 0.1s, color 0.1s;
}

.jalpi-lctx__item:hover { background: rgba(var(--jalpi-accent-rgb), 0.08); color: var(--jalpi-accent); }

.jalpi-lctx__item svg { color: inherit; flex-shrink: 0; }

.jalpi-lctx__item--danger       { color: var(--jalpi-text-muted); }
.jalpi-lctx__item--danger:hover { background: rgba(220,38,38,0.08); color: var(--jalpi-danger); }

.jalpi-lctx__sep {
  height:     1px;
  background: var(--jalpi-border);
  margin:     3px 4px;
}

/* =========================================================
   Canvas locked-node badge (.jalpi-lock-badge)
   ========================================================= */

.jalpi-canvas-node.is-locked { cursor: default; }

.jalpi-lock-badge {
  position:    absolute;
  top:         4px;
  right:       4px;
  background:  rgba(245,158,11,0.88);
  color:       #fff;
  font-size:   10px;
  font-weight: 600;
  padding:     2px 7px 2px 5px;
  border-radius: 20px;
  display:     flex;
  align-items: center;
  gap:         4px;
  white-space: nowrap;
  pointer-events: none;
  z-index:     10;
}

/* =========================================================
   Canvas Area
   ========================================================= */

.jalpi-canvas-wrapper {
  flex:           1;
  overflow:       hidden;
  display:        flex;
  flex-direction: column;
}

/* Sticky "+ Add Section" bar pinned to the bottom of the canvas viewport */
.jalpi-canvas-sticky-footer {
  position:        sticky;
  bottom:          0;
  z-index:         10;
  display:         flex;
  align-items:     center;
  justify-content: center;
  padding:         10px 0 12px;
  background:      linear-gradient(to bottom, transparent 0%, rgba(248,248,248,0.92) 40%);
  pointer-events:  none;
}

/* ── Page clipboard right-click menu ────────────────────────── */
.jalpi-page-ctx-menu {
  position:      fixed;
  z-index:       9999;
  background:    #ffffff;
  border:        1px solid rgba(15,23,42,0.1);
  border-radius: 10px;
  box-shadow:    0 8px 32px rgba(15,23,42,0.16), 0 2px 8px rgba(15,23,42,0.06);
  width:         220px;
  overflow:      hidden;
  animation:     jalpi-ctx-in 0.12s ease;
  pointer-events: all;
}

@keyframes jalpi-ctx-in {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.jalpi-page-ctx-menu__heading {
  padding:        8px 12px 5px;
  font-size:      9.5px;
  font-weight:    800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color:          #9ca3af;
  border-bottom:  1px solid #f3f4f6;
}

.jalpi-page-ctx-menu__item {
  display:       flex;
  align-items:   center;
  gap:           9px;
  width:         100%;
  padding:       9px 12px;
  background:    transparent;
  border:        none;
  cursor:        pointer;
  font-size:     13px;
  font-weight:   500;
  color:         #111827;
  font-family:   var(--jalpi-font);
  text-align:    left;
  transition:    background 0.1s, color 0.1s;
}

.jalpi-page-ctx-menu__item:hover {
  background: rgba(var(--jalpi-accent-rgb), 0.07);
  color:      var(--jalpi-accent);
}

.jalpi-page-ctx-menu__item svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.jalpi-page-ctx-menu__item:hover svg { opacity: 1; }

.jalpi-page-ctx-menu__hint {
  padding:    5px 12px 8px;
  font-size:  10px;
  color:      #9ca3af;
  border-top: 1px solid #f3f4f6;
  line-height: 1.4;
}
.jalpi-canvas-sticky-footer > * { pointer-events: auto; }

/* ── Paste-page modal (HTTP fallback) ───────────────────────── */
.jalpi-paste-overlay {
  position:        fixed;
  inset:           0;
  z-index:         10000;
  background:      rgba(15,23,42,0.45);
  display:         flex;
  align-items:     center;
  justify-content: center;
  backdrop-filter: blur(2px);
  pointer-events:  all;
}

.jalpi-paste-modal {
  background:    #ffffff;
  border-radius: 12px;
  box-shadow:    0 20px 60px rgba(15,23,42,0.22);
  width:         440px;
  max-width:     calc(100vw - 32px);
  padding:       0;
  overflow:      hidden;
}

.jalpi-paste-modal__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         14px 16px;
  font-size:       14px;
  font-weight:     600;
  color:           #111827;
  border-bottom:   1px solid #f3f4f6;
}

.jalpi-paste-modal__close {
  background: transparent;
  border:     none;
  cursor:     pointer;
  color:      #9ca3af;
  padding:    4px;
  border-radius: 4px;
  display:    flex;
  align-items: center;
}
.jalpi-paste-modal__close:hover { color: #111827; background: #f3f4f6; }

.jalpi-paste-modal__hint {
  margin:     0;
  padding:    10px 16px 6px;
  font-size:  12px;
  color:      #6b7280;
  line-height: 1.5;
}
.jalpi-paste-modal__hint kbd {
  background:    #f3f4f6;
  border:        1px solid #d1d5db;
  border-radius: 3px;
  padding:       1px 5px;
  font-size:     11px;
  font-family:   monospace;
}

.jalpi-paste-modal__area {
  display:    block;
  width:      100%;
  box-sizing: border-box;
  margin:     6px 0 0;
  padding:    10px 16px;
  border:     none;
  border-top: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
  font-size:  11px;
  font-family: monospace;
  color:      #374151;
  resize:     vertical;
  outline:    none;
  min-height: 110px;
}
.jalpi-paste-modal__area:focus { background: #fafafa; }

.jalpi-paste-modal__actions {
  display:         flex;
  justify-content: flex-end;
  gap:             8px;
  padding:         12px 16px;
}

.jalpi-paste-modal__cancel {
  background: #f3f4f6;
  border:     none;
  border-radius: 7px;
  padding:    7px 16px;
  font-size:  13px;
  font-weight: 500;
  cursor:     pointer;
  color:      #374151;
}
.jalpi-paste-modal__cancel:hover { background: #e5e7eb; }

.jalpi-paste-modal__apply {
  background:    var(--jalpi-accent, #6366f1);
  border:        none;
  border-radius: 7px;
  padding:       7px 18px;
  font-size:     13px;
  font-weight:   600;
  cursor:        pointer;
  color:         #ffffff;
}
.jalpi-paste-modal__apply:hover   { opacity: 0.88; }
.jalpi-paste-modal__apply:disabled { opacity: 0.4; cursor: not-allowed; }

/* Clean neutral dot grid */
.jalpi-canvas-scroll {
  flex:             1;
  overflow-x:       hidden;
  overflow-y:       auto;
  padding:          52px 40px;
  display:          flex;
  justify-content:  center;
  background-color: #eef0f5;
  background-image: radial-gradient(rgba(0,0,0,0.07) 1px, transparent 1px);
  background-size:  22px 22px;
  position:         relative;
}

/* Subtle radial glow */
.jalpi-canvas-scroll::before {
  content:  '';
  position: absolute;
  inset:    0;
  background: radial-gradient(ellipse 60% 45% at 50% 36%,
    rgba(0,0,0,0.02) 0%,
    transparent 65%);
  pointer-events: none;
}

.jalpi-canvas {
  background:    #ffffff;
  min-height:    800px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.05),
    0 2px 8px rgba(15,23,42,0.08),
    0 20px 70px rgba(0,0,0,0.06),
    0 40px 100px rgba(15,23,42,0.12);
  transition:    width 0.3s ease, transform 0.2s ease;
  position:      relative;
  transform-origin: top center;
  border-radius: 3px;
  align-self:    flex-start;
  overflow-x:    hidden;

  /* Container-query context for the canvas.
     Fluid type written as clamp(…, Nvw, …) resolves `vw` against the BROWSER
     window, not this panel — so on a ~1000px canvas a heading sized for a
     1440px viewport rendered far too large and wrapped mid-word ("SHOO / T").
     CanvasNode converts those `vw` units to `cqw` at render time so they
     resolve against this element instead, matching the published page. */
  container-type: inline-size;
  container-name: jalpicanvas;
}

/* =========================================================
   Section grouping
   ========================================================= */

.jalpi-section-group {
  position:   relative;
  width:      100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* =========================================================
   Canvas Nodes
   ========================================================= */

.jalpi-canvas-node {
  position:       relative;
  outline:        1px solid transparent;
  outline-offset: 0px;
  transition:     outline-color 0.1s;
  min-width:      0;
  max-width:      100%;
  box-sizing:     border-box;
}

/* Sections must always fill the full canvas width */
.jalpi-canvas-node--section {
  width:         100%;
  overflow-x:    hidden;
  /* Thin top line = the only idle-state indicator (it's a section boundary, not a CSS border) */
  border-top:    4px solid rgba(139,92,246,0.5);
  /* Side padding = editor-only gutter so containers appear narrower than sections,
     making the Section → Container hierarchy visually obvious. This wrapper does
     not exist in the PHP frontend output so real page layout is unaffected. */
  padding:       4px 10px;
  box-sizing:    border-box;
  transition:    border-top-color 0.15s, outline-color 0.15s;
}

/* ── Structural node hover/select: color-coded by level ──────────────────── */

/* Section: violet */
.jalpi-canvas-node--section.is-hovered  { border-top-color: rgba(139,92,246,0.75); outline-color: rgba(139,92,246,0.25); }
.jalpi-canvas-node--section.is-selected {
  border-top-color: #8b5cf6;
  outline:          2px solid rgba(139,92,246,0.6);
  outline-offset:   -2px;
}

/* Container: blue */
.jalpi-canvas-node--container.is-hovered  { outline-color: rgba(59,130,246,0.7); }
.jalpi-canvas-node--container.is-selected { outline: 1px solid #3b82f6; outline-offset: -1px; }

/* Column: emerald — handled in column block below */

/* Elements: amber */
.jalpi-canvas-node:not(.jalpi-canvas-node--section):not(.jalpi-canvas-node--container):not(.jalpi-canvas-node--column).is-hovered  { outline-color: rgba(245,158,11,0.5); }
.jalpi-canvas-node:not(.jalpi-canvas-node--section):not(.jalpi-canvas-node--container):not(.jalpi-canvas-node--column).is-selected { outline-color: #f59e0b; }

/* ─── Drag & Drop ──────────────────────────────────────────────────────────── */

/* Source node dims while being dragged */
.jalpi-canvas-node.jalpi-dnd-dragging { opacity: 0.35; cursor: grabbing !important; }

/* Grab cursor on hover/select when not locked */
.jalpi-canvas-node:not(.is-locked):hover { cursor: grab; }

/* Blue insert-line ABOVE the node */
.jalpi-canvas-node.jalpi-dnd-before {
  outline-color: transparent !important;
}
.jalpi-canvas-node.jalpi-dnd-before::before {
  content:        '';
  position:       absolute;
  top:            -2px;
  left:           0;
  right:          0;
  height:         3px;
  background:     #2563eb;
  border-radius:  3px;
  z-index:        9999;
  pointer-events: none;
}
.jalpi-canvas-node.jalpi-dnd-before::after {
  content:        '';
  position:       absolute;
  top:            -5px;
  left:           -1px;
  width:          8px;
  height:         8px;
  border:         2px solid #2563eb;
  border-radius:  50%;
  background:     #fff;
  z-index:        9999;
  pointer-events: none;
}

/* Blue insert-line BELOW the node */
.jalpi-canvas-node.jalpi-dnd-after {
  outline-color: transparent !important;
}
.jalpi-canvas-node.jalpi-dnd-after::after {
  content:        '';
  position:       absolute;
  bottom:         -2px;
  left:           0;
  right:          0;
  height:         3px;
  background:     #2563eb;
  border-radius:  3px;
  z-index:        9999;
  pointer-events: none;
}

/* Blue highlight for "drop inside" an empty container */
.jalpi-canvas-node.jalpi-dnd-inside {
  outline:        2px dashed #2563eb !important;
  outline-offset: 2px;
  background:     rgba(37,99,235,0.05) !important;
}

/* ─────────────────────────────────────────────────────────────────────────── */

/* Reset browser default margins on heading/text tags inside canvas so they
   don't bleed outside the selection outline and cause visual overlap */
.jalpi-canvas-node--heading h1,
.jalpi-canvas-node--heading h2,
.jalpi-canvas-node--heading h3,
.jalpi-canvas-node--heading h4,
.jalpi-canvas-node--heading h5,
.jalpi-canvas-node--heading h6 {
  margin: 0;
  padding: 0;
}
.jalpi-canvas-node--heading { padding: 6px 0; }
.jalpi-canvas-node--text    { padding: 4px 0; }

/* Heading empty placeholder (Elementor style) */
.jalpi-heading-placeholder {
  display:       block;
  width:         100%;
  box-sizing:    border-box;
  color:         #93c5fd;
  border:        1.5px solid #f0abfc;
  border-radius: 3px;
  padding:       8px 12px;
  font-size:     inherit;
  font-weight:   inherit;
  font-family:   inherit;
  background:    transparent;
  pointer-events: none;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

/* Hidden-on-device state — dim the element in the editor */
.jalpi-canvas-node.is-device-hidden { opacity: 0.35; }
.jalpi-canvas-node.is-device-hidden::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(0,0,0,0.05) 4px,
    rgba(0,0,0,0.05) 8px
  );
  pointer-events: none;
  z-index: 0;
}

/* Hidden-device badge (overlaid label) */
.jalpi-device-hidden-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.80);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  text-transform: capitalize;
}

/* Responsive hint / notice in Advanced tab */
.jalpi-advanced-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--jalpi-text-muted);
  background: var(--jalpi-surface-2);
  border-radius: var(--jalpi-radius);
  padding: 8px 10px;
  margin: 8px 0 4px;
}

.jalpi-props-notice {
  font-size: 11.5px;
  color: var(--jalpi-text-muted);
  background: rgba(0,0,0,0.04);
  border-left: 2px solid var(--jalpi-accent);
  border-radius: 0 var(--jalpi-radius) var(--jalpi-radius) 0;
  padding: 6px 10px;
  margin-bottom: 10px;
}
.jalpi-props-notice strong { color: var(--jalpi-accent); }

.jalpi-section-inner {
  position:   relative;
  width:      100%;
  box-sizing: border-box;
}

/* Container inner — inline JS styles add layout mode (flex/grid/block).
   CSS provides the box-model floor so nested content cannot widen the parent. */
.jalpi-container-inner {
  min-width:     0;
  max-width:     100%;
  box-sizing:    border-box;
  overflow-wrap: break-word;
  word-break:    break-word;
}

/* Boxed-container width badge — always visible so users can see the
   max-width constraint even when the canvas is narrower than the set value */
.jalpi-container-inner[data-boxed-label]::after {
  content:          attr(data-boxed-label);
  position:         absolute;
  bottom:           4px;
  right:            4px;
  background:       rgba(59,130,246,0.10);
  border:           1px solid rgba(59,130,246,0.25);
  color:            rgba(59,130,246,0.85);
  font-size:        10px;
  font-family:      monospace;
  padding:          2px 6px;
  border-radius:    4px;
  pointer-events:   none;
  z-index:          100;
  line-height:      1.4;
  white-space:      nowrap;
}

/* Quick actions inside section */
.jalpi-section__quick-actions {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             8px;
  padding:         10px 16px;
  opacity:         0;
  transition:      opacity 0.15s;
  flex-wrap:       wrap;
}

.jalpi-canvas-node--section.is-selected .jalpi-section__quick-actions,
.jalpi-canvas-node--section:hover .jalpi-section__quick-actions { opacity: 1; }

.jalpi-section__quick-btn {
  background:    transparent;
  border:        1px dashed rgba(var(--jalpi-accent-rgb), 0.35);
  border-radius: var(--jalpi-radius);
  color:         rgba(var(--jalpi-accent-rgb), 0.65);
  padding:       6px 18px;
  cursor:        pointer;
  font-size:     12px;
  font-weight:   500;
  transition:    all 0.15s;
  white-space:   nowrap;
  font-family:   var(--jalpi-font);
}

.jalpi-section__quick-btn:hover {
  border-color: var(--jalpi-accent);
  color:        var(--jalpi-accent);
  background:   rgba(var(--jalpi-accent-rgb), 0.06);
}

.jalpi-container__add-row {
  display:         flex;
  justify-content: center;
  padding:         8px;
  opacity:         0;
  transition:      opacity 0.15s;
}

.jalpi-canvas-node--container.is-selected .jalpi-container__add-row,
.jalpi-canvas-node--container:hover .jalpi-container__add-row { opacity: 1; }

/* Container: always-visible blue dashed outline — marks the container's bounds */
.jalpi-canvas-node--container {
  outline:        1px dashed rgba(59,130,246,0.35);
  outline-offset: -1px;
  transition:     outline-color 0.15s;
}

/* Block-mode container empty state */
.jalpi-container__empty {
  display:         flex;
  align-items:     center;
  justify-content: center;
  min-height:      80px;
  width:           100%;
}

.jalpi-container__empty-btn {
  position:  static;
  transform: none;
  opacity:   1 !important;
}

/* ── Column canvas styles ── */
.jalpi-canvas-node--column {
  position:       relative;
  min-height:     100px;
  min-width:      0;
  outline:        1px dashed rgba(16,185,129,0.28);
  outline-offset: -1px;
  transition:     outline-color 0.15s;
}

.jalpi-canvas-node--column.is-hovered:not(.is-selected) {
  outline: 1px dashed rgba(16,185,129,0.65);
}

.jalpi-canvas-node--column.is-selected {
  outline: 2px solid #10b981;
}

.jalpi-column-inner {
  min-height: 100px;
  min-width:  0;
  position:   relative;
}

/* Centered "+" button inside an empty column — matches Elementor-style UX */
.jalpi-column__add-btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           28px;
  height:          28px;
  border-radius:   50%;
  border:          1.5px solid rgba(0,0,0,0.20);
  background:      transparent;
  color:           rgba(0,0,0,0.25);
  font-size:       18px;
  line-height:     1;
  cursor:          pointer;
  position:        absolute;
  top:             50%;
  left:            50%;
  transform:       translate(-50%, -50%);
  transition:      all 0.15s;
  font-family:     var(--jalpi-font);
  padding:         0;
  opacity:         0;
  transition:      opacity 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
}

.jalpi-canvas-node--column:hover .jalpi-column__add-btn,
.jalpi-canvas-node--column.is-selected .jalpi-column__add-btn { opacity: 1; }

.jalpi-column__add-btn:hover {
  background:   rgba(0,0,0,0.05);
  border-color: var(--jalpi-accent);
  color:        var(--jalpi-accent);
  transform:    translate(-50%, -50%) scale(1.1);
}

/* ── Node type labels ────────────────────────────────────────── */
/* Small colored pill in top-left corner — visible on hover/select */
.jalpi-node-label {
  position:       absolute;
  top:            0;
  left:           0;
  z-index:        200;
  display:        none;
  align-items:    center;
  gap:            4px;
  padding:        2px 7px;
  font-size:      9px;
  font-weight:    700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height:    1.6;
  border-radius:  0 0 4px 0;
  user-select:    none;
  pointer-events: none;
  white-space:    nowrap;
  font-family:    var(--jalpi-font);
}

.jalpi-canvas-node.is-hovered > .jalpi-node-label,
.jalpi-canvas-node.is-selected > .jalpi-node-label { display: flex; }

/* ── Section label: compact pill, always visible so users know the type instantly ── */
.jalpi-canvas-node--section   > .jalpi-node-label { background: #8b5cf6; color: #fff; display: flex; opacity: 0.55; }
/* ── Container label: compact pill, always visible ── */
.jalpi-canvas-node--container > .jalpi-node-label { background: #3b82f6; color: #fff; display: flex; opacity: 0.55; }
.jalpi-canvas-node--column    > .jalpi-node-label { background: #10b981; color: #fff; }

/* Labels reach full opacity on hover/select so users always know which type is active */
.jalpi-canvas-node--section.is-hovered   > .jalpi-node-label,
.jalpi-canvas-node--section.is-selected  > .jalpi-node-label,
.jalpi-canvas-node--container.is-hovered  > .jalpi-node-label,
.jalpi-canvas-node--container.is-selected > .jalpi-node-label { opacity: 1; }

/* Element nodes: amber label */
.jalpi-canvas-node:not(.jalpi-canvas-node--section):not(.jalpi-canvas-node--container):not(.jalpi-canvas-node--column) > .jalpi-node-label {
  background: #f59e0b;
  color:      #fff;
}

/* Empty section needs clickable height */
.jalpi-section__empty {
  min-height:    150px;
  border:        1px dashed rgba(139,92,246,0.2);
  border-radius: 4px;
  margin:        8px;
}

/* ── Empty drop zone (3-button) ─────────────────────────────── */
.jalpi-dropzone-empty {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             10px;
  padding:         24px 16px;
  width:           100%;
  box-sizing:      border-box;
}

.jalpi-dropzone-empty__btns {
  display:     flex;
  align-items: center;
  gap:         10px;
}

.jalpi-dropzone-btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           40px;
  height:          40px;
  border-radius:   50%;
  border:          none;
  cursor:          pointer;
  transition:      transform 0.15s, box-shadow 0.15s;
  flex-shrink:     0;
}

.jalpi-dropzone-btn:hover { transform: scale(1.08); }

.jalpi-dropzone-btn--add {
  background: #f0f0f0;
  color:      #555555;
  font-size:  22px;
  line-height: 1;
  font-weight: 300;
}
.jalpi-dropzone-btn--add:hover { background: #e4e4e4; }

.jalpi-dropzone-btn--tpl {
  background: #f0f0f0;
  color:      #555555;
}
.jalpi-dropzone-btn--tpl:hover { background: #e4e4e4; }

.jalpi-dropzone-btn--ai {
  background: linear-gradient(135deg, #e879f9 0%, #c084fc 50%, #818cf8 100%);
  color:      #ffffff;
  box-shadow: 0 2px 10px rgba(200,100,250,0.40);
}
.jalpi-dropzone-btn--ai:hover {
  box-shadow: 0 4px 16px rgba(200,100,250,0.55);
}

.jalpi-dropzone-empty__hint {
  font-size:   12px;
  color:       #9ca3af;
  font-style:  italic;
  user-select: none;
}
.jalpi-dropzone-empty__hint em {
  font-style: normal;
  font-weight: 600;
  color:       #6b7280;
}

.jalpi-column__add {
  display:         flex;
  justify-content: center;
  padding:         6px;
  opacity:         0;
  transition:      opacity 0.15s;
}

.jalpi-canvas-node--column.is-selected .jalpi-column__add,
.jalpi-canvas-node--column:hover .jalpi-column__add { opacity: 1; }

.jalpi-add-element-btn {
  background:    transparent;
  border:        1px dashed #d1d5db;
  border-radius: var(--jalpi-radius);
  color:         #9ca3af;
  padding:       6px 20px;
  cursor:        pointer;
  font-size:     12px;
  font-weight:   500;
  transition:    all 0.15s;
  font-family:   var(--jalpi-font);
}

.jalpi-add-element-btn:hover {
  border-color: #6b7280;
  color:        #374151;
  background:   rgba(0,0,0,0.03);
}

/* =========================================================
   Section Action Bar — dark-glass pill (contrasts on light canvas)
   ========================================================= */

.jalpi-section-action-bar {
  position:        relative;
  height:          36px;
  display:         flex;
  align-items:     center;
  justify-content: center;
}

.jalpi-section-action-bar::before {
  content:    '';
  position:   absolute;
  left:       40px;
  right:      40px;
  top:        50%;
  height:     1px;
  background: rgba(0,0,0,0.07);
  transition: background 0.25s;
  pointer-events: none;
}

.jalpi-section-group:hover .jalpi-section-action-bar::before {
  background: rgba(var(--jalpi-accent-rgb), 0.3);
}

/* Light pill */
.jalpi-sab-actions {
  position:      relative;
  z-index:       1;
  display:       flex;
  align-items:   center;
  gap:           1px;
  background:    #ffffff;
  border:        1px solid #e5e7eb;
  border-radius: var(--jalpi-radius-xl);
  padding:       3px 4px;
  box-shadow:    0 2px 10px rgba(15,23,42,0.10), 0 1px 3px rgba(15,23,42,0.06);
  transition:    border-color 0.2s, box-shadow 0.2s;
}

.jalpi-section-group:hover .jalpi-sab-actions {
  border-color: rgba(var(--jalpi-accent-rgb), 0.35);
  box-shadow:   0 3px 14px rgba(15,23,42,0.12), 0 0 0 1px rgba(var(--jalpi-accent-rgb), 0.10);
}

.jalpi-sab-btn {
  display:       flex;
  align-items:   center;
  padding:       5px 6px;
  background:    transparent;
  border:        none;
  color:         #9ca3af;
  cursor:        pointer;
  border-radius: 14px;
  transition:    background 0.15s, color 0.15s;
  font-family:   var(--jalpi-font);
  white-space:   nowrap;
  overflow:      hidden;
}

.jalpi-sab-btn:hover,
.jalpi-sab-btn.is-active {
  background: rgba(var(--jalpi-accent-rgb), 0.18);
  color:      #888888;
}

.jalpi-sab-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           14px;
  height:          14px;
  flex-shrink:     0;
}

.jalpi-sab-label {
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.03em;
  max-width:      0;
  overflow:       hidden;
  opacity:        0;
  transition:     max-width 0.22s ease, opacity 0.18s, padding-left 0.22s;
  padding-left:   0;
  text-transform: uppercase;
}

.jalpi-section-group:hover .jalpi-sab-label {
  max-width:    64px;
  opacity:      1;
  padding-left: 5px;
}

.jalpi-sab-sep {
  width:         1px;
  height:        14px;
  background:    #e5e7eb;
  flex-shrink:   0;
  margin:        0 1px;
  border-radius: 1px;
}

/* Picker popup */
.jalpi-sab-picker-wrap { position: relative; }

.jalpi-sab-picker {
  position:  absolute;
  bottom:    calc(100% + 10px);
  left:      50%;
  transform: translateX(-50%);
  z-index:   2000;
  min-width: 340px;
  filter:    drop-shadow(0 12px 32px rgba(15,23,42,0.22));
  animation: jalpi-picker-in 0.18s ease;
}

@keyframes jalpi-picker-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.jalpi-sab-rule        { display: none; }
.jalpi-canvas__add-section { display: none; }

/* ── Empty canvas ──────────────────────────────────────────────────────────── */

.jalpi-canvas__empty {
  display:         flex;
  align-items:     center;
  justify-content: center;
  min-height:      100%;
  padding:         56px 32px;
  animation:       jalpi-empty-in 0.36s ease both;
}

@keyframes jalpi-empty-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.jalpi-canvas__empty-inner {
  text-align: center;
  max-width:  440px;
  margin:     0 auto;
}

.jalpi-canvas__empty-illo {
  display:       flex;
  justify-content: center;
  margin-bottom: 28px;
  filter:        drop-shadow(0 12px 28px rgba(0,0,0,0.07));
}

.jalpi-canvas__empty-title {
  font-size:   24px;
  font-weight: 800;
  color:       #111827;
  margin:      0 0 10px;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.jalpi-canvas__empty-body {
  font-size:   14px;
  line-height: 1.65;
  color:       #6b7280;
  margin:      0 0 28px;
}

.jalpi-canvas__empty-actions {
  display:         flex;
  align-items:     center;
  gap:             10px;
  justify-content: center;
  flex-wrap:       wrap;
}

/* Primary empty-canvas action button — solid accent */
.jalpi-empty-btn {
  display:       inline-flex;
  align-items:   center;
  gap:           7px;
  padding:       10px 20px;
  background:    var(--jalpi-accent);
  border:        1.5px solid transparent;
  border-radius: 9px;
  cursor:        pointer;
  font-size:     13px;
  font-weight:   700;
  color:         #ffffff;
  font-family:   var(--jalpi-font);
  white-space:   nowrap;
  box-shadow:    0 2px 14px rgba(var(--jalpi-accent-rgb), 0.35);
  transition:    all 0.16s;
  letter-spacing: 0.01em;
}

.jalpi-empty-btn:hover,
.jalpi-empty-btn.is-active {
  background: color-mix(in srgb, var(--jalpi-accent) 85%, #000);
  box-shadow: 0 4px 20px rgba(var(--jalpi-accent-rgb), 0.45);
}

/* Outline variant — Import Template */
.jalpi-empty-btn--outline {
  background: #ffffff;
  border-color: #d1d5db;
  color:        #374151;
  box-shadow:   0 1px 4px rgba(15,23,42,0.06);
}

.jalpi-empty-btn--outline:hover {
  border-color: rgba(var(--jalpi-accent-rgb), 0.45);
  color:        var(--jalpi-accent);
  background:   rgba(var(--jalpi-accent-rgb), 0.04);
  box-shadow:   0 2px 10px rgba(var(--jalpi-accent-rgb), 0.12);
}

/* Inline editing */
.jalpi-inline-edit {
  outline:        2px solid #1a1a1a;
  outline-offset: 2px;
  min-height:     1em;
  cursor:         text;
  box-shadow:     0 0 0 4px rgba(0,0,0,0.06);
  display:        block;
  width:          100%;
  box-sizing:     border-box;
  margin:         0 !important;
}
.jalpi-inline-edit:empty::before {
  content:        attr(data-placeholder);
  color:          #93c5fd;
  pointer-events: none;
}

/* Heading native-input editor — avoids all contentEditable duplication quirks */
.jalpi-heading-input {
  display:      block;
  width:        100%;
  box-sizing:   border-box;
  margin:       0;
  padding:      2px 0;
  background:   transparent;
  border:       none;
  border-bottom: 2px solid #1a1a1a;
  outline:      none;
  font:         inherit;           /* inherit fontSize, fontWeight, fontFamily */
  color:        inherit;
  line-height:  inherit;
  letter-spacing: inherit;
  text-align:   inherit;
  cursor:       text;
}
.jalpi-heading-input::placeholder { color: #93c5fd; }

/* ═══════════════════════════════════════════════════════════════════
   Rich Text Editor
   ═══════════════════════════════════════════════════════════════════ */

.jalpi-rich-editor {
  border:        1px solid #d1d5db;
  border-radius: 4px;
  background:    #fff;
  overflow:      hidden;
  box-shadow:    0 2px 8px rgba(0,0,0,0.08);
}

/* Toolbar wrapper */
.jalpi-rte-toolbar {
  background:  #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

/* Each toolbar row */
.jalpi-rte-row {
  display:     flex;
  align-items: center;
  flex-wrap:   wrap;
  padding:     3px 4px;
  gap:         1px;
}

.jalpi-rte-row--2 {
  border-top: 1px solid #e5e7eb;
}

/* Toolbar button */
.jalpi-rte-btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           28px;
  height:          28px;
  border:          none;
  background:      transparent;
  border-radius:   3px;
  cursor:          pointer;
  font-size:       13px;
  color:           #374151;
  transition:      background 0.12s, color 0.12s;
  flex-shrink:     0;
  position:        relative;
}
.jalpi-rte-btn:hover { background: #e5e7eb; }
.jalpi-rte-btn:active { background: #d1d5db; }

/* Format dropdown */
.jalpi-rte-format {
  height:        28px;
  padding:       0 4px;
  border:        1px solid #d1d5db;
  border-radius: 3px;
  background:    #fff;
  font-size:     12px;
  color:         #374151;
  cursor:        pointer;
  margin-right:  2px;
}

/* Separator */
.jalpi-rte-sep {
  width:        1px;
  height:       18px;
  background:   #d1d5db;
  margin:       0 3px;
  flex-shrink:  0;
  border-radius: 1px;
}

/* Visual / Text tabs (right-aligned) */
.jalpi-rte-tabs {
  margin-left:  auto;
  display:      flex;
  border:       1px solid #d1d5db;
  border-radius: 3px;
  overflow:     hidden;
}
.jalpi-rte-tab {
  height:     26px;
  padding:    0 10px;
  border:     none;
  background: transparent;
  font-size:  12px;
  color:      #6b7280;
  cursor:     pointer;
  transition: background 0.12s, color 0.12s;
}
.jalpi-rte-tab + .jalpi-rte-tab { border-left: 1px solid #d1d5db; }
.jalpi-rte-tab.is-active {
  background: #1a1a1a;
  color:      #fff;
}

/* Text color label (wraps a hidden <input type="color">) */
.jalpi-rte-color-lbl { cursor: pointer; }
.jalpi-rte-color-a   { font-weight: 700; border-bottom: 2px solid #1a1a1a; padding-bottom: 1px; }
.jalpi-rte-color-input {
  position: absolute;
  opacity:  0;
  width:    0;
  height:   0;
  pointer-events: none;
}
.jalpi-rte-color-lbl:hover .jalpi-rte-color-input { pointer-events: auto; }

/* Content (editable) area */
.jalpi-rte-content {
  min-height:  120px;
  padding:     12px 14px;
  outline:     none;
  font-size:   15px;
  line-height: 1.6;
  color:       #1f2937;
}
.jalpi-rte-content:focus { background: #fefefe; }

/* HTML source textarea */
.jalpi-rte-source {
  display:    block;
  width:      100%;
  min-height: 140px;
  padding:    10px 12px;
  border:     none;
  outline:    none;
  resize:     vertical;
  font-family: 'Courier New', monospace;
  font-size:  13px;
  line-height: 1.5;
  color:      #374151;
  background: #f9fafb;
  box-sizing: border-box;
}

/* blockquote inside the editor */
.jalpi-rte-content blockquote {
  border-left: 3px solid #1a1a1a;
  margin:      8px 0;
  padding:     4px 12px;
  color:       #6b7280;
  font-style:  italic;
}

/* Canvas-only placeholder shown when text block has no content yet */
.jalpi-text-placeholder {
  padding: 10px 0;
}

.jalpi-text-placeholder__inner {
  display:       block;
  padding:       12px 16px;
  border:        1.5px dashed #d1d5db;
  border-radius: 6px;
  color:         #9ca3af;
  font-size:     13px;
  font-style:    italic;
  text-align:    center;
  pointer-events: none;
  background:    #fafafa;
}

/* Image placeholder */
.jalpi-image-placeholder {
  border:          1px dashed rgba(0,0,0,0.10);
  display:         flex;
  align-items:     center;
  justify-content: center;
  min-height:      120px;
  color:           #94a3b8;
  font-size:       13px;
  background:      rgba(0,0,0,0.02);
  gap:             8px;
}

/* Spacer */
.jalpi-spacer-preview {
  background: repeating-linear-gradient(
    -45deg,
    rgba(var(--jalpi-accent-rgb), 0.05),
    rgba(var(--jalpi-accent-rgb), 0.05) 4px,
    transparent 4px,
    transparent 16px
  );
  border-top:    1px dashed rgba(var(--jalpi-accent-rgb), 0.2);
  border-bottom: 1px dashed rgba(var(--jalpi-accent-rgb), 0.2);
}

.jalpi-spacer-label {
  background:    rgba(var(--jalpi-accent-rgb), 0.1);
  color:         var(--jalpi-accent);
  border:        1px solid rgba(var(--jalpi-accent-rgb), 0.25);
  border-radius: 4px;
  padding:       2px 8px;
  font-size:     11px;
  pointer-events: none;
}

.jalpi-btn-preview {
  display:          inline-flex;
  align-items:      center;
  gap:              6px;
  cursor:           default;
  text-decoration:  none;
  /* Neutralize any WP admin resets so inline styles win */
  background-color: transparent;
  color:            inherit;
  border:           none;
}
.jalpi-btn-preview--info    { background: #0ea5e9 !important; }
.jalpi-btn-preview--success { background: #22c55e !important; }
.jalpi-btn-preview--warning { background: #f59e0b !important; color: #1a1a1a !important; }
.jalpi-btn-preview--danger  { background: #ef4444 !important; }

.jalpi-btn-icon { display: inline-flex; align-items: center; width: 1em; height: 1em; }
.jalpi-btn-icon svg { width: 100%; height: 100%; }

/* =========================================================
   Floating Toolbar — light
   ========================================================= */

.jalpi-floating-toolbar {
  position:      absolute;
  top:           -46px;
  left:          50%;
  transform:     translateX(-50%);
  display:       flex;
  align-items:   center;
  /* clean white bar like the reference */
  background:    #ffffff;
  border:        1px solid #eceef1;
  border-radius: 12px;
  box-shadow:    0 10px 30px rgba(15,23,42,0.14), 0 2px 8px rgba(15,23,42,0.08);
  padding:       5px;
  gap:           3px;
  z-index:       1000;
  white-space:   nowrap;
}
/* little pointer under the bar */
.jalpi-floating-toolbar::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -5px;
  width: 10px; height: 10px;
  transform: translateX(-50%) rotate(45deg);
  background: #ffffff;
  border-right: 1px solid #eceef1;
  border-bottom: 1px solid #eceef1;
  border-radius: 0 0 2px 0;
}

/* Structural nodes (section/container/column) and top-of-canvas elements render
   the toolbar just INSIDE their top edge so it's always visible and never lands
   in the gap over the previous element. No pointer in this position. */
.jalpi-floating-toolbar.is-flipped {
  top: 8px;
}
.jalpi-floating-toolbar.is-flipped::after { display: none; }

.jalpi-floating-toolbar__btn {
  background:      transparent;
  border:          none;
  color:           #4b5563;
  cursor:          pointer;
  width:           30px;
  height:          30px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  border-radius:   8px;
  font-size:       13px;
  transition:      all 0.12s;
  font-family:     var(--jalpi-font);
}

.jalpi-floating-toolbar__btn:hover {
  background: #f3f4f6;
  color:      #111827;
}

.jalpi-floating-toolbar__btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.jalpi-floating-toolbar__btn:disabled:hover { background: transparent; }

.jalpi-floating-toolbar__handle { cursor: grab; color: #9ca3af; }
.jalpi-floating-toolbar__handle:active { cursor: grabbing; }

.jalpi-floating-toolbar__btn--danger:hover {
  background: rgba(239,68,68,0.08);
  color:      #dc2626;
}

.jalpi-floating-toolbar__sep {
  width:         1px;
  height:        18px;
  background:    #e5e7eb;
  margin:        0 2px;
  flex-shrink:   0;
  border-radius: 1px;
}

/* kebab overflow menu */
.jalpi-floating-toolbar__menu-wrap { position: relative; display: flex; }
.jalpi-floating-toolbar__menu {
  position:      absolute;
  top:           calc(100% + 8px);
  right:         0;
  min-width:     168px;
  background:    #ffffff;
  border:        1px solid #e5e7eb;
  border-radius: 9px;
  box-shadow:    0 10px 28px rgba(15,23,42,0.16);
  padding:       5px;
  z-index:       1001;
}
.jalpi-floating-toolbar__menu-item {
  display:       flex;
  align-items:   center;
  gap:           9px;
  width:         100%;
  background:    transparent;
  border:        none;
  cursor:        pointer;
  padding:       7px 10px;
  border-radius: 6px;
  font-size:     12.5px;
  font-weight:   500;
  color:         #374151;
  font-family:   var(--jalpi-font);
  text-align:    left;
}
.jalpi-floating-toolbar__menu-item:hover { background: #f3f4f6; }
.jalpi-floating-toolbar__menu-item svg { color: #6b7280; flex-shrink: 0; }
.jalpi-floating-toolbar__menu-item--danger { color: #dc2626; }
.jalpi-floating-toolbar__menu-item--danger svg { color: #dc2626; }
.jalpi-floating-toolbar__menu-item--danger:hover { background: rgba(239,68,68,0.08); }
.jalpi-floating-toolbar__menu-sep { height: 1px; background: #eef0f3; margin: 4px 2px; }

.jalpi-floating-toolbar__col-btn {
  width: 30px;
}

.jalpi-floating-toolbar__btn.is-active {
  background: rgba(var(--jalpi-accent-rgb), 0.25);
  color:      var(--jalpi-accent);
}

.jalpi-floating-toolbar__btn.is-active:hover {
  background: rgba(var(--jalpi-accent-rgb), 0.35);
  color:      var(--jalpi-accent);
}

/* =========================================================
   Block Picker
   ========================================================= */

.jalpi-block-picker {
  background:    var(--jalpi-surface);
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-lg);
  overflow:      hidden;
  box-shadow:    var(--jalpi-shadow-lg);
  width:         340px;
}

.jalpi-block-picker__search {
  display:       flex;
  align-items:   center;
  gap:           8px;
  padding:       10px 12px;
  border-bottom: 1px solid var(--jalpi-border);
  background:    var(--jalpi-surface-2);
}

.jalpi-block-picker__search-icon {
  color:       var(--jalpi-text-muted);
  flex-shrink: 0;
}

.jalpi-block-picker__search-input {
  flex:        1;
  background:  transparent;
  border:      none;
  color:       var(--jalpi-text);
  font-size:   13px;
  font-weight: 400;
  outline:     none;
  font-family: var(--jalpi-font);
  line-height: 1;
}

.jalpi-block-picker__search-input::placeholder { color: var(--jalpi-text-dim); }

.jalpi-block-picker__close {
  background:      transparent;
  border:          none;
  color:           var(--jalpi-text-muted);
  cursor:          pointer;
  width:           22px;
  height:          22px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  border-radius:   5px;
  transition:      all 0.1s;
  flex-shrink:     0;
}

.jalpi-block-picker__close:hover {
  background: var(--jalpi-surface-3);
  color:      var(--jalpi-text);
}

.jalpi-block-picker__cats {
  display:         flex;
  align-items:     center;
  gap:             2px;
  padding:         6px 10px;
  border-bottom:   1px solid var(--jalpi-border);
  overflow-x:      auto;
  scrollbar-width: none;
}

.jalpi-block-picker__cats::-webkit-scrollbar { display: none; }

.jalpi-block-picker__cat {
  padding:        3px 10px;
  border:         1px solid transparent;
  border-radius:  999px;
  background:     transparent;
  color:          var(--jalpi-text-muted);
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor:         pointer;
  transition:     all 0.15s;
  white-space:    nowrap;
  font-family:    var(--jalpi-font);
}

.jalpi-block-picker__cat:hover {
  color:        var(--jalpi-text);
  background:   var(--jalpi-surface-2);
  border-color: var(--jalpi-border-2);
}

.jalpi-block-picker__cat.is-active {
  color:        var(--jalpi-accent);
  background:   rgba(var(--jalpi-accent-rgb), 0.09);
  border-color: rgba(var(--jalpi-accent-rgb), 0.28);
}

.jalpi-block-picker__list {
  max-height:      300px;
  overflow-y:      auto;
  padding:         4px;
  scrollbar-width: thin;
  scrollbar-color: var(--jalpi-border-2) transparent;
}

.jalpi-block-picker__list::-webkit-scrollbar { width: 4px; }
.jalpi-block-picker__list::-webkit-scrollbar-track { background: transparent; }
.jalpi-block-picker__list::-webkit-scrollbar-thumb {
  background:    var(--jalpi-border-2);
  border-radius: 2px;
}

.jalpi-block-picker__empty {
  padding:    24px;
  text-align: center;
  color:      var(--jalpi-text-muted);
  font-size:  12px;
}

.jalpi-block-picker__item {
  display:       flex;
  align-items:   center;
  gap:           10px;
  padding:       7px 8px;
  background:    transparent;
  border:        1px solid transparent;
  border-radius: var(--jalpi-radius);
  cursor:        pointer;
  width:         100%;
  text-align:    left;
  transition:    all 0.12s;
  font-family:   var(--jalpi-font);
}

.jalpi-block-picker__item:hover,
.jalpi-block-picker__item.is-focused {
  background:   var(--jalpi-surface-2);
  border-color: var(--jalpi-border-2);
}

.jalpi-block-picker__item.is-focused {
  border-color: rgba(var(--jalpi-accent-rgb), 0.3);
  box-shadow:   0 0 0 1px rgba(var(--jalpi-accent-rgb), 0.08);
}

.jalpi-block-picker__icon-wrap {
  width:           34px;
  height:          34px;
  border-radius:   9px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
  background:      color-mix(in srgb, var(--block-color, #1a1a1a) 12%, transparent);
  border:          1px solid color-mix(in srgb, var(--block-color, #1a1a1a) 22%, transparent);
  transition:      all 0.15s;
}

.jalpi-block-picker__item:hover .jalpi-block-picker__icon-wrap,
.jalpi-block-picker__item.is-focused .jalpi-block-picker__icon-wrap {
  background: color-mix(in srgb, var(--block-color, #1a1a1a) 20%, transparent);
}

.jalpi-block-picker__icon {
  font-size:   15px;
  color:       var(--block-color, #1a1a1a);
  line-height: 1;
  font-weight: 700;
}

.jalpi-block-picker__meta {
  flex:           1;
  display:        flex;
  flex-direction: column;
  gap:            2px;
  min-width:      0;
}

.jalpi-block-picker__label {
  font-size:   12px;
  font-weight: 600;
  color:       var(--jalpi-text);
  line-height: 1.2;
}

.jalpi-block-picker__desc {
  font-size:     10px;
  color:         var(--jalpi-text-muted);
  line-height:   1.3;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.jalpi-block-picker__cat-badge {
  font-size:      9px;
  font-weight:    700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color:          var(--jalpi-text-muted);
  padding:        2px 6px;
  border-radius:  4px;
  background:     var(--jalpi-surface-3);
  border:         1px solid var(--jalpi-border);
  flex-shrink:    0;
}

/* =========================================================
   Properties Panel
   ========================================================= */

.jalpi-props-panel {
  display:        flex;
  flex-direction: column;
  height:         100%;
}

.jalpi-props-panel__tabs {
  display:       flex;
  flex-shrink:   0;
  background:    var(--jalpi-surface);
  border-bottom: 1px solid var(--jalpi-border);
  padding:       0;
}

.jalpi-props-panel__tab {
  flex:           1;
  padding:        10px 6px;
  background:     transparent;
  border:         none;
  color:          var(--jalpi-text-muted);
  cursor:         pointer;
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom:  2px solid transparent;
  transition:     all 0.15s;
  font-family:    var(--jalpi-font);
}

.jalpi-props-panel__tab:hover {
  color:      var(--jalpi-text);
  background: rgba(var(--jalpi-accent-rgb), 0.04);
}

.jalpi-props-panel__tab.is-active {
  color:         var(--jalpi-accent);
  border-bottom: 2px solid var(--jalpi-accent);
  background:    rgba(var(--jalpi-accent-rgb), 0.05);
}

.jalpi-props-panel__body {
  flex:       1;
  overflow-y: auto;
  background: var(--jalpi-surface-2);
}

.jalpi-props-panel__empty {
  padding:     36px 16px;
  color:       var(--jalpi-text-muted);
  font-size:   12px;
  text-align:  center;
  line-height: 1.8;
}

.jalpi-props-panel__empty p { margin: 0 0 16px; }

.jalpi-props-notice {
  margin:        0 0 10px;
  padding:       8px 12px;
  background:    rgba(var(--jalpi-accent-rgb), 0.07);
  border-left:   3px solid var(--jalpi-accent);
  border-radius: 0 var(--jalpi-radius-sm) var(--jalpi-radius-sm) 0;
  font-size:     11px;
  color:         var(--jalpi-accent);
  line-height:   1.5;
}

.jalpi-advanced-hint {
  display:        flex;
  align-items:    center;
  gap:            6px;
  padding:        8px 10px;
  margin-top:     4px;
  background:     var(--jalpi-surface-2);
  border:         1px solid var(--jalpi-border);
  border-radius:  var(--jalpi-radius-sm);
  font-size:      10px;
  color:          var(--jalpi-text-muted);
  line-height:    1.4;
}

.jalpi-advanced-hint svg { flex-shrink: 0; opacity: 0.6; }

/* Monospace textarea for code-like inputs (slideshow URLs, etc.) */
.jalpi-code-area {
  display:     block;
  width:       100%;
  min-height:  80px;
  padding:     10px 12px;
  background:  #1e1e2e;
  border:      1px solid #313244;
  border-radius: 6px;
  color:       #cdd6f4;
  font-family: 'Courier New', monospace;
  font-size:   12px;
  line-height: 1.65;
  resize:      vertical;
  outline:     none;
  box-sizing:  border-box;
  tab-size:    2;
}
.jalpi-code-area::placeholder { color: #45475a; white-space: pre; }
.jalpi-code-area:focus        { background: #181825; }

/* Prop groups */
.jalpi-props-section {
  padding:        10px;
  display:        flex;
  flex-direction: column;
  gap:            8px;
}

.jalpi-prop-group {
  background:    var(--jalpi-surface);
  border-radius: var(--jalpi-radius);
  border:        1px solid var(--jalpi-border);
  overflow:      hidden;
}

.jalpi-prop-group__label {
  display:        flex;
  align-items:    center;
  gap:            7px;
  padding:        7px 10px;
  background:     var(--jalpi-surface-2);
  font-size:      9px;
  font-weight:    800;
  color:          var(--jalpi-accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom:  1px solid var(--jalpi-border);
}

.jalpi-prop-group__label::before {
  content:       '';
  display:       block;
  width:         2px;
  height:        10px;
  background:    linear-gradient(180deg, var(--jalpi-accent), rgba(var(--jalpi-accent-rgb), 0.25));
  border-radius: 2px;
  flex-shrink:   0;
}

.jalpi-prop-group__body { padding: 8px 10px; }

.jalpi-prop-row {
  display:       flex;
  align-items:   center;
  gap:           8px;
  margin-bottom: 6px;
}

.jalpi-prop-row:last-child { margin-bottom: 0; }

.jalpi-prop-row__label {
  flex-shrink: 0;
  width:       76px;
  font-size:   11px;
  color:       var(--jalpi-text-muted);
  font-weight: 500;
}

.jalpi-prop-row__control { flex: 1; min-width: 0; }

/* Form controls — light-styled */
.jalpi-input,
.jalpi-select,
.jalpi-textarea {
  width:         100%;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  color:         var(--jalpi-text);
  font-size:     12px !important;
  padding:       0 8px;
  height:        30px;
  min-height:    30px !important;
  line-height:   1;
  outline:       none;
  transition:    all 0.15s;
  font-family:   var(--jalpi-font);
  box-sizing:    border-box;
}
.jalpi-textarea { height: auto; min-height: 56px; line-height: 1.5; }

.jalpi-input:focus,
.jalpi-select:focus,
.jalpi-textarea:focus {
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 0 3px rgba(var(--jalpi-accent-rgb), 0.1);
  background:   var(--jalpi-surface);
}

.jalpi-textarea {
  resize:      vertical;
  min-height:  64px;
  line-height: 1.5;
}

.jalpi-select { cursor: pointer; }

/* Color swatches */
.jalpi-color-swatches {
  display:               grid;
  grid-template-columns: repeat(6, 1fr);
  gap:                   4px;
}

.jalpi-color-swatch {
  width:        100%;
  aspect-ratio: 1;
  border:       2px solid transparent;
  border-radius: 5px;
  cursor:       pointer;
  transition:   all 0.12s;
}

.jalpi-color-swatch:hover {
  border-color: rgba(0,0,0,0.2);
  transform:    scale(1.12);
}

/* Align buttons */
.jalpi-align-btns { display: flex; gap: 3px; }

.jalpi-align-btn {
  background:      var(--jalpi-surface-2);
  border:          1px solid var(--jalpi-border-2);
  color:           var(--jalpi-text-muted);
  border-radius:   var(--jalpi-radius-sm);
  width:           30px;
  height:          26px;
  cursor:          pointer;
  font-size:       12px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  transition:      all 0.12s;
  font-family:     var(--jalpi-font);
}

.jalpi-align-btn:hover {
  color:        var(--jalpi-text);
  background:   var(--jalpi-surface-3);
  border-color: var(--jalpi-border-3);
}

.jalpi-align-btn.is-active {
  background:   var(--jalpi-accent);
  border-color: var(--jalpi-accent);
  color:        #fff;
  box-shadow:   0 2px 8px rgba(var(--jalpi-accent-rgb), 0.35);
}


/* Toggle */
.jalpi-toggle {
  position:      relative;
  width:         34px;
  height:        18px;
  background:    var(--jalpi-surface-3);
  border:        1px solid var(--jalpi-border-2);
  border-radius: 9px;
  cursor:        pointer;
  transition:    all 0.22s;
  flex-shrink:   0;
}

.jalpi-toggle.is-on {
  background:   var(--jalpi-accent);
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 10px rgba(var(--jalpi-accent-rgb), 0.3);
}

.jalpi-toggle__knob {
  position:      absolute;
  top:           2px;
  left:          2px;
  width:         12px;
  height:        12px;
  background:    #fff;
  border-radius: 50%;
  transition:    transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:    0 1px 3px rgba(0,0,0,0.2);
}

.jalpi-toggle.is-on .jalpi-toggle__knob { transform: translateX(16px); }

/* =========================================================
   Toast
   ========================================================= */

.jalpi-toast {
  position:       fixed;
  bottom:         28px;
  left:           50%;
  transform:      translateX(-50%);
  background:     #111827;
  color:          #f9fafb;
  border:         1px solid rgba(255,255,255,0.08);
  border-radius:  var(--jalpi-radius-xl);
  padding:        9px 20px;
  font-size:      13px;
  font-weight:    500;
  box-shadow:     0 4px 24px rgba(15,23,42,0.18), 0 1px 6px rgba(15,23,42,0.10);
  z-index:        9999;
  animation:      jalpi-toast-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

@keyframes jalpi-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.92); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1); }
}

/* =========================================================
   Error screen
   ========================================================= */

.jalpi-error-screen {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  height:          100vh;
  color:           var(--jalpi-text);
  background:      var(--jalpi-bg);
  gap:             12px;
  font-family:     var(--jalpi-font);
}

/* =========================================================
   Scrollbars
   ========================================================= */

.jalpi-editor__sidebar::-webkit-scrollbar,
.jalpi-editor__inspector::-webkit-scrollbar,
.jalpi-inspector-body::-webkit-scrollbar,
.jalpi-props-panel__body::-webkit-scrollbar,
.jalpi-layers__list::-webkit-scrollbar,
.jalpi-canvas-scroll::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.jalpi-editor__sidebar::-webkit-scrollbar-track,
.jalpi-editor__inspector::-webkit-scrollbar-track,
.jalpi-inspector-body::-webkit-scrollbar-track,
.jalpi-props-panel__body::-webkit-scrollbar-track,
.jalpi-layers__list::-webkit-scrollbar-track,
.jalpi-canvas-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.jalpi-editor__sidebar::-webkit-scrollbar-thumb,
.jalpi-editor__inspector::-webkit-scrollbar-thumb,
.jalpi-inspector-body::-webkit-scrollbar-thumb,
.jalpi-props-panel__body::-webkit-scrollbar-thumb,
.jalpi-layers__list::-webkit-scrollbar-thumb,
.jalpi-canvas-scroll::-webkit-scrollbar-thumb {
  background:    var(--jalpi-border-2);
  border-radius: 2px;
}

/* =========================================================
   Element Previews & Placeholders
   ========================================================= */

.jalpi-video-placeholder,
.jalpi-maps-placeholder,
.jalpi-html-placeholder {
  border:          1px dashed rgba(0,0,0,0.08);
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             8px;
  min-height:      140px;
  color:           #94a3b8;
  font-size:       13px;
  background:      rgba(0,0,0,0.015);
}

.jalpi-html-placeholder { min-height: 80px; }

.jalpi-video-placeholder__icon,
.jalpi-maps-placeholder__icon { font-size: 28px; opacity: 0.35; }

.jalpi-html-placeholder__icon {
  font-size:   18px;
  font-family: monospace;
  opacity:     0.45;
}

.jalpi-html-editor {
  width:         100%;
  min-height:    160px;
  padding:       10px;
  font-family:   var(--jalpi-mono);
  font-size:     12px;
  background:    #1e1b4b;
  color:         #bbbbbb;
  border:        2px solid var(--jalpi-accent);
  border-radius: var(--jalpi-radius-sm);
  resize:        vertical;
  outline:       none;
  display:       block;
  box-sizing:    border-box;
  line-height:   1.6;
}

.jalpi-icon-preview { padding: 12px; }

.jalpi-icon-picker {
  display:               grid;
  grid-template-columns: repeat(4, 1fr);
  gap:                   4px;
  padding:               4px 0;
}

.jalpi-icon-picker__item {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           100%;
  aspect-ratio:    1;
  background:      var(--jalpi-surface-2);
  border:          1px solid var(--jalpi-border);
  border-radius:   var(--jalpi-radius-sm);
  cursor:          pointer;
  color:           var(--jalpi-text-muted);
  transition:      all 0.12s;
}

.jalpi-icon-picker__item:hover {
  background:   rgba(var(--jalpi-accent-rgb), 0.08);
  border-color: rgba(var(--jalpi-accent-rgb), 0.28);
  color:        var(--jalpi-accent);
}

.jalpi-icon-picker__item.is-active {
  background:   var(--jalpi-accent);
  border-color: var(--jalpi-accent);
  color:        #fff;
  box-shadow:   0 2px 8px rgba(var(--jalpi-accent-rgb), 0.35);
}

.jalpi-icon-picker__item svg { width: 20px; height: 20px; }

.jalpi-shortcode-preview {
  padding:       10px 14px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border);
  border-radius: var(--jalpi-radius-sm);
}

.jalpi-shortcode-preview code {
  font-family: var(--jalpi-mono);
  font-size:   13px;
  color:       var(--jalpi-accent);
  word-break:  break-all;
}

.jalpi-logo-placeholder {
  border:          1px dashed rgba(0,0,0,0.08);
  display:         flex;
  align-items:     center;
  justify-content: center;
  min-height:      80px;
  color:           #94a3b8;
  font-size:       13px;
  background:      rgba(0,0,0,0.015);
}

/* =========================================================
   PropGroup — collapsible accordion
   ========================================================= */

.jalpi-prop-group {
  background:    var(--jalpi-surface);
  border-radius: var(--jalpi-radius);
  border:        1px solid var(--jalpi-border-2);
  overflow:      hidden;
  box-shadow:    0 1px 3px rgba(15,23,42,0.04);
}

.jalpi-prop-group__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  width:           100%;
  padding:         9px 12px;
  background:      var(--jalpi-surface-2);
  border:          none;
  border-bottom:   1px solid var(--jalpi-border);
  cursor:          pointer;
  font-family:     var(--jalpi-font);
  transition:      background 0.12s;
  gap:             6px;
}

.jalpi-prop-group__header:hover { background: var(--jalpi-surface-3); }

.jalpi-prop-group:not(.is-open) .jalpi-prop-group__header { border-bottom: none; }

.jalpi-prop-group__header-left {
  display:     flex;
  align-items: center;
  gap:         7px;
  flex:        1;
  min-width:   0;
}

.jalpi-prop-group__header-left::before {
  content:       '';
  display:       block;
  width:         2px;
  height:        10px;
  background:    linear-gradient(180deg, var(--jalpi-accent), rgba(var(--jalpi-accent-rgb), 0.2));
  border-radius: 2px;
  flex-shrink:   0;
}

.jalpi-prop-group__icon {
  display:     flex;
  align-items: center;
  color:       var(--jalpi-accent);
  opacity:     0.75;
  flex-shrink: 0;
}

.jalpi-prop-group__title {
  font-size:      10px;
  font-weight:    700;
  color:          var(--jalpi-accent);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

.jalpi-prop-group__chevron {
  color:       var(--jalpi-text-dim);
  flex-shrink: 0;
  transition:  transform 0.18s ease;
}

.jalpi-prop-group__chevron.is-open { transform: rotate(180deg); }

.jalpi-prop-group__body { padding: 12px; }

/* ── Typography compact grid ──────────────────────────────── */
.jalpi-typo-grid {
  display:       grid;
  grid-template-columns: 1fr 1fr;
  gap:           8px;
  margin-bottom: 9px;
}
.jalpi-typo-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.jalpi-typo-grid:last-child { margin-bottom: 0; }
.jalpi-typo-grid__cell { min-width: 0; }
.jalpi-typo-mini-label {
  display:        block;
  font-size:      10px;
  font-weight:    600;
  color:          var(--jalpi-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom:  4px;
}

/* ── Elementor-style color property row (label | globe | swatch) ────────── */
.jalpi-color-prop-row {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         7px 0;
  border-bottom:   1px solid var(--jalpi-border);
  margin-bottom:   4px;
}
.jalpi-color-prop-row__label {
  font-size:   12px;
  font-weight: 400;
  color:       var(--jalpi-text);
}
.jalpi-color-prop-row__right {
  display:     flex;
  align-items: center;
  gap:         4px;
}
.jalpi-color-prop-row__swatch-wrap {
  display:  block;
  position: relative;
  cursor:   pointer;
}
.jalpi-color-prop-row__swatch {
  display:       block;
  width:         26px;
  height:        26px;
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  background:    var(--jalpi-surface-2);
  transition:    border-color 0.12s;
}
.jalpi-color-prop-row__swatch-wrap:hover .jalpi-color-prop-row__swatch {
  border-color: var(--jalpi-accent);
}

/* ── Elementor-style 2-row slider (label+unit / slider+number) ─────────── */
.jalpi-slprop {
  display:        flex;
  flex-direction: column;
  gap:            6px;
  padding:        6px 0 8px;
  border-bottom:  1px solid var(--jalpi-border);
  margin-bottom:  4px;
}
.jalpi-slprop__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
}
.jalpi-slprop__label {
  display:     flex;
  align-items: center;
  gap:         5px;
  font-size:   12px;
  color:       var(--jalpi-text);
  font-weight: 400;
}
.jalpi-slprop__unit {
  font-size:     11px;
  font-weight:   500;
  color:         var(--jalpi-text-dim);
  background:    transparent;
  border:        none;
  cursor:        pointer;
  padding:       0 2px;
  appearance:    none;
  -webkit-appearance: none;
  /* show a small chevron via background */
  background-image:    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:   no-repeat;
  background-position: right 0 center;
  padding-right:       12px;
}
.jalpi-slprop__unit:focus { outline: none; }
.jalpi-slprop__body {
  display:     flex;
  align-items: center;
  gap:         6px;
}
.jalpi-slprop__track {
  flex:              1;
  appearance:        none;
  -webkit-appearance: none;
  height:            4px;
  border-radius:     2px;
  background:        linear-gradient(to right, var(--jalpi-accent) var(--pct, 0%), var(--jalpi-border-2) var(--pct, 0%));
  cursor:            pointer;
}
.jalpi-slprop__track::-webkit-slider-thumb {
  appearance:       none;
  -webkit-appearance: none;
  width:            14px;
  height:           14px;
  border-radius:    50%;
  background:       var(--jalpi-accent);
  border:           2px solid var(--jalpi-surface);
  box-shadow:       0 0 0 1px var(--jalpi-accent);
  cursor:           grab;
  transition:       transform 0.1s;
}
.jalpi-slprop__track::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.2); }
.jalpi-slprop__num {
  width:         52px;
  flex-shrink:   0;
  padding:       4px 6px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  font-size:     12px;
  color:         var(--jalpi-text);
  text-align:    center;
  font-family:   var(--jalpi-font);
}
.jalpi-slprop__num:focus {
  outline:      none;
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 0 2px rgba(var(--jalpi-accent-rgb), 0.1);
}
/* remove number input spin buttons */
.jalpi-slprop__num::-webkit-inner-spin-button,
.jalpi-slprop__num::-webkit-outer-spin-button { appearance: none; margin: 0; }

/* ── Elementor-style control trigger row (Typography, Text Shadow, etc.) ── */
.jalpi-el-control-row {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         7px 0;
  border-bottom:   1px solid var(--jalpi-border);
  margin-bottom:   4px;
}
.jalpi-el-control-row__label {
  font-size:   12px;
  font-weight: 400;
  color:       var(--jalpi-text);
  line-height: 1;
}
.jalpi-el-control-row__actions {
  display:     flex;
  align-items: center;
  gap:         4px;
}
/* Globe button — faint, accent-tinted */
.jalpi-el-control-row__globe {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           26px;
  height:          26px;
  border:          none;
  border-radius:   50%;
  background:      transparent;
  color:           var(--jalpi-accent);
  opacity:         0.55;
  cursor:          default;
  transition:      opacity 0.12s;
}
.jalpi-el-control-row__globe:hover { opacity: 0.85; }
.jalpi-el-control-row__globe.is-linked { opacity: 1; background: rgba(var(--jalpi-accent-rgb), 0.14); }

/* ── Design System token link control (TokenLinkControl in PropertiesPanel.tsx) ── */
.jalpi-token-link { position: relative; display: inline-flex; }
.jalpi-token-link__select {
  position:      absolute;
  top:           100%;
  left:          0;
  z-index:       20;
  margin-top:    4px;
  min-width:     170px;
  max-width:     230px;
  padding:       5px 6px;
  font-size:     11.5px;
  background:    var(--jalpi-surface);
  border:        1px solid var(--jalpi-border);
  border-radius: 6px;
  box-shadow:    0 4px 16px rgba(0,0,0,0.18);
  color:         var(--jalpi-text);
}
/* Pencil button — accent on active */
.jalpi-el-control-row__edit {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           26px;
  height:          26px;
  border:          1px solid var(--jalpi-border);
  border-radius:   var(--jalpi-radius-sm);
  background:      var(--jalpi-surface-2);
  color:           var(--jalpi-text-dim);
  cursor:          pointer;
  transition:      background 0.12s, border-color 0.12s, color 0.12s;
}
.jalpi-el-control-row__edit:hover {
  border-color: var(--jalpi-accent);
  color:        var(--jalpi-accent);
}
.jalpi-el-control-row__edit.is-active {
  background:   var(--jalpi-accent);
  border-color: var(--jalpi-accent);
  color:        #fff;
}

/* ── Typography popup card ────────────────────────────────── */
.jalpi-typo-popup {
  position:      fixed;
  z-index:       100000;
  width:         280px;
  background:    var(--jalpi-surface);
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius);
  box-shadow:    0 12px 40px rgba(15,23,42,0.20), 0 2px 8px rgba(15,23,42,0.10);
  overflow:      hidden;
}
.jalpi-typo-popup__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         10px 12px;
  border-bottom:   1px solid var(--jalpi-border);
  background:      var(--jalpi-surface-2);
}
.jalpi-typo-popup__title {
  font-size:      10px;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color:          var(--jalpi-accent);
}
.jalpi-typo-popup__header-btns {
  display:     flex;
  align-items: center;
  gap:         2px;
}
.jalpi-typo-popup__hbtn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           24px;
  height:          24px;
  border:          none;
  border-radius:   var(--jalpi-radius-sm);
  background:      transparent;
  color:           var(--jalpi-text-dim);
  cursor:          pointer;
  transition:      background 0.12s, color 0.12s;
}
.jalpi-typo-popup__hbtn:hover {
  background: var(--jalpi-surface-3);
  color:      var(--jalpi-text);
}
.jalpi-typo-popup__body {
  max-height: 72vh;
  overflow-y: auto;
}
.jalpi-typo-popup__field {
  display:        flex;
  flex-direction: column;
  gap:            6px;
  padding:        9px 12px;
  border-bottom:  1px solid var(--jalpi-border);
}
.jalpi-typo-popup__field:last-child { border-bottom: none; }
.jalpi-typo-popup__field-lbl {
  display:        flex;
  align-items:    center;
  gap:            5px;
  font-size:      10px;
  font-weight:    600;
  color:          var(--jalpi-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height:    1;
}
/* Inline variant — label left, control right on same row */
.jalpi-typo-popup__field--inline {
  flex-direction:  row;
  align-items:     center;
  justify-content: space-between;
  gap:             8px;
}
.jalpi-typo-popup__field--inline .jalpi-typo-popup__field-lbl { margin-bottom: 0; flex-shrink: 0; }
.jalpi-typo-popup__field--inline .jalpi-select {
  width:     auto;
  max-width: 130px;
  min-width: 0;
}
.jalpi-typo-popup__field--inline .jalpi-font-search {
  flex:      1;
  min-width: 0;
}
.jalpi-typo-popup__field--inline .jalpi-font-search__trigger {
  width: 100%;
}

/* Popup slider header row (label + unit select) */
.jalpi-popup-field-hdr {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
}
.jalpi-popup-field-unit {
  font-size:           11px;
  font-weight:         500;
  color:               var(--jalpi-text-dim);
  background:          transparent;
  border:              none;
  cursor:              pointer;
  appearance:          none;
  -webkit-appearance:  none;
  padding-right:       13px;
  background-image:    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:   no-repeat;
  background-position: right 0 center;
  min-width:           32px;
}
.jalpi-popup-field-unit:focus { outline: none; }

/* Popup slider row — slider (flex:1) + number input */
.jalpi-popup-slider {
  display:     flex;
  align-items: center;
  gap:         8px;
}
.jalpi-popup-slider__track {
  flex:               1;
  appearance:         none;
  -webkit-appearance: none;
  height:             4px;
  border-radius:      2px;
  background:         linear-gradient(to right, var(--jalpi-accent) var(--pct, 0%), var(--jalpi-border-2) var(--pct, 0%));
  cursor:             pointer;
}
.jalpi-popup-slider__track::-webkit-slider-thumb {
  appearance:         none;
  -webkit-appearance: none;
  width:              14px;
  height:             14px;
  border-radius:      50%;
  background:         var(--jalpi-accent);
  border:             2px solid var(--jalpi-surface);
  box-shadow:         0 0 0 1px var(--jalpi-accent);
  cursor:             grab;
  transition:         transform 0.1s;
}
.jalpi-popup-slider__track::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.15); }
.jalpi-popup-slider__num {
  width:         44px;
  flex-shrink:   0;
  padding:       4px 5px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  font-size:     12px;
  color:         var(--jalpi-text);
  text-align:    center;
  font-family:   var(--jalpi-font);
}
.jalpi-popup-slider__num:focus {
  outline:      none;
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 0 2px rgba(var(--jalpi-accent-rgb), 0.1);
}
.jalpi-popup-slider__num::-webkit-inner-spin-button,
.jalpi-popup-slider__num::-webkit-outer-spin-button { appearance: none; margin: 0; }

/* Select inside popup always takes full width, compact */
.jalpi-typo-popup__field .jalpi-select {
  width:       100%;
  padding:     3px 6px;
  height:      28px;
  font-size:   12px;
  line-height: 1;
}
.jalpi-typo-popup__resp-icon { color: var(--jalpi-accent); flex-shrink: 0; }

/* ── Searchable font family picker ────────────────────────── */
.jalpi-font-search { position: relative; }
.jalpi-font-search__trigger {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  width:           100%;
  padding:         6px 8px;
  background:      var(--jalpi-surface-2);
  border:          1px solid var(--jalpi-border);
  border-radius:   var(--jalpi-radius-sm);
  color:           var(--jalpi-text);
  font-size:       12px;
  font-family:     var(--jalpi-font);
  cursor:          pointer;
  text-align:      left;
  gap:             6px;
  transition:      border-color 0.12s;
}
.jalpi-font-search__trigger:hover { border-color: var(--jalpi-border-3); }
.jalpi-font-search__trigger > span {
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
  flex:          1;
}
.jalpi-font-search__trigger svg { flex-shrink: 0; color: var(--jalpi-text-dim); }
.jalpi-font-search__dropdown {
  position:     absolute;
  top:          calc(100% + 4px);
  left:         0;
  right:        0;
  z-index:      500;
  background:   var(--jalpi-surface);
  border:       1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius);
  box-shadow:   0 8px 24px rgba(15,23,42,0.16);
  overflow:     hidden;
}
.jalpi-font-search__search-wrap {
  display:     flex;
  align-items: center;
  gap:         6px;
  padding:     7px 10px;
  border-bottom: 1px solid var(--jalpi-border);
  color:       var(--jalpi-text-dim);
}
.jalpi-font-search__input {
  flex:       1;
  border:     none;
  outline:    none;
  background: transparent;
  font-size:  12px;
  color:      var(--jalpi-text);
  font-family: var(--jalpi-font);
}
.jalpi-font-search__list {
  max-height:  280px;
  overflow-y:  auto;
}
.jalpi-font-search__option {
  display:     block;
  width:       100%;
  text-align:  left;
  padding:     7px 10px;
  font-size:   12px;
  color:       var(--jalpi-text);
  background:  none;
  border:      none;
  cursor:      pointer;
  font-family: var(--jalpi-font);
  white-space: nowrap;
  overflow:    hidden;
  text-overflow: ellipsis;
}
.jalpi-font-search__option:hover    { background: var(--jalpi-surface-2); }
.jalpi-font-search__option.is-active {
  color:      var(--jalpi-accent);
  background: color-mix(in srgb, var(--jalpi-accent) 8%, transparent);
  font-weight: 600;
}
.jalpi-font-search__empty {
  padding:    12px 10px;
  font-size:  11px;
  color:      var(--jalpi-text-dim);
  text-align: center;
}
.jalpi-font-search__category {
  padding:        5px 10px 4px;
  font-size:      10px;
  font-weight:    600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color:          var(--jalpi-text-dim);
  background:     var(--jalpi-surface-2);
  border-top:     1px solid var(--jalpi-border);
  position:       sticky;
  top:            0;
  z-index:        1;
}

/* =========================================================
   PropRow — label + control pair
   ========================================================= */

.jalpi-prop-row {
  display:       flex;
  align-items:   center;
  gap:           8px;
  margin-bottom: 9px;
}

.jalpi-prop-row:last-child { margin-bottom: 0; }

.jalpi-prop-row__label {
  flex-shrink:   0;
  width:         86px;
  font-size:     11px;
  color:         var(--jalpi-text-muted);
  font-weight:   500;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  line-height:   1.3;
}

.jalpi-prop-row__control { flex: 1; min-width: 0; }

/* Stacked variant — label on its own line, control full-width below */
.jalpi-prop-row--stack {
  flex-direction: column;
  align-items:    stretch;
}

.jalpi-prop-row--stack .jalpi-prop-row__label {
  width:         100%;
  margin-bottom: 5px;
}

/* =========================================================
   DimensionInput — number field + unit toggle (px / %)
   ========================================================= */

.jalpi-dim-input {
  display:       flex;
  align-items:   stretch;
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  overflow:      hidden;
  background:    var(--jalpi-surface-2);
  transition:    border-color 0.15s, box-shadow 0.15s;
}

.jalpi-dim-input:focus-within {
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 0 3px rgba(var(--jalpi-accent-rgb), 0.1);
  background:   var(--jalpi-surface);
}

.jalpi-dim-input__num {
  flex:        1;
  border:      none;
  background:  transparent;
  color:       var(--jalpi-text);
  font-size:   12px;
  font-weight: 500;
  padding:     6px 8px;
  outline:     none;
  min-width:   0;
  font-family: var(--jalpi-font);
}

.jalpi-dim-input__num::placeholder { color: var(--jalpi-text-dim); }

.jalpi-dim-input__unit {
  flex-shrink:    0;
  background:     var(--jalpi-surface-3);
  border:         none;
  border-left:    1px solid var(--jalpi-border-2);
  color:          var(--jalpi-text-muted);
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.03em;
  padding:        0 9px;
  cursor:         pointer;
  min-width:      38px;
  text-align:     center;
  transition:     all 0.12s;
  font-family:    var(--jalpi-font);
  text-transform: uppercase;
}

.jalpi-dim-input__unit:hover {
  background: rgba(var(--jalpi-accent-rgb), 0.1);
  color:      var(--jalpi-accent);
  border-left-color: rgba(var(--jalpi-accent-rgb), 0.3);
}

/* Dimmed state when no value is typed yet */
.jalpi-dim-input__unit.is-unset {
  opacity:    0.45;
  font-style: italic;
}

/* Two DimensionInputs side-by-side */
.jalpi-dim-row {
  display: flex;
  gap:     6px;
}

.jalpi-dim-row__item {
  flex:           1;
  display:        flex;
  flex-direction: column;
  gap:            3px;
}

.jalpi-dim-row__label {
  font-size:      9px;
  font-weight:    700;
  color:          var(--jalpi-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* =========================================================
   ColorInput — swatch + hex text field
   ========================================================= */

.jalpi-color-input {
  display:       flex;
  align-items:   stretch;
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  overflow:      hidden;
  background:    var(--jalpi-surface-2);
  transition:    border-color 0.15s, box-shadow 0.15s;
}

.jalpi-color-input:focus-within {
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 0 3px rgba(var(--jalpi-accent-rgb), 0.1);
}

.jalpi-color-input__swatch {
  width:        38px;
  min-height:   32px;
  border:       none;
  border-right: 1px solid var(--jalpi-border-2);
  padding:      4px;
  cursor:       pointer;
  background:   transparent;
  flex-shrink:  0;
}

.jalpi-color-input__text {
  flex:        1;
  border:      none;
  background:  transparent;
  color:       var(--jalpi-text);
  font-size:   12px;
  padding:     6px 8px;
  outline:     none;
  font-family: var(--jalpi-font);
  min-width:   0;
}

.jalpi-color-input__text::placeholder { color: var(--jalpi-text-dim); }

/* =========================================================
   BoxSpacingControl — visual T/R/B/L spacing box
   ========================================================= */

/* 4-column single-row spacing control */
.jalpi-spacing-grid {
  padding: 2px 0 4px;
}

.jalpi-spacing-grid__row {
  display:     flex;
  align-items: flex-start;
  gap:         6px;
}

.jalpi-spacing-grid__fields {
  display:               grid;
  grid-template-columns: repeat(4, 1fr);
  gap:                   4px;
  flex:                  1;
}

.jalpi-spacing-field {
  display:        flex;
  flex-direction: column;
  gap:            3px;
}

.jalpi-spacing-field__label {
  font-size:      9px;
  font-weight:    600;
  color:          var(--jalpi-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align:     center;
  line-height:    1;
}

.jalpi-spacing-field__input {
  width:         100%;
  height:        28px;
  text-align:    center;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  color:         var(--jalpi-text);
  font-size:     12px;
  font-weight:   500;
  padding:       0 4px;
  outline:       none;
  font-family:   var(--jalpi-font);
  transition:    border-color 0.12s, box-shadow 0.12s;
  min-height:    0 !important;
}

.jalpi-spacing-field__input:focus {
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 0 2px rgba(var(--jalpi-accent-rgb), 0.12);
  background:   var(--jalpi-surface);
}

.jalpi-spacing-grid__link {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           26px;
  height:          28px;
  flex-shrink:     0;
  padding:         0;
  background:      var(--jalpi-surface-2);
  border:          1px solid var(--jalpi-border-2);
  border-radius:   var(--jalpi-radius-sm);
  color:           var(--jalpi-text-muted);
  cursor:          pointer;
  transition:      all 0.14s;
}

.jalpi-spacing-grid__link:hover {
  border-color: rgba(var(--jalpi-accent-rgb), 0.4);
  color:        var(--jalpi-accent);
  background:   var(--jalpi-accent-dim);
}

.jalpi-spacing-grid__link.is-linked {
  background:   var(--jalpi-accent-dim);
  border-color: rgba(var(--jalpi-accent-rgb), 0.35);
  color:        var(--jalpi-accent);
}

/* =========================================================
   Panel section divider text
   ========================================================= */

.jalpi-panel-tip {
  font-size:   11px;
  color:       var(--jalpi-text-muted);
  line-height: 1.5;
  padding:     6px 10px;
  background:  var(--jalpi-surface-2);
  border-radius: var(--jalpi-radius-sm);
  border:      1px solid var(--jalpi-border);
}

/* =========================================================
   Opacity slider
   ========================================================= */

/* =========================================================
   SliderDimInput — range slider + numeric input + unit toggle
   ========================================================= */

.jalpi-slider-dim {
  display:        flex;
  flex-direction: column;
  gap:            6px;
  width:          100%;
}

.jalpi-slider-dim__track {
  width:          100%;
  appearance:     none;
  -webkit-appearance: none;
  height:         4px;
  border-radius:  2px;
  background:     linear-gradient(to right, var(--jalpi-accent) 0%, var(--jalpi-accent) var(--pct, 0%), var(--jalpi-surface-3) var(--pct, 0%));
  outline:        none;
  cursor:         pointer;
}

.jalpi-slider-dim__track::-webkit-slider-thumb {
  appearance:       none;
  -webkit-appearance: none;
  width:            14px;
  height:           14px;
  border-radius:    50%;
  background:       var(--jalpi-accent);
  border:           2px solid #fff;
  box-shadow:       0 1px 4px rgba(0,0,0,.25);
  cursor:           grab;
  transition:       transform 0.1s;
}

.jalpi-slider-dim__track::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.2); }

.jalpi-slider-dim__row {
  display:       flex;
  align-items:   stretch;
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  overflow:      hidden;
  background:    var(--jalpi-surface-2);
}

.jalpi-slider-dim__row:focus-within {
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 0 2px rgba(var(--jalpi-accent-rgb), 0.1);
}

.jalpi-slider-dim__num {
  flex:        1;
  border:      none;
  background:  transparent;
  color:       var(--jalpi-text);
  font-size:   12px;
  font-weight: 500;
  padding:     5px 8px;
  outline:     none;
  min-width:   0;
  font-family: var(--jalpi-font);
}

.jalpi-slider-dim__num::placeholder { color: var(--jalpi-text-dim); }

.jalpi-slider-dim__unit {
  flex-shrink:    0;
  background:     var(--jalpi-surface-3);
  border:         none;
  border-left:    1px solid var(--jalpi-border-2);
  color:          var(--jalpi-text-muted);
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.03em;
  padding:        0 8px;
  cursor:         pointer;
  min-width:      34px;
  text-align:     center;
  font-family:    var(--jalpi-font);
  text-transform: uppercase;
  transition:     all 0.12s;
}

.jalpi-slider-dim__unit:hover { color: var(--jalpi-accent); background: var(--jalpi-accent-dim); }

/* =========================================================
   Icon button group — Direction / Justify / Align
   ========================================================= */

.jalpi-icon-btn-group {
  display: flex;
  gap:     2px;
}

.jalpi-icon-btn-group--6 { flex-wrap: wrap; }

.jalpi-icon-btn {
  display:       flex;
  align-items:   center;
  justify-content: center;
  flex:          1;
  height:        30px;
  min-width:     28px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  color:         var(--jalpi-text-muted);
  cursor:        pointer;
  transition:    all 0.12s;
}

.jalpi-icon-btn:hover {
  border-color: rgba(var(--jalpi-accent-rgb), 0.4);
  color:        var(--jalpi-accent);
  background:   var(--jalpi-accent-dim);
}

.jalpi-icon-btn.is-active {
  background:   rgba(var(--jalpi-accent-rgb), 0.12);
  border-color: var(--jalpi-accent);
  color:        var(--jalpi-accent);
}

/* Layout hint text */
.jalpi-layout-hint {
  margin-top:  6px;
  font-size:   10px;
  color:       var(--jalpi-text-dim);
  font-style:  italic;
  line-height: 1.4;
}

/* =========================================================
   Advanced Layout — Flex / Grid icon groups
   ========================================================= */

/* 5-column align group */
.jalpi-icon-btn-group--5 { flex-wrap: wrap; }

/* Flex/Grid mode badge shown in canvas */
.jalpi-layout-mode-badge {
  position:   absolute;
  bottom:     4px;
  right:      4px;
  background: rgba(var(--jalpi-accent-rgb), 0.75);
  color:      #fff;
  font-size:  9px;
  font-weight: 700;
  padding:    2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  pointer-events: none;
  z-index:    5;
  letter-spacing: 0.05em;
}

/* Grid/flex empty-state placeholder grid lines */
.jalpi-container-inner[data-layout="grid"] {
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent calc(var(--jalpi-grid-col-size, 100%) - 1px),
      rgba(var(--jalpi-accent-rgb), 0.08) calc(var(--jalpi-grid-col-size, 100%) - 1px),
      rgba(var(--jalpi-accent-rgb), 0.08) var(--jalpi-grid-col-size, 100%)
    );
}

/* =========================================================
   Opacity slider
   ========================================================= */

.jalpi-opacity-row {
  display:     flex;
  align-items: center;
  gap:         8px;
}

.jalpi-opacity-row input[type="range"] {
  flex:               1;
  appearance:         none;
  -webkit-appearance: none;
  height:             4px;
  border-radius:      2px;
  background:         linear-gradient(to right, var(--jalpi-accent) 0%, var(--jalpi-accent) var(--pct, 100%), var(--jalpi-surface-3) var(--pct, 100%));
  outline:            none;
  cursor:             pointer;
}

.jalpi-opacity-row input[type="range"]::-webkit-slider-thumb {
  appearance:         none;
  -webkit-appearance: none;
  width:              14px;
  height:             14px;
  border-radius:      50%;
  background:         var(--jalpi-accent);
  border:             2px solid #fff;
  box-shadow:         0 1px 4px rgba(var(--jalpi-accent-rgb), 0.5);
  cursor:             pointer;
  transition:         transform 0.1s;
}

.jalpi-opacity-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.jalpi-opacity-val {
  font-size:   11px;
  font-weight: 600;
  color:       var(--jalpi-text-muted);
  min-width:   30px;
  text-align:  right;
}

/* =========================================================
   "Add element" action row in Content tab
   ========================================================= */

.jalpi-add-element-row {
  padding:    6px 0 2px;
}

.jalpi-add-element-row .jalpi-btn {
  width:           100%;
  justify-content: center;
  padding:         9px;
  font-size:       12px;
  border-radius:   var(--jalpi-radius);
}

/* =========================================================
   NothingSelected empty state
   ========================================================= */

.jalpi-empty-state {
  padding:        40px 20px;
  text-align:     center;
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            12px;
}

.jalpi-empty-state__icon {
  width:           52px;
  height:          52px;
  background:      rgba(var(--jalpi-accent-rgb), 0.08);
  border:          1px solid rgba(var(--jalpi-accent-rgb), 0.18);
  border-radius:   var(--jalpi-radius-lg);
  display:         flex;
  align-items:     center;
  justify-content: center;
  color:           var(--jalpi-accent);
}

.jalpi-empty-state__title {
  font-size:   13px;
  font-weight: 600;
  color:       var(--jalpi-text);
  margin:      0;
}

.jalpi-empty-state__desc {
  font-size:   12px;
  color:       var(--jalpi-text-muted);
  line-height: 1.6;
  margin:      0;
  max-width:   200px;
}

/* =========================================================
   Element type badge (above tabs)
   ========================================================= */

.jalpi-element-badge {
  display:        flex;
  align-items:    center;
  gap:            7px;
  padding:        8px 14px;
  background:     var(--jalpi-surface);
  border-bottom:  1px solid var(--jalpi-border);
  flex-shrink:    0;
}

.jalpi-element-badge__icon {
  display:     flex;
  align-items: center;
  color:       var(--jalpi-accent);
  flex-shrink: 0;
}

.jalpi-element-badge__label {
  font-size:      10px;
  font-weight:    800;
  color:          var(--jalpi-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* =========================================================
   Tab bar — Content / Style / Advanced
   ========================================================= */

.jalpi-props-panel__tabs {
  display:       flex;
  flex-shrink:   0;
  background:    var(--jalpi-surface);
  border-bottom: 1px solid var(--jalpi-border);
}

.jalpi-props-panel__tab {
  flex:           1;
  padding:        10px 4px;
  background:     transparent;
  border:         none;
  color:          var(--jalpi-text-muted);
  cursor:         pointer;
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom:  2px solid transparent;
  transition:     all 0.15s;
  font-family:    var(--jalpi-font);
}

.jalpi-props-panel__tab:hover {
  color:      var(--jalpi-text);
  background: rgba(var(--jalpi-accent-rgb), 0.03);
}

.jalpi-props-panel__tab.is-active {
  color:         var(--jalpi-accent);
  border-bottom: 2px solid var(--jalpi-accent);
  background:    rgba(var(--jalpi-accent-rgb), 0.04);
}

/* Inline toggle group (e.g. Columns) */
.jalpi-toggle-group {
  display: flex;
  gap:     3px;
}

.jalpi-toggle-group__btn {
  flex:            1;
  padding:         5px 4px;
  background:      var(--jalpi-surface-2);
  border:          1px solid var(--jalpi-border-2);
  border-radius:   var(--jalpi-radius-sm);
  color:           var(--jalpi-text-muted);
  font-size:       11px;
  font-weight:     600;
  cursor:          pointer;
  text-align:      center;
  transition:      all 0.12s;
  font-family:     var(--jalpi-font);
}

.jalpi-toggle-group__btn:hover {
  color:        var(--jalpi-text);
  border-color: var(--jalpi-border-3);
}

.jalpi-toggle-group__btn.is-active {
  background:   var(--jalpi-accent);
  border-color: var(--jalpi-accent);
  color:        #fff;
  box-shadow:   0 2px 6px rgba(var(--jalpi-accent-rgb), 0.3);
}

/* ── Normal / Hover state tabs ─────────────────────────── */
.jalpi-nh-tabs {
  display:       flex;
  margin-bottom: 10px;
  border:        1px solid var(--jalpi-border);
  border-radius: 6px;
  overflow:      hidden;
}

.jalpi-nh-tab {
  flex:        1;
  padding:     5px 0;
  font-size:   11px;
  font-weight: 500;
  background:  transparent;
  border:      none;
  color:       var(--jalpi-text-muted);
  cursor:      pointer;
  transition:  background 0.15s, color 0.15s;
}

.jalpi-nh-tab.is-active {
  background: var(--jalpi-accent-dim);
  color:      var(--jalpi-accent);
}

.jalpi-nh-tab:first-child { border-right: 1px solid var(--jalpi-border); }

/* ── PropRow responsive indicator icon ──────────────────── */
.jalpi-prop-row__resp-icon {
  display:        inline-block;
  vertical-align: middle;
  margin-left:    4px;
  opacity:        0.45;
  flex-shrink:    0;
}

/* ── Image upload input ─────────────────────────────────── */
/* ── Media / Image Picker ───────────────────────────────── */
.jalpi-media-picker {
  width: 100%;
}

.jalpi-media-picker__add {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             7px;
  width:           100%;
  height:          80px;
  background:      var(--jalpi-surface-2);
  border:          2px dashed var(--jalpi-border-2);
  border-radius:   7px;
  color:           var(--jalpi-text-muted);
  font-size:       11px;
  font-weight:     500;
  cursor:          pointer;
  transition:      border-color 0.15s, background 0.15s, color 0.15s;
}

.jalpi-media-picker__add:hover {
  border-color: var(--jalpi-accent);
  background:   var(--jalpi-accent-dim);
  color:        var(--jalpi-accent);
}

.jalpi-media-picker__preview {
  position:      relative;
  width:         100%;
  height:        90px;
  border-radius: 7px;
  overflow:      hidden;
  cursor:        pointer;
  background:    var(--jalpi-surface-3);
  border:        1px solid var(--jalpi-border);
}

.jalpi-media-picker__img {
  width:       100%;
  height:      100%;
  object-fit:  cover;
  display:     block;
}

.jalpi-media-picker__hover-label {
  position:        absolute;
  inset:           0;
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             5px;
  background:      rgba(0,0,0,0.52);
  color:           #fff;
  font-size:       11px;
  font-weight:     600;
  letter-spacing:  0.03em;
  opacity:         0;
  transition:      opacity 0.15s;
}

.jalpi-media-picker__preview:hover .jalpi-media-picker__hover-label {
  opacity: 1;
}

.jalpi-media-picker__remove {
  display:     flex;
  align-items: center;
  gap:         4px;
  margin-top:  5px;
  padding:     0;
  background:  none;
  border:      none;
  cursor:      pointer;
  color:       var(--jalpi-danger);
  font-size:   11px;
  opacity:     0.8;
  transition:  opacity 0.15s;
}

.jalpi-media-picker__remove:hover {
  opacity: 1;
}

/* ── Coming soon placeholder ────────────────────────────── */
.jalpi-coming-soon {
  padding:     10px 12px;
  font-size:   11px;
  color:       var(--jalpi-text-dim);
  background:  var(--jalpi-surface-2);
  border-radius: 5px;
  text-align:  center;
  border:      1px dashed var(--jalpi-border-2);
}

/* ==========================================================================
   Template Library
   ========================================================================== */

.jalpi-tpl-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.jalpi-tpl-modal {
  width: 940px;
  max-width: calc(100vw - 40px);
  height: 82vh;
  max-height: 720px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  animation: jalpi-tpl-slide-in 0.18s ease;
}

@keyframes jalpi-tpl-slide-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Header */
.jalpi-tpl-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #e8eaed;
  flex-shrink: 0;
}

.jalpi-tpl-header__title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
  flex: 1;
}

.jalpi-tpl-header__tabs {
  display: flex;
  background: #f0f0f1;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.jalpi-tpl-header__tab {
  padding: 5px 14px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: #646970;
  cursor: pointer;
  transition: all 0.1s;
}

.jalpi-tpl-header__tab.is-active {
  background: #fff;
  color: #1a1a2e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.jalpi-tpl-close {
  width: 30px;
  height: 30px;
  border: none;
  background: #f0f0f1;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #646970;
  font-size: 20px;
  line-height: 1;
  transition: background 0.1s;
}

.jalpi-tpl-close:hover { background: #e0e0e1; color: #1a1a2e; }

/* Browse */
.jalpi-tpl-browse {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.jalpi-tpl-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid #e8eaed;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.jalpi-tpl-search {
  position: relative;
  flex: 0 0 220px;
}

.jalpi-tpl-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px 7px 30px;
  border: 1px solid #dcdcde;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #f9f9f9;
  color: #1a1a2e;
}

.jalpi-tpl-search input:focus {
  border-color: #1a1a1a;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}

.jalpi-tpl-search__icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.jalpi-tpl-type-select {
  padding: 7px 10px;
  border: 1px solid #dcdcde;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  outline: none;
  color: #3c434a;
}

.jalpi-tpl-cats {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.jalpi-tpl-cats::-webkit-scrollbar { display: none; }

.jalpi-tpl-cat-btn {
  padding: 5px 11px;
  border: 1px solid #dcdcde;
  border-radius: 20px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #646970;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s;
  flex-shrink: 0;
}

.jalpi-tpl-cat-btn:hover:not(.is-active) {
  border-color: #1a1a1a;
  color: #1a1a1a;
}

.jalpi-tpl-cat-btn.is-active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

/* Grid */
.jalpi-tpl-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.jalpi-tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* Template Card */
.jalpi-tpl-card {
  border: 1px solid #e8eaed;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: grab;
  user-select: none;
}

.jalpi-tpl-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.jalpi-tpl-card:active { cursor: grabbing; }

.jalpi-tpl-card__thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  position: relative;
}

.jalpi-tpl-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.jalpi-tpl-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jalpi-tpl-card__placeholder-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jalpi-tpl-card__info {
  padding: 9px 11px 6px;
}

.jalpi-tpl-card__name {
  font-size: 12.5px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jalpi-tpl-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.jalpi-tpl-card__type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}

.jalpi-tpl-card__type--page    { background: #f2f2f2; color: #1a1a1a; }
.jalpi-tpl-card__type--section { background: #ecfdf5; color: #059669; }

.jalpi-tpl-card__actions {
  display: flex;
  gap: 3px;
  padding: 5px 7px 7px;
  border-top: 1px solid #f0f0f1;
}

.jalpi-tpl-card__action {
  flex: 1;
  padding: 5px 0;
  border: 1px solid #e8eaed;
  border-radius: 5px;
  background: #fff;
  font-size: 11px;
  font-weight: 500;
  color: #646970;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.1s;
  min-width: 0;
}

.jalpi-tpl-card__action:hover              { background: #f5f5f6; color: #1a1a2e; }
.jalpi-tpl-card__action--primary           { background: #1a1a1a; border-color: #1a1a1a; color: #fff; }
.jalpi-tpl-card__action--primary:hover     { background: #000000; border-color: #000000; }
.jalpi-tpl-card__action--danger            { border-color: transparent; color: #dc2626; }
.jalpi-tpl-card__action--danger:hover      { background: #fef2f2; border-color: #fecaca; }

/* Empty state */
.jalpi-tpl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #9ca3af;
  text-align: center;
}

.jalpi-tpl-empty__icon { width: 48px; height: 48px; margin: 0 auto 12px; opacity: 0.35; }
.jalpi-tpl-empty p     { font-size: 14px; margin: 0; }

/* Loading */
.jalpi-tpl-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.jalpi-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #e8eaed;
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: jalpi-tpl-spin 0.65s linear infinite;
}

@keyframes jalpi-tpl-spin { to { transform: rotate(360deg); } }

/* Forms (Save / Import) */
.jalpi-tpl-form {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  max-width: 540px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.jalpi-tpl-form__title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 22px;
}

.jalpi-tpl-field { margin-bottom: 16px; }

.jalpi-tpl-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #3c434a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.jalpi-tpl-field input,
.jalpi-tpl-field select,
.jalpi-tpl-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #dcdcde;
  border-radius: 6px;
  font-size: 13.5px;
  outline: none;
  color: #1a1a2e;
  background: #fff;
  font-family: inherit;
}

.jalpi-tpl-field input:focus,
.jalpi-tpl-field select:focus,
.jalpi-tpl-field textarea:focus {
  border-color: #1a1a1a;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}

.jalpi-tpl-field textarea {
  resize: vertical;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  min-height: 130px;
}

.jalpi-tpl-radio-group { display: flex; gap: 10px; }

.jalpi-tpl-radio {
  flex: 1;
  border: 2px solid #e8eaed;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.jalpi-tpl-radio.is-selected { border-color: #1a1a1a; background: #f2f2f2; }
.jalpi-tpl-radio input[type="radio"] { margin: 2px 0 0; flex-shrink: 0; }
.jalpi-tpl-radio__label { font-weight: 600; font-size: 13px; color: #1a1a2e; }
.jalpi-tpl-radio__desc  { font-size: 11px; color: #9ca3af; margin-top: 2px; }

.jalpi-tpl-submit-row {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.jalpi-tpl-btn-primary {
  flex: 1;
  padding: 9px 20px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}

.jalpi-tpl-btn-primary:hover    { background: #000000; }
.jalpi-tpl-btn-primary:disabled { background: #a5b4fc; cursor: not-allowed; }

.jalpi-tpl-btn-secondary {
  padding: 9px 16px;
  background: #f0f0f1;
  color: #3c434a;
  border: none;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.jalpi-tpl-btn-secondary:hover { background: #e0e0e1; }

.jalpi-tpl-import-or {
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
  margin: 14px 0;
  position: relative;
}

.jalpi-tpl-import-or::before,
.jalpi-tpl-import-or::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 22px);
  height: 1px;
  background: #e8eaed;
}

.jalpi-tpl-import-or::before { left: 0; }
.jalpi-tpl-import-or::after  { right: 0; }

.jalpi-tpl-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 9px 13px;
  color: #dc2626;
  font-size: 13px;
  margin-bottom: 14px;
}

/* TopBar Templates button */
.jalpi-topbar__templates-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
}

/* Canvas area drop target */
.jalpi-editor__canvas-area { position: relative; }

.jalpi-tpl-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.04);
  border: 3px dashed #1a1a1a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
}

.jalpi-tpl-drop-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #1a1a1a;
  font-size: 16px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  padding: 24px 32px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.2);
}

/* ==========================================================
   Revision History Panel
   ========================================================== */

.jalpi-rev-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9200;
  background: rgba(15, 15, 30, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.jalpi-rev-modal {
  background: #fff;
  border-radius: 14px;
  width: min(940px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  animation: jalpi-rev-slide-in 0.2s ease;
}

@keyframes jalpi-rev-slide-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* Header */
.jalpi-rev-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.jalpi-rev-header__left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.jalpi-rev-header__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #1e1e2e;
}

.jalpi-rev-header__hint {
  font-size: 12px;
  color: #888;
}

.jalpi-rev-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jalpi-rev-snap-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.jalpi-rev-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.jalpi-rev-close:hover { background: #f3f4f6; color: #1e1e2e; }

/* Snapshot bar */
.jalpi-rev-snapshot-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.jalpi-rev-snapshot-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #e0e0e0;
  border-radius: 7px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.jalpi-rev-snapshot-input:focus { border-color: #1a1a1a; }

/* Body */
.jalpi-rev-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

/* Revision list */
.jalpi-rev-list {
  border-right: 1px solid #f0f0f0;
  overflow-y: auto;
  padding: 8px 0;
}

.jalpi-rev-list__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  min-height: 200px;
  color: #aaa;
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.jalpi-rev-list__empty p { margin: 0; }

.jalpi-rev-group {
  padding: 0 0 8px;
}

.jalpi-rev-group__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #aaa;
  padding: 8px 16px 4px;
}

.jalpi-rev-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.12s;
  border-left: 3px solid transparent;
}

.jalpi-rev-item:hover { background: #f8f8fc; }

.jalpi-rev-item.is-selected {
  background: #eef0ff;
  border-left-color: #1a1a1a;
}

.jalpi-rev-item.is-compare {
  background: #fff7ed;
  border-left-color: #f59e0b;
}

.jalpi-rev-item.is-snapshot .jalpi-rev-item__icon { color: #f59e0b; }
.jalpi-rev-item:not(.is-snapshot) .jalpi-rev-item__icon { color: #a0a0b0; }

.jalpi-rev-item.is-pickable:hover {
  background: #fff7ed;
  border-left-color: #f59e0b;
}

.jalpi-rev-item__icon {
  flex-shrink: 0;
  width: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jalpi-rev-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.jalpi-rev-item__label {
  font-size: 12px;
  font-weight: 500;
  color: #2d2d44;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jalpi-rev-item.is-snapshot .jalpi-rev-item__label { color: #b45309; }

.jalpi-rev-item__meta {
  font-size: 10px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jalpi-rev-item__busy {
  flex-shrink: 0;
  animation: jalpi-rev-spin 0.8s linear infinite;
}

@keyframes jalpi-rev-spin {
  to { transform: rotate(360deg); }
}

/* Detail pane */
.jalpi-rev-detail {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
  gap: 16px;
}

.jalpi-rev-detail__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #bbb;
  font-size: 13px;
  text-align: center;
}

.jalpi-rev-detail__card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jalpi-rev-detail__badge {
  display: flex;
  gap: 6px;
}

.jalpi-rev-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.jalpi-rev-badge--auto { background: #f2f2f2; color: #1a1a1a; }
.jalpi-rev-badge--snap { background: #fef3c7; color: #b45309; }

.jalpi-rev-detail__name {
  font-size: 16px;
  font-weight: 600;
  color: #1e1e2e;
  margin: 0;
}

.jalpi-rev-detail__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid #f5f5f5;
  color: #555;
}

.jalpi-rev-detail__row span:first-child { color: #999; font-size: 12px; }
.jalpi-rev-detail__row span:last-child  { font-weight: 500; color: #2d2d44; }

.jalpi-rev-detail__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.jalpi-rev-detail__actions .jalpi-btn { width: 100%; justify-content: center; }

.jalpi-rev-delete-btn { color: #ef4444 !important; border-color: #fecaca !important; }
.jalpi-rev-delete-btn:hover { background: #fef2f2 !important; }

/* Current page stats footer */
.jalpi-rev-current-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 0;
  border-top: 1px solid #f0f0f0;
  font-size: 11px;
  color: #aaa;
  margin-top: auto;
}

/* Compare pane */
.jalpi-rev-compare {
  display: grid;
  grid-template-columns: 1fr 44px 1fr;
  gap: 0;
  height: 100%;
  min-height: 0;
}

.jalpi-rev-compare__col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  overflow-y: auto;
  border: 1px solid #f0f0f0;
  border-radius: 10px;
}

.jalpi-rev-compare__col:first-child { border-right: none; border-radius: 10px 0 0 10px; background: #f9f9ff; }
.jalpi-rev-compare__col:last-child  { border-left:  none; border-radius: 0 10px 10px 0; background: #fffbf0; }

.jalpi-rev-compare__col-head {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #aaa;
  margin-bottom: 4px;
}

.jalpi-rev-compare__label {
  font-size: 14px;
  font-weight: 600;
  color: #2d2d44;
}

.jalpi-rev-compare__date  { font-size: 12px; color: #666; }
.jalpi-rev-compare__author { font-size: 12px; color: #999; }

.jalpi-rev-compare__stats {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.jalpi-rev-compare__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  padding: 8px 16px;
  gap: 2px;
}

.jalpi-rev-compare__stat-num {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1;
}

.jalpi-rev-compare__stat span:last-child { font-size: 10px; color: #aaa; }

.jalpi-rev-compare__pick-hint {
  font-size: 12px;
  color: #bbb;
  text-align: center;
  margin: auto 0;
}

.jalpi-rev-compare__arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
}

.jalpi-rev-compare__diff {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.jalpi-rev-diff--add { font-size: 11px; font-weight: 600; color: #16a34a; }
.jalpi-rev-diff--rem { font-size: 11px; font-weight: 600; color: #ef4444; }

.jalpi-rev-spin {
  animation: jalpi-rev-spin 0.8s linear infinite;
}

/* ── Timeline dots & vertical line ──────────────────────────────────────── */

.jalpi-tl-mode {
  position: relative;
}

/* The continuous connecting line */
.jalpi-tl-mode::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(to bottom, transparent, #e5e7eb 24px, #e5e7eb calc(100% - 24px), transparent);
  pointer-events: none;
}

.jalpi-tl-mode .jalpi-rev-item {
  padding-left: 40px;
  position: relative;
  align-items: flex-start;
  padding-top: 9px;
  padding-bottom: 9px;
}

/* Dot element */
.jalpi-tl-dot {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e5e7eb;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1.5px #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 1;
  transition: background 0.12s, box-shadow 0.12s;
  flex-shrink: 0;
}

.jalpi-tl-dot--snap {
  background: #f59e0b;
  box-shadow: 0 0 0 1.5px #f59e0b;
}

.jalpi-tl-dot--sel {
  background: #1a1a1a;
  box-shadow: 0 0 0 1.5px #1a1a1a;
}

/* Animated pulse on selected dot */
.jalpi-tl-dot--sel::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  animation: jalpi-tl-pulse 1.5s ease infinite;
}

@keyframes jalpi-tl-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0; transform: scale(1.5); }
}

/* Label row with inline hint badge */
.jalpi-tl-label-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

/* Hint badges */
.jalpi-rev-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

.jalpi-rev-hint--added    { background: #dcfce7; color: #15803d; }
.jalpi-rev-hint--deleted  { background: #fee2e2; color: #b91c1c; }
.jalpi-rev-hint--style    { background: #dbeafe; color: #1d4ed8; }
.jalpi-rev-hint--moved    { background: #efefef; color: #1a1a1a; }
.jalpi-rev-hint--settings { background: #f3f4f6; color: #6b7280; }

/* ── Diff panel ──────────────────────────────────────────────────────────── */

.jalpi-rev-diff-wrap {
  background: #fafafa;
  border: 1px solid #efefef;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.jalpi-rev-diff-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-bottom: 1px solid #efefef;
  background: #fff;
}

.jalpi-rev-diff-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

.jalpi-rev-diff-loading,
.jalpi-rev-diff-none {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 13px;
  font-size: 12px;
  color: #9ca3af;
}

/* Summary chip bar */
.jalpi-rev-diff-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 9px 13px;
  border-bottom: 1px solid #efefef;
  background: #fff;
}

.jalpi-rev-diff-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.jalpi-rev-diff-chip--added      { background: #dcfce7; color: #15803d; }
.jalpi-rev-diff-chip--deleted    { background: #fee2e2; color: #b91c1c; }
.jalpi-rev-diff-chip--content    { background: #fef3c7; color: #b45309; }
.jalpi-rev-diff-chip--style      { background: #dbeafe; color: #1d4ed8; }
.jalpi-rev-diff-chip--settings   { background: #f3f4f6; color: #4b5563; }
.jalpi-rev-diff-chip--visibility { background: #efefef; color: #1a1a1a; }

/* Change sections */
.jalpi-rev-diff-section {
  padding: 8px 13px;
  border-bottom: 1px solid #f5f5f5;
}
.jalpi-rev-diff-section:last-of-type { border-bottom: none; }

.jalpi-rev-diff-section__head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 7px;
}

.jalpi-rev-diff-section__head--added      { color: #15803d; }
.jalpi-rev-diff-section__head--deleted    { color: #b91c1c; }
.jalpi-rev-diff-section__head--content    { color: #b45309; }
.jalpi-rev-diff-section__head--style      { color: #1d4ed8; }
.jalpi-rev-diff-section__head--settings   { color: #4b5563; }
.jalpi-rev-diff-section__head--visibility { color: #1a1a1a; }

/* Individual change rows */
.jalpi-rev-diff-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
}

.jalpi-rev-diff-item__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.jalpi-rev-diff-item__dot--added      { background: #16a34a; }
.jalpi-rev-diff-item__dot--deleted    { background: #dc2626; }
.jalpi-rev-diff-item__dot--content    { background: #d97706; }
.jalpi-rev-diff-item__dot--style      { background: #2563eb; }
.jalpi-rev-diff-item__dot--settings   { background: #6b7280; }
.jalpi-rev-diff-item__dot--visibility { background: #1a1a1a; }

.jalpi-rev-diff-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.jalpi-rev-diff-item__node {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  line-height: 1.3;
}

.jalpi-rev-diff-item__detail {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.4;
  word-break: break-word;
}

/* "Show N more" link */
.jalpi-rev-diff-more {
  background: none;
  border: none;
  width: 100%;
  padding: 8px 13px;
  text-align: left;
  font-size: 12px;
  color: #1a1a1a;
  cursor: pointer;
  font-family: var(--jalpi-font);
  transition: background 0.1s;
  border-top: 1px solid #f5f5f5;
}
.jalpi-rev-diff-more:hover { background: #f2f2f2; }

/* ================================================================
   Global Finder  (.jalpi-finder-)
   Ctrl+P  ·  Search pages, templates, elements, commands, settings
   ================================================================ */

.jalpi-finder-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 10, 30, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  animation: jalpi-fade-in .1s ease;
}

.jalpi-finder {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(0,0,0,.24), 0 4px 20px rgba(0,0,0,.06);
  width: 600px;
  max-width: 96vw;
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: jalpi-finder-drop .15s cubic-bezier(.4,0,.2,1);
}

@keyframes jalpi-finder-drop {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* Search bar */
.jalpi-finder__search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.jalpi-finder__search-ic {
  color: #9ca3af;
  flex-shrink: 0;
}

.jalpi-finder__input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: var(--jalpi-font);
  color: #111827;
  background: transparent;
  min-width: 0;
}

.jalpi-finder__input::placeholder { color: #9ca3af; }

.jalpi-finder__clear {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: #e5e7eb; border: none; cursor: pointer;
  color: #6b7280; flex-shrink: 0; transition: background .1s;
}
.jalpi-finder__clear:hover { background: #d1d5db; }

.jalpi-finder__close-hint {
  flex-shrink: 0;
  background: #f3f4f6; border: 1px solid #e5e7eb;
  border-radius: 5px; padding: 2px 6px;
  font-size: 10px; font-weight: 700; color: #6b7280;
  font-family: var(--jalpi-font);
  letter-spacing: 0.04em;
}

/* Category tabs */
.jalpi-finder__tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.jalpi-finder__tabs::-webkit-scrollbar { display: none; }

.jalpi-finder__tab {
  padding: 4px 10px;
  border: none; border-radius: 6px;
  background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: var(--jalpi-font);
  color: #6b7280; white-space: nowrap;
  transition: background .1s, color .1s;
  flex-shrink: 0;
}
.jalpi-finder__tab:hover              { background: #f3f4f6; color: #374151; }
.jalpi-finder__tab.is-active          { background: #efefef; color: #000000; }

/* Results area */
.jalpi-finder__results {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.jalpi-finder__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 24px;
  font-size: 13px;
  color: #9ca3af;
  text-align: center;
}
.jalpi-finder__empty strong { color: #374151; }

.jalpi-finder__loading {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px 4px;
  font-size: 11px; color: #9ca3af;
}

/* Section */
.jalpi-finder__section { padding: 0 0 4px; }

.jalpi-finder__section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  padding: 8px 14px 3px;
}

/* Result item */
.jalpi-finder__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--jalpi-font);
  text-align: left;
  transition: background .08s;
}
.jalpi-finder__item:hover,
.jalpi-finder__item.is-focused { background: #f2f2f2; }

.jalpi-finder__item-icon {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: #f3f4f6; border-radius: 6px;
  color: #6b7280; flex-shrink: 0; font-size: 13px;
}
.jalpi-finder__item.is-focused .jalpi-finder__item-icon { background: #efefef; color: #000000; }

.jalpi-finder__item-body {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px;
}

.jalpi-finder__item-label {
  font-size: 13px; font-weight: 600; color: #111827;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.jalpi-finder__item-meta {
  font-size: 11px; color: #9ca3af;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.jalpi-finder__item-badge {
  background: #f3f4f6; border: 1px solid #e5e7eb;
  border-radius: 5px; padding: 2px 6px;
  font-size: 10px; font-weight: 700; color: #6b7280;
  font-family: var(--jalpi-font); flex-shrink: 0;
  white-space: nowrap;
}
.jalpi-finder__item.is-focused .jalpi-finder__item-badge { background: #efefef; border-color: #bbbbbb; color: #000000; }

.jalpi-finder__item-active { font-size: 10px; color: #1a1a1a; flex-shrink: 0; }

/* Footer */
.jalpi-finder__footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
  flex-shrink: 0;
  font-size: 11px;
  color: #9ca3af;
}

.jalpi-finder__footer kbd {
  background: #f3f4f6; border: 1px solid #e5e7eb;
  border-radius: 4px; padding: 1px 5px;
  font-size: 10px; font-weight: 700; color: #6b7280;
  font-family: var(--jalpi-font);
}

.jalpi-finder__footer-sep { flex: 1; }

.jalpi-finder__shortcut-hint {
  font-size: 11px; color: #bbbbbb; font-weight: 600;
}

/* ── Dynamic Tag Picker ──────────────────────────────────────────────────── */

.jalpi-field-with-tag {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.jalpi-field-with-tag .jalpi-input,
.jalpi-field-with-tag .jalpi-textarea {
  width: 100%;
}

/* Trigger button */
.jalpi-dyntag {
  position: relative;
}
.jalpi-dyntag__btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
  width:           22px;
  height:          22px;
  padding:         0;
  border:          1px solid var(--jalpi-border);
  border-radius:   4px;
  background:      var(--jalpi-surface);
  color:           var(--jalpi-text-muted);
  font-size:       11px;
  font-weight:     500;
  cursor:          pointer;
  transition:      background 0.1s, color 0.1s, border-color 0.1s;
  box-sizing:      border-box;
}
/* Hide the text label — keep only the icon */
.jalpi-dyntag__btn-label { display: none; }
.jalpi-dyntag__btn:hover,
.jalpi-dyntag__btn.is-open {
  background: var(--jalpi-accent);
  color: #fff;
  border-color: var(--jalpi-accent);
}

/* Popover */
.jalpi-dyntag__popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 9999;
  width: 260px;
  background: var(--jalpi-surface);
  border: 1px solid var(--jalpi-border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Search bar */
.jalpi-dyntag__search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--jalpi-border);
  background: var(--jalpi-bg);
}
.jalpi-dyntag__search svg { flex-shrink: 0; color: var(--jalpi-text-muted); }
.jalpi-dyntag__search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--jalpi-text);
  outline: none;
}
.jalpi-dyntag__search input::placeholder { color: var(--jalpi-text-muted); }

/* Scrollable list */
.jalpi-dyntag__body {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}
.jalpi-dyntag__state {
  padding: 20px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--jalpi-text-muted);
}

/* Group */
.jalpi-dyntag__group + .jalpi-dyntag__group { border-top: 1px solid var(--jalpi-border); }
.jalpi-dyntag__group-hd {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--jalpi-text-muted);
}

/* Item */
.jalpi-dyntag__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 10px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 8px;
}
.jalpi-dyntag__item:hover { background: var(--jalpi-hover); }
.jalpi-dyntag__item.is-active { background: color-mix(in srgb, var(--jalpi-accent) 12%, transparent); }
.jalpi-dyntag__item-lbl {
  font-size: 12px;
  color: var(--jalpi-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}
.jalpi-dyntag__item-code {
  font-size: 10px;
  font-family: var(--jalpi-mono, monospace);
  color: var(--jalpi-text-muted);
  background: var(--jalpi-hover);
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Footer (confirm + fallback + insert) */
.jalpi-dyntag__footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--jalpi-border);
  background: var(--jalpi-bg);
}
.jalpi-dyntag__footer-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.jalpi-dyntag__footer-preview code {
  font-size: 11px;
  font-family: var(--jalpi-mono, monospace);
  background: color-mix(in srgb, var(--jalpi-accent) 12%, transparent);
  color: var(--jalpi-accent);
  padding: 2px 5px;
  border-radius: 3px;
}
.jalpi-dyntag__footer-hint {
  font-size: 10px;
  color: var(--jalpi-text-muted);
}
.jalpi-dyntag__fallback {
  width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--jalpi-border);
  border-radius: 4px;
  font-size: 11px;
  background: var(--jalpi-surface);
  color: var(--jalpi-text);
  outline: none;
}
.jalpi-dyntag__fallback:focus { border-color: var(--jalpi-accent); }
.jalpi-dyntag__insert-btn {
  align-self: flex-end;
  padding: 4px 12px;
  background: var(--jalpi-accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.jalpi-dyntag__insert-btn:hover { opacity: .88; }

/* ── Form element — editor canvas preview ───────────────────────────────── */
.jalpi-form-canvas-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 16px 20px;
  background: #f5f5f5;
  border: 1.5px dashed #cccccc;
  border-radius: 8px;
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 500;
  user-select: none;
}
.jalpi-form-canvas-preview svg {
  color: #1a1a1a;
  opacity: .8;
}
.jalpi-form-canvas-preview strong {
  font-weight: 700;
}

/* ── Form element — properties panel ────────────────────────────────────── */
.jalpi-form-picker-loading,
.jalpi-form-picker-error {
  font-size: 11px;
  color: #6b7280;
  padding: 4px 0 8px;
  font-style: italic;
}
.jalpi-form-picker-error { color: #dc2626; font-style: normal; }

.jalpi-form-picker-notice {
  font-size: 11px;
  line-height: 1.6;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 2px;
}
.jalpi-form-picker-notice strong { font-weight: 600; }

.jalpi-form-picker-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  background: #f2f2f2;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 11px;
  color: #5b21b6;
  font-weight: 500;
}
.jalpi-form-picker-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1a1a1a;
  flex-shrink: 0;
}

/* ================================================================
   Section Picker Modal
   ================================================================ */
.jalpi-picker-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: jalpi-fade-in .12s ease;
}

@keyframes jalpi-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.jalpi-picker-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
  width: 520px;
  max-width: 96vw;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: jalpi-slide-up .15s ease;
}

@keyframes jalpi-slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.jalpi-picker-modal__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f1f1;
  flex-shrink: 0;
}

.jalpi-picker-modal__title {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
  flex: 1;
}

.jalpi-picker-modal__back {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .1s;
}
.jalpi-picker-modal__back:hover { background: #f0f0ff; }

.jalpi-picker-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .1s, background .1s;
}
.jalpi-picker-modal__close:hover { color: #1a1a1a; background: #f3f4f6; }

/* Section Picker root step */
.jalpi-section-picker__cards {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jalpi-section-picker__card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: #fafafa;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .1s;
  text-align: left;
  width: 100%;
}
.jalpi-section-picker__card:hover {
  border-color: #1a1a1a;
  background: #f5f5f5;
  transform: translateY(-1px);
}

.jalpi-section-picker__card-icon {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.jalpi-section-picker__card-icon--container {
  background: #efefef;
  color: #1a1a1a;
}
.jalpi-section-picker__card-icon--elements {
  background: #dcfce7;
  color: #10b981;
}

.jalpi-section-picker__card-body { flex: 1; }
.jalpi-section-picker__card-title {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
  margin-bottom: 2px;
}
.jalpi-section-picker__card-desc {
  font-size: 12px;
  color: #6b7280;
}
.jalpi-section-picker__card-arrow { color: #9ca3af; flex-shrink: 0; }

.jalpi-section-picker__elements { display: flex; flex-direction: column; }
.jalpi-section-picker__elements .jalpi-block-picker { border: none; box-shadow: none; border-radius: 0; }

/* Container Picker */
.jalpi-container-picker { display: flex; flex-direction: column; }

.jalpi-container-picker__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 20px;
}

.jalpi-container-picker__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px 12px;
  background: #fafafa;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .1s;
}
.jalpi-container-picker__card:hover {
  border-color: #1a1a1a;
  background: #f5f5f5;
  transform: translateY(-2px);
}

.jalpi-container-picker__preview { display: flex; align-items: center; justify-content: center; }
.jalpi-container-picker__label { font-weight: 600; font-size: 12px; color: #1a1a1a; }
.jalpi-container-picker__desc  { font-size: 11px; color: #6b7280; text-align: center; }

/* ================================================================
   Context Menu
   ================================================================ */
.jalpi-ctx-menu {
  position: fixed;
  z-index: 10000;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.06);
  min-width: 210px;
  padding: 4px 0;
  animation: jalpi-fade-in .08s ease;
  user-select: none;
}

.jalpi-ctx-menu__header {
  padding: 7px 14px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 3px;
}

.jalpi-ctx-menu__sep {
  height: 1px;
  background: #f3f4f6;
  margin: 3px 0;
}

.jalpi-ctx-menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--jalpi-font);
  color: #374151;
  text-align: left;
  transition: background .07s, color .07s;
}
.jalpi-ctx-menu__item:hover:not(.is-disabled),
.jalpi-ctx-menu__item.is-focused:not(.is-disabled) { background: #f2f2f2; color: #000000; }
.jalpi-ctx-menu__item.is-danger                     { color: #ef4444; }
.jalpi-ctx-menu__item.is-danger:hover:not(.is-disabled),
.jalpi-ctx-menu__item.is-danger.is-focused:not(.is-disabled) { background: #fff1f2; color: #dc2626; }
.jalpi-ctx-menu__item.is-disabled { opacity: .38; cursor: not-allowed; }

.jalpi-ctx-menu__icon  { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #6b7280; }
.jalpi-ctx-menu__item:hover:not(.is-disabled)   .jalpi-ctx-menu__icon,
.jalpi-ctx-menu__item.is-focused:not(.is-disabled) .jalpi-ctx-menu__icon { color: #000000; }
.jalpi-ctx-menu__item.is-danger .jalpi-ctx-menu__icon { color: #ef4444; }
.jalpi-ctx-menu__item.is-danger:hover:not(.is-disabled) .jalpi-ctx-menu__icon { color: #dc2626; }
.jalpi-ctx-menu__label { flex: 1; font-weight: 500; }

kbd.jalpi-ctx-menu__shortcut {
  font-size: 10px;
  font-family: monospace;
  color: #9ca3af;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.5;
  flex-shrink: 0;
}

/* ── Save as Template inline form ─────────────────────────────────────────── */

.jalpi-ctx-menu__save {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.jalpi-ctx-menu__save-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #374151;
}

.jalpi-ctx-menu__save-input {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--jalpi-font);
  color: #111827;
  outline: none;
  box-sizing: border-box;
  transition: border-color .12s;
}
.jalpi-ctx-menu__save-input:focus { border-color: #1a1a1a; }

.jalpi-ctx-menu__save-err {
  font-size: 11px;
  color: #ef4444;
  margin-top: -2px;
}

.jalpi-ctx-menu__save-row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.jalpi-ctx-menu__save-cancel,
.jalpi-ctx-menu__save-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--jalpi-font);
  cursor: pointer;
  border: none;
  transition: background .1s, opacity .1s;
}

.jalpi-ctx-menu__save-cancel {
  background: #f3f4f6;
  color: #6b7280;
}
.jalpi-ctx-menu__save-cancel:hover { background: #e5e7eb; color: #374151; }

.jalpi-ctx-menu__save-btn {
  background: #1a1a1a;
  color: #fff;
}
.jalpi-ctx-menu__save-btn:hover:not(:disabled) { background: #000000; }
.jalpi-ctx-menu__save-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ================================================================
   Command Palette
   ================================================================ */
.jalpi-cmd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 10001;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.jalpi-cmd-palette {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
  width: 580px;
  max-width: 94vw;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: jalpi-slide-up .14s ease;
}

.jalpi-cmd-palette__search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid #f1f1f1;
  flex-shrink: 0;
}

.jalpi-cmd-palette__input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: #1a1a1a;
  background: transparent;
}
.jalpi-cmd-palette__input::placeholder { color: #9ca3af; }

.jalpi-cmd-palette__hint {
  font-size: 11px;
  color: #9ca3af;
  background: #f3f4f6;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.jalpi-cmd-palette__results {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.jalpi-cmd-palette__group { margin-bottom: 4px; }

.jalpi-cmd-palette__group-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 4px 16px 2px;
}

.jalpi-cmd-palette__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  color: #374151;
  text-align: left;
  transition: background .07s;
}
.jalpi-cmd-palette__item.is-focused,
.jalpi-cmd-palette__item:hover { background: #f2f2f2; color: #000000; }

.jalpi-cmd-palette__item-icon    { font-size: 15px; width: 22px; text-align: center; flex-shrink: 0; }
.jalpi-cmd-palette__item-label   { flex: 1; }
.jalpi-cmd-palette__item-shortcut {
  font-size: 11px; color: #9ca3af; font-family: monospace;
  background: #f3f4f6; padding: 1px 6px; border-radius: 4px;
}
.jalpi-cmd-palette__empty { padding: 24px 20px; text-align: center; color: #9ca3af; font-size: 13px; }

/* ================================================================
   Empty Canvas hint
   ================================================================ */
.jalpi-canvas__empty-hint {
  margin-top: 20px;
  font-size:  12px;
  color:      #9ca3af;
}
.jalpi-canvas__empty-hint kbd {
  background:    #f3f4f6;
  border:        1px solid #d1d5db;
  border-radius: 4px;
  padding:       1px 6px;
  font-size:     11px;
  font-family: monospace;
}

/* =========================================================
   TopBar — icon button (toggle, undo/redo, eye, 3-dot)
   ========================================================= */

.jalpi-topbar__icon-btn {
  background:      transparent;
  border:          none;
  color:           var(--jalpi-topbar-muted);
  cursor:          pointer;
  width:           30px;
  height:          30px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  border-radius:   var(--jalpi-radius-sm);
  transition:      all 0.15s;
  flex-shrink:     0;
}

.jalpi-topbar__icon-btn:hover:not(:disabled) {
  color:      var(--jalpi-topbar-text);
  background: #f3f4f6;
}

.jalpi-topbar__icon-btn.is-active {
  color:      var(--jalpi-accent);
  background: rgba(var(--jalpi-accent-rgb), 0.09);
}

.jalpi-topbar__icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Page title area */
.jalpi-topbar__page-title {
  display:     flex;
  align-items: center;
  gap:         4px;
  cursor:      default;
}

.jalpi-topbar__title-caret {
  color:      var(--jalpi-topbar-muted);
  display:    flex;
  align-items: center;
  opacity:    0.6;
}

/* Zoom cluster */
.jalpi-topbar__zoom-wrap {
  display:     flex;
  align-items: center;
  gap:         2px;
}

/* =========================================================
   Elements Panel — left sidebar
   ========================================================= */

.jalpi-elements-panel {
  flex-shrink:    0;
  background:     var(--jalpi-surface);
  border-right:   1px solid var(--jalpi-border);
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
  height:         100%;
}

/* ── Header ── */
.jalpi-elements-panel__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         10px 12px 8px;
  flex-shrink:     0;
  border-bottom:   1px solid var(--jalpi-border);
}

.jalpi-elements-panel__title {
  font-size:      13px;
  font-weight:    700;
  color:          var(--jalpi-text);
  letter-spacing: 0;
}

.jalpi-elements-panel__close {
  background:      transparent;
  border:          none;
  color:           var(--jalpi-text-dim);
  cursor:          pointer;
  width:           22px;
  height:          22px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  border-radius:   4px;
  transition:      all 0.12s;
  padding:         0;
}

.jalpi-elements-panel__close:hover {
  background: var(--jalpi-surface-3);
  color:      var(--jalpi-text);
}

/* ── Search ── */
.jalpi-elements-panel__search {
  display:       flex;
  align-items:   center;
  gap:           6px;
  margin:        8px 10px 6px;
  padding:       6px 8px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius);
  flex-shrink:   0;
  transition:    border-color 0.15s;
}

.jalpi-elements-panel__search:focus-within {
  border-color: rgba(var(--jalpi-accent-rgb), 0.45);
}

.jalpi-elements-panel__search-icon { color: var(--jalpi-text-dim); flex-shrink: 0; }

.jalpi-elements-panel__search-input {
  flex:        1;
  border:      none;
  background:  transparent;
  color:       var(--jalpi-text);
  font-size:   12px;
  outline:     none;
  font-family: var(--jalpi-font);
  min-width:   0;
}

.jalpi-elements-panel__search-input::placeholder { color: var(--jalpi-text-dim); }

.jalpi-elements-panel__search-clear {
  background:      transparent;
  border:          none;
  color:           var(--jalpi-text-dim);
  cursor:          pointer;
  width:           16px;
  height:          16px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  border-radius:   3px;
  flex-shrink:     0;
  padding:         0;
  transition:      color 0.12s;
}

.jalpi-elements-panel__search-clear:hover { color: var(--jalpi-text); }

/* ── Category tabs ── */
/* ── View switch: All / Favorites / Recent ── */
.jalpi-elements-panel__views {
  display:      flex;
  gap:          4px;
  padding:      2px 12px 8px;
  flex-shrink:  0;
}

.jalpi-elements-view {
  display:        inline-flex;
  align-items:    center;
  justify-content:center;
  gap:            5px;
  flex:           1;
  background:     transparent;
  border:         none;
  border-radius:  var(--jalpi-radius-sm);
  color:          var(--jalpi-text-dim);
  cursor:         pointer;
  font-size:      12px;
  font-weight:    600;
  padding:        6px 8px;
  transition:     all 0.12s;
  font-family:    var(--jalpi-font);
  position:       relative;
}

.jalpi-elements-view:hover { color: var(--jalpi-text); }

.jalpi-elements-view.is-active {
  color: var(--jalpi-accent);
}

.jalpi-elements-view.is-active::after {
  content:       "";
  position:      absolute;
  left:          10px; right: 10px; bottom: -1px;
  height:        2px;
  border-radius: 2px;
  background:    var(--jalpi-accent);
}

/* ── Category accordion ── */
.jalpi-elements-group__head {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  width:           100%;
  background:      transparent;
  border:          none;
  cursor:          pointer;
  padding:         10px 2px 8px;
  font-family:     var(--jalpi-font);
}

.jalpi-elements-group__chevron {
  color:      var(--jalpi-text-dim);
  transition: transform 0.18s ease;
}
.jalpi-elements-group__chevron.is-open { transform: rotate(180deg); }

/* the favorite star on each card */
.jalpi-elements-item { position: relative; }
.jalpi-elements-item__fav {
  position:     absolute;
  top:          4px;
  right:        5px;
  display:      inline-flex;
  color:        var(--jalpi-text-dim);
  opacity:      0;
  transition:   opacity 0.12s, color 0.12s, transform 0.12s;
  cursor:       pointer;
  line-height:  0;
}
.jalpi-elements-item:hover .jalpi-elements-item__fav { opacity: 0.55; }
.jalpi-elements-item__fav:hover { opacity: 1 !important; transform: scale(1.18); }
.jalpi-elements-item__fav.is-fav { opacity: 1; color: #f59e0b; }

/* ── Scrollable item list ── */
.jalpi-elements-panel__list {
  flex:            1;
  overflow-y:      auto;
  overflow-x:      hidden;
  padding:         4px 10px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--jalpi-border-2) transparent;
}

.jalpi-elements-panel__list::-webkit-scrollbar { width: 3px; }
.jalpi-elements-panel__list::-webkit-scrollbar-track { background: transparent; }
.jalpi-elements-panel__list::-webkit-scrollbar-thumb { background: var(--jalpi-border-2); border-radius: 2px; }

.jalpi-elements-panel__empty {
  padding:    24px 12px;
  text-align: center;
  font-size:  12px;
  color:      var(--jalpi-text-muted);
}

/* ── Element grid + accordion group ── */
.jalpi-elements-group {
  padding:       0 12px;
  border-bottom: 1px solid var(--jalpi-border);
}
.jalpi-elements-group:last-child { border-bottom: none; }

.jalpi-elements-group__title {
  font-size:      11px;
  font-weight:    800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color:          var(--jalpi-text-dim);
}
/* the grid sits under an open accordion head with a little breathing room */
.jalpi-elements-group .jalpi-elements-group__grid { padding-bottom: 10px; }

.jalpi-elements-group__grid {
  display:               grid;
  grid-template-columns: repeat(2, 1fr);
  gap:                   5px;
}

/* Each element item */
.jalpi-elements-item {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             7px;
  padding:         14px 4px 12px;
  background:      var(--jalpi-surface-2);
  border:          1px solid var(--jalpi-border);
  border-radius:   var(--jalpi-radius);
  cursor:          pointer;
  transition:      all 0.13s;
  font-family:     var(--jalpi-font);
  width:           100%;
  min-height:      70px;
}

.jalpi-elements-item:hover {
  border-color: var(--el-color, rgba(var(--jalpi-accent-rgb), 0.4));
  background:   rgba(var(--jalpi-accent-rgb), 0.04);
  transform:    translateY(-1px);
  box-shadow:   0 2px 6px rgba(0,0,0,0.08);
}

.jalpi-elements-item[draggable="true"] { cursor: grab; }
.jalpi-elements-item[draggable="true"]:active { cursor: grabbing; }

.jalpi-elements-item--dragging {
  opacity:      0.45;
  border-color: var(--el-color, var(--jalpi-accent)) !important;
  transform:    scale(0.95) !important;
}

.jalpi-elements-item__icon {
  font-size:   21px;
  line-height: 1;
  color:       var(--el-color, var(--jalpi-accent));
}

.jalpi-elements-item__label {
  font-size:   11px;
  font-weight: 600;
  color:       var(--jalpi-text-muted);
  text-align:  center;
  line-height: 1.2;
}

/* ── Footer toolbar ── */
.jalpi-elements-panel__footer {
  display:         flex;
  align-items:     center;
  gap:             2px;
  padding:         6px 8px;
  border-top:      1px solid var(--jalpi-border);
  flex-shrink:     0;
  background:      var(--jalpi-surface-2);
}

.jalpi-elements-panel__footer-btn {
  display:         flex;
  align-items:     center;
  gap:             5px;
  background:      transparent;
  border:          none;
  color:           var(--jalpi-text-dim);
  cursor:          pointer;
  padding:         5px 8px;
  border-radius:   var(--jalpi-radius-sm);
  transition:      all 0.12s;
  text-decoration: none;
  font-size:       11px;
  font-family:     var(--jalpi-font);
  font-weight:     500;
  flex:            1;
  justify-content: center;
}

.jalpi-elements-panel__footer-btn:hover {
  color:      var(--jalpi-text);
  background: var(--jalpi-surface-3);
}

/* =========================================================
   Quick Insert Bar — bottom of canvas area
   ========================================================= */

.jalpi-quick-insert {
  display:       flex;
  align-items:   center;
  gap:           8px;
  height:        48px;
  flex-shrink:   0;
  background:    var(--jalpi-surface);
  border-top:    1px solid var(--jalpi-border);
  padding:       0 16px;
  overflow-x:    auto;
  scrollbar-width: none;
}

.jalpi-quick-insert::-webkit-scrollbar { display: none; }

.jalpi-quick-insert__label {
  font-size:      9px;
  font-weight:    800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color:          var(--jalpi-text-dim);
  white-space:    nowrap;
  flex-shrink:    0;
}

.jalpi-quick-insert__items {
  display:     flex;
  align-items: center;
  gap:         4px;
}

.jalpi-quick-insert__btn {
  display:         flex;
  align-items:     center;
  gap:             5px;
  padding:         5px 10px;
  background:      var(--jalpi-surface-2);
  border:          1px solid var(--jalpi-border-2);
  border-radius:   var(--jalpi-radius);
  cursor:          pointer;
  white-space:     nowrap;
  font-family:     var(--jalpi-font);
  transition:      all 0.14s;
  flex-shrink:     0;
}

.jalpi-quick-insert__btn:hover {
  border-color: rgba(var(--jalpi-accent-rgb), 0.45);
  background:   rgba(var(--jalpi-accent-rgb), 0.06);
  color:        var(--jalpi-accent);
}

.jalpi-quick-insert__icon {
  font-size:   13px;
  line-height: 1;
  color:       var(--jalpi-text-muted);
}

.jalpi-quick-insert__text {
  font-size:  11px;
  font-weight: 600;
  color:      var(--jalpi-text-muted);
}

.jalpi-quick-insert__btn:hover .jalpi-quick-insert__icon,
.jalpi-quick-insert__btn:hover .jalpi-quick-insert__text { color: inherit; }

/* =========================================================
   Quick Actions — inspector footer
   ========================================================= */

.jalpi-quick-actions {
  flex-shrink:    0;
  background:     var(--jalpi-surface);
  border-top:     1px solid var(--jalpi-border);
  padding:        10px 12px 12px;
}

.jalpi-quick-actions__title {
  font-size:      9px;
  font-weight:    800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color:          var(--jalpi-text-dim);
  margin-bottom:  8px;
}

.jalpi-quick-actions__btns {
  display: flex;
  gap:     6px;
}

.jalpi-quick-actions__btn {
  flex:            1;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             4px;
  padding:         8px 6px;
  background:      var(--jalpi-surface-2);
  border:          1px solid var(--jalpi-border-2);
  border-radius:   var(--jalpi-radius);
  cursor:          pointer;
  font-family:     var(--jalpi-font);
  transition:      all 0.14s;
  color:           var(--jalpi-text-muted);
}

.jalpi-quick-actions__btn span { font-size: 10px; font-weight: 600; }

.jalpi-quick-actions__btn:hover {
  background:   var(--jalpi-surface-3);
  border-color: var(--jalpi-border-3);
  color:        var(--jalpi-text);
}

.jalpi-quick-actions__btn--danger:hover {
  background:   rgba(220,38,38,0.06);
  border-color: rgba(220,38,38,0.25);
  color:        var(--jalpi-danger);
}

/* =========================================================
   Page Panel — inspector PAGE tab
   ========================================================= */

.jalpi-page-panel {
  padding: 16px 12px;
}

.jalpi-page-panel__section {
  margin-bottom: 14px;
}

/* =========================================================
   Quick-Add Popover  (.jalpi-qadd)
   Replaces the modal SectionPicker with a compact inline
   dropdown anchored below the "Add Content" trigger.
   ========================================================= */

.jalpi-sab-trigger-wrap {
  position: relative;
  z-index:  1;
  display:  inline-flex;
}

/* ── Between-section trigger (hidden until hover) ────────── */
.jalpi-sab-trigger {
  display:        flex;
  align-items:    center;
  gap:            6px;
  padding:        5px 16px;
  background:     #ffffff;
  border:         1px solid #e5e7eb;
  border-radius:  999px;
  cursor:         pointer;
  font-size:      11px;
  font-weight:    700;
  color:          #9ca3af;
  letter-spacing: 0.02em;
  white-space:    nowrap;
  box-shadow:     0 1px 4px rgba(15,23,42,0.07);
  font-family:    var(--jalpi-font);
  opacity:        0;
  transition:     opacity 0.15s, border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}

.jalpi-section-group:hover .jalpi-sab-trigger,
.jalpi-sab-trigger.is-active { opacity: 1; }

.jalpi-sab-trigger:hover,
.jalpi-sab-trigger.is-active {
  border-color: rgba(var(--jalpi-accent-rgb), 0.5);
  color:        var(--jalpi-accent);
  box-shadow:   0 2px 12px rgba(var(--jalpi-accent-rgb), 0.14);
}

/* ── Sticky footer trigger — always visible, accent pill ─── */
.jalpi-sab-trigger--sticky {
  opacity:      1 !important;
  background:   var(--jalpi-accent);
  color:        #ffffff !important;
  border-color: var(--jalpi-accent) !important;
  padding:      8px 22px;
  font-size:    12px;
  box-shadow:   0 2px 10px rgba(var(--jalpi-accent-rgb), 0.3);
}

.jalpi-sab-trigger--sticky:hover {
  background:   color-mix(in srgb, var(--jalpi-accent) 85%, #000);
  box-shadow:   0 4px 18px rgba(var(--jalpi-accent-rgb), 0.4);
  transform:    translateY(-1px);
}

.jalpi-sab-trigger--sticky.is-active {
  background:   color-mix(in srgb, var(--jalpi-accent) 80%, #000) !important;
  transform:    none;
}

/* ── Popover panel ─────────────────────────────────────────── */

.jalpi-qadd {
  position:      absolute;
  top:           calc(100% + 8px);
  left:          50%;
  transform:     translateX(-50%);
  z-index:       2000;
  background:    #ffffff;
  border:        1px solid rgba(15,23,42,0.1);
  border-radius: 14px;
  box-shadow:    0 12px 40px rgba(15,23,42,0.16), 0 2px 8px rgba(15,23,42,0.06);
  width:         276px;
  overflow:      hidden;
  animation:     jalpi-qadd-in 0.15s ease;
}

/* Opens upward (sticky footer) */
.jalpi-qadd--up {
  top:    auto;
  bottom: calc(100% + 10px);
  animation: jalpi-qadd-in-up 0.15s ease;
}

@keyframes jalpi-qadd-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1); }
}

@keyframes jalpi-qadd-in-up {
  from { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.97); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)   scale(1); }
}

/* ── Panel heading ─────────────────────────────────────────── */

.jalpi-qadd__heading {
  padding:        10px 14px 8px;
  font-size:      10px;
  font-weight:    800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color:          #9ca3af;
  border-bottom:  1px solid #f3f4f6;
}

/* ── Layout card grid ──────────────────────────────────────── */

.jalpi-qadd__grid {
  display:               grid;
  grid-template-columns: repeat(3, 1fr);
  gap:                   6px;
  padding:               10px;
}

.jalpi-qadd__card {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             6px;
  padding:         10px 6px 8px;
  background:      #f9fafb;
  border:          1.5px solid #e5e7eb;
  border-radius:   10px;
  cursor:          pointer;
  transition:      all 0.13s;
  font-family:     var(--jalpi-font);
}

.jalpi-qadd__card:hover {
  background:   rgba(var(--jalpi-accent-rgb), 0.05);
  border-color: rgba(var(--jalpi-accent-rgb), 0.35);
  transform:    translateY(-2px);
  box-shadow:   0 4px 12px rgba(var(--jalpi-accent-rgb), 0.12);
}

.jalpi-qadd__card-preview { line-height: 1; flex-shrink: 0; }

.jalpi-qadd__card-label {
  font-size:   9.5px;
  font-weight: 600;
  color:       #6b7280;
  text-align:  center;
  line-height: 1.2;
}

.jalpi-qadd__card:hover .jalpi-qadd__card-label { color: var(--jalpi-accent); }

/* ── Footer: browse templates ──────────────────────────────── */

.jalpi-qadd__footer {
  padding:    8px 10px 10px;
  border-top: 1px solid #f3f4f6;
}

.jalpi-qadd__tpl-btn {
  display:         flex;
  align-items:     center;
  gap:             8px;
  width:           100%;
  padding:         8px 12px;
  background:      transparent;
  border:          1.5px dashed #e5e7eb;
  border-radius:   8px;
  cursor:          pointer;
  font-size:       12px;
  font-weight:     500;
  color:           #6b7280;
  font-family:     var(--jalpi-font);
  transition:      all 0.13s;
}

.jalpi-qadd__tpl-btn:hover {
  background:   rgba(var(--jalpi-accent-rgb), 0.04);
  border-color: rgba(var(--jalpi-accent-rgb), 0.35);
  border-style: solid;
  color:        var(--jalpi-accent);
}

/* =========================================================
   Section inline quick-actions  (.jalpi-section-qactions)
   Shown at the bottom of a selected section node.
   ========================================================= */

.jalpi-section-qactions {
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-wrap:       wrap;
  gap:             5px;
  padding:         8px 16px;
  background:      rgba(var(--jalpi-accent-rgb), 0.03);
  border-top:      1px dashed rgba(var(--jalpi-accent-rgb), 0.15);
}

.jalpi-section-qaction {
  display:       flex;
  align-items:   center;
  gap:           5px;
  padding:       4px 11px;
  background:    #ffffff;
  border:        1px solid #e5e7eb;
  border-radius: 6px;
  cursor:        pointer;
  font-size:     11px;
  font-weight:   600;
  color:         #6b7280;
  white-space:   nowrap;
  line-height:   1.6;
  font-family:   var(--jalpi-font);
  transition:    all 0.14s;
}

.jalpi-section-qaction svg { flex-shrink: 0; opacity: 0.65; transition: opacity 0.12s; }

.jalpi-section-qaction:hover {
  border-color: rgba(var(--jalpi-accent-rgb), 0.4);
  color:        var(--jalpi-accent);
  background:   rgba(var(--jalpi-accent-rgb), 0.04);
  box-shadow:   0 1px 6px rgba(var(--jalpi-accent-rgb), 0.1);
}

.jalpi-section-qaction:hover svg,
.jalpi-section-qaction:focus-visible svg { opacity: 1; }

.jalpi-section-qaction:focus-visible {
  outline:      2px solid var(--jalpi-accent);
  outline-offset: 1px;
}

.jalpi-section-qaction--danger:hover {
  border-color: rgba(220,38,38,0.4);
  color:        #dc2626;
  background:   rgba(220,38,38,0.04);
  box-shadow:   0 1px 6px rgba(220,38,38,0.08);
}

/* Element popup anchored above the "Element" quick-action button */
.jalpi-sqaction-elem-wrap { position: relative; }

.jalpi-sqaction-popup {
  position:  absolute;
  bottom:    calc(100% + 8px);
  left:      50%;
  transform: translateX(-50%);
  z-index:   1000;
  filter:    drop-shadow(0 6px 20px rgba(15,23,42,0.14));
}

.jalpi-page-panel__label {
  font-size:      9px;
  font-weight:    800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color:          var(--jalpi-text-dim);
  margin-bottom:  4px;
}

.jalpi-page-panel__value {
  font-size:     13px;
  font-weight:   500;
  color:         var(--jalpi-text);
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border);
  border-radius: var(--jalpi-radius-sm);
  padding:       6px 10px;
}

.jalpi-page-panel__hint {
  font-size:   11px;
  color:       var(--jalpi-text-muted);
  line-height: 1.5;
  padding:     8px 10px;
  background:  rgba(var(--jalpi-accent-rgb), 0.05);
  border-left: 2px solid var(--jalpi-accent);
  border-radius: 0 var(--jalpi-radius-sm) var(--jalpi-radius-sm) 0;
  margin-top:  4px;
}

/* =========================================================
   Template Library Modal  (.jalpi-tpl-*)
   ========================================================= */

.jalpi-tpl-backdrop {
  position:        fixed;
  inset:           0;
  background:      rgba(15,23,42,0.52);
  backdrop-filter: blur(4px);
  z-index:         9000;
  display:         flex;
  align-items:     center;
  justify-content: center;
  padding:         20px;
  animation:       jalpi-tpl-fade 0.18s ease both;
}

@keyframes jalpi-tpl-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.jalpi-tpl-modal {
  background:     #ffffff;
  border-radius:  16px;
  box-shadow:     0 28px 80px rgba(15,23,42,0.22), 0 4px 16px rgba(15,23,42,0.10);
  width:          100%;
  max-width:      960px;
  max-height:     86vh;
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
  animation:      jalpi-tpl-in 0.2s ease both;
}

@keyframes jalpi-tpl-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Header ── */
.jalpi-tpl-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         15px 20px;
  border-bottom:   1px solid #f3f4f6;
  flex-shrink:     0;
  gap:             12px;
}

.jalpi-tpl-header__left {
  display:     flex;
  align-items: center;
  gap:         9px;
  color:       var(--jalpi-accent);
  flex-shrink: 0;
}

.jalpi-tpl-title {
  font-size:   16px;
  font-weight: 800;
  color:       #111827;
  white-space: nowrap;
}

.jalpi-tpl-header__right {
  display:         flex;
  align-items:     center;
  gap:             8px;
  flex:            1;
  justify-content: flex-end;
}

/* Search bar */
.jalpi-tpl-search {
  display:       flex;
  align-items:   center;
  gap:           7px;
  padding:       7px 11px;
  background:    #f9fafb;
  border:        1px solid #e5e7eb;
  border-radius: 8px;
  width:         260px;
  transition:    border-color 0.14s, box-shadow 0.14s, background 0.14s;
}

.jalpi-tpl-search:focus-within {
  border-color: rgba(var(--jalpi-accent-rgb), 0.5);
  box-shadow:   0 0 0 3px rgba(var(--jalpi-accent-rgb), 0.08);
  background:   #fff;
}

.jalpi-tpl-search svg { color: #9ca3af; flex-shrink: 0; }

.jalpi-tpl-search__input {
  flex:        1;
  border:      none;
  background:  transparent;
  font-size:   13px;
  color:       #111827;
  font-family: var(--jalpi-font);
  outline:     none;
  min-width:   0;
}

.jalpi-tpl-search__input::placeholder { color: #9ca3af; }

.jalpi-tpl-search__clear {
  display:       flex;
  align-items:   center;
  background:    transparent;
  border:        none;
  cursor:        pointer;
  padding:       2px;
  color:         #9ca3af;
  border-radius: 3px;
  line-height:   1;
  transition:    color 0.1s;
}

.jalpi-tpl-search__clear:hover { color: #374151; }

/* Import button */
.jalpi-tpl-import-btn {
  display:       flex;
  align-items:   center;
  gap:           6px;
  padding:       7px 13px;
  background:    #f9fafb;
  border:        1px solid #e5e7eb;
  border-radius: 8px;
  cursor:        pointer;
  font-size:     12px;
  font-weight:   600;
  color:         #374151;
  font-family:   var(--jalpi-font);
  white-space:   nowrap;
  transition:    all 0.14s;
}

.jalpi-tpl-import-btn:hover {
  border-color: rgba(var(--jalpi-accent-rgb), 0.4);
  color:        var(--jalpi-accent);
  background:   rgba(var(--jalpi-accent-rgb), 0.04);
}

/* Close button */
.jalpi-tpl-close {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           32px;
  height:          32px;
  background:      transparent;
  border:          none;
  border-radius:   8px;
  cursor:          pointer;
  color:           #9ca3af;
  flex-shrink:     0;
  transition:      all 0.12s;
}

.jalpi-tpl-close:hover { background: #f3f4f6; color: #374151; }

/* ── Category tabs ── */
.jalpi-tpl-cats {
  display:         flex;
  align-items:     center;
  gap:             3px;
  padding:         10px 20px;
  border-bottom:   1px solid #f3f4f6;
  flex-shrink:     0;
  overflow-x:      auto;
  scrollbar-width: none;
}

.jalpi-tpl-cats::-webkit-scrollbar { display: none; }

.jalpi-tpl-cat {
  padding:       5px 13px;
  background:    transparent;
  border:        1px solid transparent;
  border-radius: 20px;
  cursor:        pointer;
  font-size:     12px;
  font-weight:   600;
  color:         #6b7280;
  font-family:   var(--jalpi-font);
  white-space:   nowrap;
  transition:    all 0.12s;
  flex-shrink:   0;
}

.jalpi-tpl-cat:hover { background: #f3f4f6; color: #374151; }

.jalpi-tpl-cat.is-active {
  background:   rgba(var(--jalpi-accent-rgb), 0.09);
  border-color: rgba(var(--jalpi-accent-rgb), 0.2);
  color:        var(--jalpi-accent);
}

/* ── Body ── */
.jalpi-tpl-body {
  flex:       1;
  overflow-y: auto;
  padding:    20px;
}

/* Template grid */
.jalpi-tpl-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap:                   16px;
}

/* Template card */
.jalpi-tpl-card {
  display:        flex;
  flex-direction: column;
  background:     #fff;
  border:         1.5px solid #e5e7eb;
  border-radius:  10px;
  overflow:       hidden;
  cursor:         pointer;
  text-align:     left;
  font-family:    var(--jalpi-font);
  padding:        0;
  transition:     all 0.16s;
}

.jalpi-tpl-card:hover:not(:disabled) {
  border-color: rgba(var(--jalpi-accent-rgb), 0.4);
  box-shadow:   0 6px 24px rgba(var(--jalpi-accent-rgb), 0.12);
  transform:    translateY(-2px);
}

.jalpi-tpl-card.is-applying { opacity: 0.7; }
.jalpi-tpl-card:disabled    { cursor: default; }

/* Card thumbnail */
.jalpi-tpl-card__thumb {
  position:     relative;
  width:        100%;
  aspect-ratio: 16 / 10;
  background:   #f9fafb;
  overflow:     hidden;
}

.jalpi-tpl-card__thumb img {
  width:      100%;
  height:     100%;
  object-fit: cover;
  display:    block;
}

.jalpi-tpl-card__placeholder {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           100%;
  height:          100%;
  background:      linear-gradient(135deg, #f5f5f5 0%, #fafafa 100%);
}

/* "Use Template" hover overlay */
.jalpi-tpl-card__hover {
  position:        absolute;
  inset:           0;
  background:      rgba(var(--jalpi-accent-rgb), 0.86);
  display:         flex;
  align-items:     center;
  justify-content: center;
  opacity:         0;
  transition:      opacity 0.15s;
}

.jalpi-tpl-card:hover .jalpi-tpl-card__hover { opacity: 1; }

.jalpi-tpl-card__hover span {
  color:       #fff;
  font-size:   13px;
  font-weight: 700;
  font-family: var(--jalpi-font);
  letter-spacing: 0.01em;
}

/* Applying spinner overlay */
.jalpi-tpl-card__applying {
  position:        absolute;
  inset:           0;
  background:      rgba(255,255,255,0.82);
  display:         flex;
  align-items:     center;
  justify-content: center;
}

.jalpi-tpl-spinner {
  width:        22px;
  height:       22px;
  border:       3px solid rgba(var(--jalpi-accent-rgb), 0.2);
  border-top-color: var(--jalpi-accent);
  border-radius: 50%;
  animation:    jalpi-tpl-spin 0.65s linear infinite;
}

@keyframes jalpi-tpl-spin { to { transform: rotate(360deg); } }

/* Card meta */
.jalpi-tpl-card__meta {
  padding:    10px 12px 11px;
  border-top: 1px solid #f3f4f6;
}

.jalpi-tpl-card__name {
  display:       block;
  font-size:     13px;
  font-weight:   600;
  color:         #111827;
  line-height:   1.3;
  margin-bottom: 3px;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.jalpi-tpl-card__cat {
  display:     block;
  font-size:   11px;
  color:       #9ca3af;
  font-weight: 500;
}

/* Loading skeleton shimmer */
.jalpi-tpl-skeleton {
  height:          168px;
  border-radius:   10px;
  background:      linear-gradient(90deg, #f3f4f6 0%, #e9eaec 50%, #f3f4f6 100%);
  background-size: 200% 100%;
  animation:       jalpi-tpl-shimmer 1.4s ease infinite;
}

@keyframes jalpi-tpl-shimmer {
  from { background-position:  200% 0; }
  to   { background-position: -200% 0; }
}

/* Empty / error state */
.jalpi-tpl-state {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  padding:         52px 20px;
  text-align:      center;
  gap:             6px;
}

.jalpi-tpl-state__illo { margin-bottom: 8px; opacity: 0.9; }

.jalpi-tpl-state__title {
  font-size:   16px;
  font-weight: 700;
  color:       #374151;
  margin:      0;
}

.jalpi-tpl-state__body {
  font-size:   13px;
  color:       #9ca3af;
  margin:      0 0 16px;
  max-width:   360px;
  line-height: 1.65;
}

.jalpi-tpl-import-cta {
  display:       flex;
  align-items:   center;
  gap:           7px;
  padding:       9px 20px;
  background:    var(--jalpi-accent);
  border:        none;
  border-radius: 8px;
  cursor:        pointer;
  font-size:     13px;
  font-weight:   700;
  color:         #fff;
  font-family:   var(--jalpi-font);
  box-shadow:    0 2px 14px rgba(var(--jalpi-accent-rgb), 0.36);
  transition:    all 0.14s;
}

.jalpi-tpl-import-cta:hover {
  opacity:    0.9;
  box-shadow: 0 4px 20px rgba(var(--jalpi-accent-rgb), 0.46);
}

.jalpi-tpl-retry {
  padding:       7px 18px;
  background:    transparent;
  border:        1px solid #e5e7eb;
  border-radius: 7px;
  cursor:        pointer;
  font-size:     13px;
  font-weight:   600;
  color:         #374151;
  font-family:   var(--jalpi-font);
  margin-top:    4px;
  transition:    all 0.12s;
}

.jalpi-tpl-retry:hover {
  border-color: rgba(var(--jalpi-accent-rgb), 0.4);
  color:        var(--jalpi-accent);
}

/* Hidden file input */
.jalpi-tpl-file-input {
  position: absolute;
  width:    1px;
  height:   1px;
  opacity:  0;
  overflow: hidden;
  pointer-events: none;
}

/* ── Global Styles Panel ─────────────────────────────────────────────────── */

.jalpi-gs {
  display:        flex;
  flex-direction: column;
  height:         100%;
  overflow:       hidden;
}

.jalpi-gs__header {
  flex-shrink:  0;
  border-bottom: 1px solid var(--jalpi-border);
}

.jalpi-gs__nav {
  display:  flex;
  gap:      2px;
  padding:  6px 8px;
}

.jalpi-gs__nav-btn {
  flex:          1;
  padding:       5px 4px;
  background:    transparent;
  border:        none;
  border-radius: 7px;
  cursor:        pointer;
  font-size:     11px;
  font-weight:   600;
  color:         var(--jalpi-text-2);
  font-family:   var(--jalpi-font);
  letter-spacing: 0.01em;
  transition:    all 0.12s;
}

.jalpi-gs__nav-btn:hover   { background: var(--jalpi-hover); color: var(--jalpi-text); }
.jalpi-gs__nav-btn.is-active {
  background: rgba(var(--jalpi-accent-rgb), 0.1);
  color:      var(--jalpi-accent);
}

.jalpi-gs__body {
  flex:       1;
  overflow-y: auto;
}

.jalpi-gs__body-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-inline-size: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.jalpi-gs__body-fieldset:disabled { opacity: 0.6; }

/* ── Design System save status (distinct from the page Save button — see
   App.tsx handleSaveDesignSystem) ─────────────────────────────────────────── */

.jalpi-gs__save-status {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  padding:         0 8px 6px;
}
.jalpi-gs__save-status-right {
  display:     flex;
  align-items: center;
}
.jalpi-gs__save-status-text {
  font-size: 11px;
  color:     var(--jalpi-text-3);
}
.jalpi-gs__save-btn {
  padding:       3px 10px;
  background:    var(--jalpi-accent);
  color:         #fff;
  border:        none;
  border-radius: 6px;
  font-size:     11px;
  font-weight:   600;
  cursor:        pointer;
}
.jalpi-gs__save-btn:hover { opacity: 0.9; }

/* ── Export / Import (ExportImportControls in GlobalStylesPanel.tsx) ───────── */

.jalpi-gs__io-actions {
  position:    relative;
  display:     flex;
  align-items: center;
  gap:         6px;
}
.jalpi-gs__io-btn {
  padding:       3px 9px;
  background:    transparent;
  border:        1px solid var(--jalpi-border);
  border-radius: 6px;
  font-size:     11px;
  font-weight:   500;
  color:         var(--jalpi-text-2);
  cursor:        pointer;
}
.jalpi-gs__io-btn:hover { color: var(--jalpi-text); border-color: var(--jalpi-accent); }

/* The merge/replace confirm and error banners pop over the panel instead of
   pushing the header layout around, since .jalpi-gs__io-actions is a flex row. */
.jalpi-gs__io-popover {
  position:  absolute;
  top:       100%;
  left:      0;
  z-index:   30;
  margin-top: 6px;
  width:     240px;
}

/* ── Sub-nav pills (Typography / Effects / Layout groups) ──────────────────── */

.jalpi-gs__subnav {
  display:       flex;
  flex-wrap:     wrap;
  gap:           4px;
  padding:       10px 12px 0;
}
.jalpi-gs__subnav-btn {
  padding:       4px 9px;
  background:    var(--jalpi-hover);
  border:        1px solid transparent;
  border-radius: 20px;
  cursor:        pointer;
  font-size:     10.5px;
  font-weight:   600;
  color:         var(--jalpi-text-2);
}
.jalpi-gs__subnav-btn:hover     { color: var(--jalpi-text); }
.jalpi-gs__subnav-btn.is-active {
  background:   rgba(var(--jalpi-accent-rgb), 0.12);
  border-color: rgba(var(--jalpi-accent-rgb), 0.3);
  color:        var(--jalpi-accent);
}

/* ── Legacy per-page styles import banner ───────────────────────────────────── */

.jalpi-gs__import-banner {
  margin:        10px 12px 0;
  padding:       9px 10px;
  background:    rgba(var(--jalpi-accent-rgb), 0.08);
  border:        1px solid rgba(var(--jalpi-accent-rgb), 0.25);
  border-radius: 8px;
  font-size:     11.5px;
  color:         var(--jalpi-text);
  display:       flex;
  flex-direction: column;
  gap:           7px;
}
.jalpi-gs__import-banner-actions { display: flex; gap: 6px; }
.jalpi-gs__import-banner-btn {
  padding:       3px 9px;
  background:    var(--jalpi-accent);
  color:         #fff;
  border:        none;
  border-radius: 6px;
  font-size:     11px;
  font-weight:   600;
  cursor:        pointer;
}
.jalpi-gs__import-banner-dismiss {
  padding:       3px 9px;
  background:    transparent;
  border:        1px solid var(--jalpi-border);
  border-radius: 6px;
  font-size:     11px;
  color:         var(--jalpi-text-2);
  cursor:        pointer;
}

/* ── Tab content ─────────────────────────────────────────────────────────── */

.jalpi-gs-tab {
  padding: 12px 12px 20px;
}

.jalpi-gs-tab__hint {
  font-size:    11.5px;
  color:        var(--jalpi-text-3);
  line-height:  1.5;
  margin:       0 0 12px;
}

.jalpi-gs-tab__hint code {
  font-family:  monospace;
  font-size:    10.5px;
  background:   rgba(var(--jalpi-accent-rgb), 0.08);
  color:        var(--jalpi-accent);
  padding:      1px 4px;
  border-radius: 4px;
}

/* ── Add button ─────────────────────────────────────────────────────────── */

.jalpi-gs-add-btn {
  display:       flex;
  align-items:   center;
  gap:           6px;
  padding:       7px 14px;
  background:    transparent;
  border:        1.5px dashed var(--jalpi-border);
  border-radius: 8px;
  cursor:        pointer;
  font-size:     12px;
  font-weight:   600;
  color:         var(--jalpi-text-2);
  font-family:   var(--jalpi-font);
  width:         100%;
  margin-top:    10px;
  transition:    all 0.12s;
}

.jalpi-gs-add-btn:hover {
  border-color: var(--jalpi-accent);
  color:        var(--jalpi-accent);
  background:   rgba(var(--jalpi-accent-rgb), 0.04);
}

/* ── Field helpers ──────────────────────────────────────────────────────── */

.jalpi-gs-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.jalpi-gs-field__label {
  font-size:   10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color:       var(--jalpi-text-3);
}

.jalpi-gs-field__input {
  padding:       5px 8px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border);
  border-radius: 6px;
  font-size:     12px;
  color:         var(--jalpi-text);
  font-family:   var(--jalpi-font);
  width:         100%;
  box-sizing:    border-box;
  transition:    border-color 0.12s;
  outline:       none;
}

.jalpi-gs-field__input--mono { font-family: monospace; font-size: 11.5px; }

.jalpi-gs-field__input:focus { border-color: var(--jalpi-accent); }

.jalpi-gs-field__select {
  padding:       5px 24px 5px 8px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border);
  border-radius: 6px;
  font-size:     12px;
  color:         var(--jalpi-text);
  font-family:   var(--jalpi-font);
  width:         100%;
  box-sizing:    border-box;
  appearance:    none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:   no-repeat;
  background-position: right 7px center;
  outline:       none;
  transition:    border-color 0.12s;
  cursor:        pointer;
}

.jalpi-gs-field__select:focus { border-color: var(--jalpi-accent); }

/* Grid helpers */
.jalpi-gs-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.jalpi-gs-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }

/* ── Color picker inline input ───────────────────────────────────────────── */

.jalpi-gs-colorpick {
  display:     flex;
  align-items: center;
  gap:         6px;
  min-width:   0;
}

.jalpi-gs-colorpick__swatch-wrap {
  position:      relative;
  width:         28px;
  height:        28px;
  flex-shrink:   0;
  border-radius: 6px;
  overflow:      hidden;
  border:        1px solid var(--jalpi-border);
  cursor:        pointer;
  display:       block;
}

.jalpi-gs-colorpick__swatch {
  display:  block;
  width:    100%;
  height:   100%;
}

/* ── Colors tab ──────────────────────────────────────────────────────────── */

.jalpi-gs-colors {
  display:        flex;
  flex-direction: column;
  gap:            2px;
}

.jalpi-gs-color {
  border:        1px solid transparent;
  border-radius: 9px;
  overflow:      hidden;
  transition:    border-color 0.12s;
}

.jalpi-gs-color.is-editing {
  border-color: rgba(var(--jalpi-accent-rgb), 0.35);
  background:   var(--jalpi-surface-2);
}

.jalpi-gs-color__header {
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     6px 8px;
}

.jalpi-gs-color__swatch-wrap {
  position:      relative;
  width:         26px;
  height:        26px;
  flex-shrink:   0;
  border-radius: 6px;
  overflow:      hidden;
  border:        1px solid rgba(0,0,0,0.1);
  cursor:        pointer;
  display:       block;
}

.jalpi-gs-color__swatch {
  display: block;
  width:   100%;
  height:  100%;
}

.jalpi-gs-color__native {
  position: absolute;
  inset:    0;
  opacity:  0;
  width:    100%;
  height:   100%;
  cursor:   pointer;
  padding:  0;
  border:   none;
}

.jalpi-gs-color__name {
  flex:        1;
  font-size:   13px;
  font-weight: 500;
  color:       var(--jalpi-text);
  cursor:      pointer;
}

.jalpi-gs-color__hex {
  font-size:   11px;
  font-family: monospace;
  color:       var(--jalpi-text-3);
}

.jalpi-gs-color__edit,
.jalpi-gs-color__del {
  width:         24px;
  height:        24px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  background:    transparent;
  border:        none;
  border-radius: 5px;
  cursor:        pointer;
  color:         var(--jalpi-text-3);
  opacity:       0;
  transition:    all 0.12s;
}

.jalpi-gs-color:hover .jalpi-gs-color__edit,
.jalpi-gs-color:hover .jalpi-gs-color__del { opacity: 1; }

.jalpi-gs-color__edit:hover { color: var(--jalpi-accent); background: rgba(var(--jalpi-accent-rgb), 0.08); }
.jalpi-gs-color__del:hover  { color: #ef4444; background: rgba(239,68,68,0.08); }

.jalpi-gs-color__editor {
  padding: 0 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jalpi-gs-color__var-hint {
  font-size:  11px;
  color:      var(--jalpi-text-3);
  margin:     0;
}

/* ══════════════════════════════════════════════════════════════
   ICON PICKER MODAL — jalpi-ip__*
   ══════════════════════════════════════════════════════════════ */

/* Overlay */
.jalpi-ip__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cbFadeIn 0.12s ease;
}

@keyframes cbFadeIn { from { opacity:0 } to { opacity:1 } }

/* Modal container */
.jalpi-ip__modal {
  background: var(--jalpi-panel, #1e1e24);
  border: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  border-radius: 10px;
  width: min(820px, 96vw);
  height: min(620px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
  animation: cbSlideUp 0.14s ease;
}
@keyframes cbSlideUp { from { transform:translateY(16px);opacity:0 } to { transform:none;opacity:1 } }

/* Header */
.jalpi-ip__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  flex-shrink: 0;
}
.jalpi-ip__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--jalpi-text-1, #e4e4e7);
  white-space: nowrap;
}
.jalpi-ip__header-tabs {
  display: flex;
  gap: 2px;
  margin-right: auto;
  margin-left: 8px;
}
.jalpi-ip__htab {
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 11px;
  color: var(--jalpi-text-2, #a1a1aa);
  cursor: pointer;
  transition: all 0.1s;
}
.jalpi-ip__htab:hover { background: rgba(255,255,255,0.06); color: var(--jalpi-text-1, #e4e4e7); }
.jalpi-ip__htab.is-active { background: rgba(99,102,241,0.18); color: #818cf8; border-color: rgba(99,102,241,0.3); }

.jalpi-ip__clear {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  border-radius: 5px;
  background: none;
  color: var(--jalpi-text-2, #a1a1aa);
  cursor: pointer;
  white-space: nowrap;
}
.jalpi-ip__clear:hover { border-color: #ef4444; color: #ef4444; }

.jalpi-ip__close {
  width: 26px; height: 26px;
  border: none; border-radius: 5px; background: none;
  color: var(--jalpi-text-2, #a1a1aa); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.jalpi-ip__close:hover { background: rgba(255,255,255,0.06); color: var(--jalpi-text-1, #e4e4e7); }

/* Search bar */
.jalpi-ip__search-bar {
  position: relative;
  padding: 8px 14px;
  border-bottom: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.jalpi-ip__search-ico {
  position: absolute;
  left: 24px;
  width: 14px; height: 14px;
  color: var(--jalpi-text-3, #71717a);
  pointer-events: none;
}
.jalpi-ip__search {
  width: 100%;
  padding: 6px 32px 6px 32px;
  background: var(--jalpi-input-bg, rgba(255,255,255,0.05));
  border: 1px solid var(--jalpi-border, rgba(255,255,255,0.1));
  border-radius: 6px;
  font-size: 12px;
  color: var(--jalpi-text-1, #e4e4e7);
  outline: none;
}
.jalpi-ip__search:focus { border-color: var(--jalpi-accent, #6366f1); }
.jalpi-ip__search::placeholder { color: var(--jalpi-text-3, #71717a); }
.jalpi-ip__search-clr {
  position: absolute;
  right: 22px;
  background: none; border: none;
  color: var(--jalpi-text-3, #71717a); font-size: 12px; cursor: pointer;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px;
}
.jalpi-ip__search-clr:hover { color: var(--jalpi-text-1, #e4e4e7); background: rgba(255,255,255,0.06); }

/* Body */
.jalpi-ip__body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Library sidebar */
.jalpi-ip__libs {
  width: 140px;
  flex-shrink: 0;
  border-right: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  overflow-y: auto;
  padding: 6px 0;
}
.jalpi-ip__lib {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  border-left: 2px solid transparent;
  transition: background 0.1s;
}
.jalpi-ip__lib:hover { background: rgba(255,255,255,0.04); }
.jalpi-ip__lib.is-active { background: rgba(99,102,241,0.1); border-left-color: #6366f1; }
.jalpi-ip__lib-name {
  font-size: 11.5px;
  color: var(--jalpi-text-1, #e4e4e7);
  font-weight: 500;
  line-height: 1.3;
}
.jalpi-ip__lib.is-active .jalpi-ip__lib-name { color: #818cf8; }
.jalpi-ip__lib-count {
  font-size: 10px;
  color: var(--jalpi-text-3, #71717a);
  margin-top: 1px;
}

/* Main content area */
.jalpi-ip__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Category pills */
.jalpi-ip__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--jalpi-border, rgba(255,255,255,0.06));
  flex-shrink: 0;
  max-height: 72px;
  overflow-y: auto;
}
.jalpi-ip__cat {
  padding: 2px 8px;
  border: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  border-radius: 100px;
  background: none;
  font-size: 10.5px;
  color: var(--jalpi-text-2, #a1a1aa);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s;
}
.jalpi-ip__cat:hover { background: rgba(255,255,255,0.05); color: var(--jalpi-text-1, #e4e4e7); }
.jalpi-ip__cat.is-active { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.4); color: #818cf8; }

/* Grid wrapper (scrolls) */
.jalpi-ip__grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
}

/* Icon grid */
.jalpi-ip__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 4px;
}

/* Icon tile */
.jalpi-ip__tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  cursor: pointer;
  min-height: 64px;
  transition: background 0.1s, border-color 0.1s;
  overflow: hidden;
}
.jalpi-ip__tile:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); }
.jalpi-ip__tile.is-active { background: rgba(99,102,241,0.18); border-color: rgba(99,102,241,0.5); }

.jalpi-ip__tile-icon {
  font-size: 22px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--jalpi-text-1, #e4e4e7);
  line-height: 1;
}
.jalpi-ip__tile-icon svg { width: 1em; height: 1em; }

.jalpi-ip__tile-label {
  font-size: 9px;
  color: var(--jalpi-text-3, #71717a);
  line-height: 1.2;
  text-align: center;
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jalpi-ip__tile:hover .jalpi-ip__tile-label { color: var(--jalpi-text-2, #a1a1aa); }

/* Favorite star — hidden by default, shows on hover */
.jalpi-ip__tile-fav {
  position: absolute;
  top: 2px; right: 3px;
  font-size: 10px;
  background: none; border: none;
  cursor: pointer;
  opacity: 0;
  color: #fbbf24;
  transition: opacity 0.1s;
  line-height: 1;
  padding: 0;
}
.jalpi-ip__tile-fav--add { color: var(--jalpi-text-3, #71717a); }
.jalpi-ip__tile:hover .jalpi-ip__tile-fav { opacity: 1; }
.jalpi-ip__tile.is-active .jalpi-ip__tile-fav { opacity: 0.7; }

/* Loading state */
.jalpi-ip__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  min-height: 200px;
  font-size: 12px;
  color: var(--jalpi-text-2, #a1a1aa);
}
.jalpi-ip__spinner {
  width: 24px; height: 24px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: cbSpin 0.7s linear infinite;
}
@keyframes cbSpin { to { transform: rotate(360deg); } }

/* Empty state */
.jalpi-ip__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  font-size: 12px;
  color: var(--jalpi-text-3, #71717a);
  text-align: center;
  padding: 20px;
}

/* Pagination */
.jalpi-ip__pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  flex-shrink: 0;
}
.jalpi-ip__pagination button {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  border-radius: 5px;
  color: var(--jalpi-text-2, #a1a1aa);
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.1s;
}
.jalpi-ip__pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.jalpi-ip__pagination button:not(:disabled):hover { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.3); color: #818cf8; }
.jalpi-ip__pagination span { font-size: 11px; color: var(--jalpi-text-2, #a1a1aa); min-width: 48px; text-align: center; }

/* Footer */
.jalpi-ip__footer {
  padding: 6px 14px;
  border-top: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.jalpi-ip__count { font-size: 11px; color: var(--jalpi-text-3, #71717a); }
.jalpi-ip__selected-label { font-size: 11px; color: var(--jalpi-text-2, #a1a1aa); }
.jalpi-ip__selected-label strong { color: #818cf8; }

/* ── IconInput trigger button ── */
.jalpi-icon-input {
  display: flex;
  gap: 4px;
  align-items: center;
}
.jalpi-icon-input__trigger {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--jalpi-input-bg, rgba(255,255,255,0.05));
  border: 1px solid var(--jalpi-border, rgba(255,255,255,0.1));
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--jalpi-text-2, #a1a1aa);
  min-height: 36px;
  text-align: left;
  transition: border-color 0.1s;
}
.jalpi-icon-input__trigger:hover { border-color: rgba(255,255,255,0.2); color: var(--jalpi-text-1, #e4e4e7); }
.jalpi-icon-input__trigger.has-icon { color: var(--jalpi-text-1, #e4e4e7); }
.jalpi-icon-input__preview {
  font-size: 22px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  color: var(--jalpi-text-1, #6366f1);
  flex-shrink: 0;
}
.jalpi-icon-input__preview svg { width: 1em; height: 1em; }
.jalpi-icon-input__placeholder {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.4;
  flex-shrink: 0;
}

/* Icon Box element — large preview with transparency checkerboard */
.jalpi-icon-box-preview {
  display: flex; align-items: center; justify-content: center;
  min-height: 130px; border-radius: 8px; margin-bottom: 8px;
  font-size: 64px; color: var(--jalpi-text, #374151);
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}
.jalpi-icon-box-preview svg { width: 1em; height: 1em; }

/* Large icon preview box (shown below the picker trigger when icon selected) */
.jalpi-icon-large-preview {
  display: flex; align-items: center; justify-content: center;
  min-height: 80px; border-radius: 8px; margin-top: 4px;
  background: var(--jalpi-surface-3, #f1f5f9);
  color: var(--jalpi-text, #374151); font-size: 40px;
}
.jalpi-icon-large-preview svg { width: 1em; height: 1em; }
.jalpi-icon-input__label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jalpi-icon-input__caret {
  flex-shrink: 0;
  opacity: 0.5;
}
.jalpi-icon-input__clear {
  width: 26px; height: 26px;
  background: none;
  border: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  border-radius: 5px;
  color: var(--jalpi-text-2, #a1a1aa);
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.1s;
  flex-shrink: 0;
}
.jalpi-icon-input__clear:hover { border-color: #ef4444; color: #ef4444; }

/* ── Icon Picker: light-theme hover overrides ─────────────────────────────
   The picker's hover states were hardcoded as white overlays
   (rgba(255,255,255,…)) designed for a dark modal. Now that the modal is
   light (see the --jalpi-panel/-text-* aliases in :root), those overlays are
   invisible. Replace them with a subtle dark overlay so hover is visible on
   the light surface. Scoped strictly to the picker/icon-input, so nothing
   else is affected. */
.jalpi-ip__htab:hover,
.jalpi-ip__close:hover,
.jalpi-ip__search-clr:hover,
.jalpi-ip__cat:hover,
.jalpi-ip__tile:hover { background: rgba(15,23,42,0.05); }
.jalpi-ip__lib:hover { background: rgba(15,23,42,0.04); }
.jalpi-ip__tile:hover { border-color: var(--jalpi-border-2); }
.jalpi-icon-input__trigger:hover { border-color: var(--jalpi-border-3); }

.jalpi-gs-color__var-hint code {
  font-family: monospace;
  font-size:   10.5px;
  background:  rgba(var(--jalpi-accent-rgb), 0.08);
  color:       var(--jalpi-accent);
  padding:     1px 4px;
  border-radius: 4px;
}

/* ── Preset accordion (typography + buttons) ─────────────────────────────── */

.jalpi-gs-list {
  display:        flex;
  flex-direction: column;
  gap:            4px;
}

.jalpi-gs-preset {
  border:        1px solid var(--jalpi-border);
  border-radius: 9px;
  overflow:      hidden;
  transition:    border-color 0.12s;
}

.jalpi-gs-preset.is-open { border-color: rgba(var(--jalpi-accent-rgb), 0.4); }

.jalpi-gs-preset__header {
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     9px 10px;
  cursor:      pointer;
  transition:  background 0.1s;
}

.jalpi-gs-preset__header:hover { background: var(--jalpi-hover); }

.jalpi-gs-preset__preview {
  flex:         1;
  overflow:     hidden;
  text-overflow: ellipsis;
  white-space:  nowrap;
  min-width:    0;
}

.jalpi-gs-preset__meta {
  display:   flex;
  gap:       6px;
  flex-shrink: 0;
}

.jalpi-gs-preset__meta span {
  font-size:   10.5px;
  color:       var(--jalpi-text-3);
  font-family: monospace;
}

.jalpi-gs-preset__del {
  width:         24px;
  height:        24px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  background:    transparent;
  border:        none;
  border-radius: 5px;
  cursor:        pointer;
  color:         var(--jalpi-text-3);
  opacity:       0;
  flex-shrink:   0;
  transition:    all 0.12s;
}

.jalpi-gs-preset__header:hover .jalpi-gs-preset__del { opacity: 1; }
.jalpi-gs-preset__del:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

.jalpi-gs-preset__chevron {
  flex-shrink:  0;
  color:        var(--jalpi-text-3);
  transition:   transform 0.18s;
}

.jalpi-gs-preset.is-open .jalpi-gs-preset__chevron { transform: rotate(180deg); }

.jalpi-gs-preset__body {
  padding:       10px 10px 12px;
  border-top:    1px solid var(--jalpi-border);
  background:    var(--jalpi-surface-2);
}

/* ── Button preview in buttons tab ─────────────────────────────────────────  */

.jalpi-gs-btn-preview {
  cursor:    default;
  user-select: none;
  max-width: 160px;
  overflow:  hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Spacing tab ─────────────────────────────────────────────────────────── */

.jalpi-gs-spacing {
  display:        flex;
  flex-direction: column;
  gap:            8px;
}

.jalpi-gs-spacing__row {
  display:     grid;
  grid-template-columns: 28px 1fr 64px 68px;
  align-items: center;
  gap:         8px;
}

.jalpi-gs-spacing__key {
  font-size:   10.5px;
  font-weight: 700;
  color:       var(--jalpi-text-3);
  text-align:  right;
  letter-spacing: 0.04em;
}

.jalpi-gs-spacing__bar-wrap {
  height:        6px;
  background:    var(--jalpi-surface-2);
  border-radius: 3px;
  overflow:      hidden;
  border:        1px solid var(--jalpi-border);
}

.jalpi-gs-spacing__bar {
  height:        100%;
  background:    linear-gradient(90deg, rgba(var(--jalpi-accent-rgb), 0.4), var(--jalpi-accent));
  border-radius: 3px;
  min-width:     4px;
  transition:    width 0.18s;
}

.jalpi-gs-spacing__input {
  padding:    5px 6px;
  text-align: center;
  font-family: monospace;
  font-size:  11.5px;
}

.jalpi-gs-spacing__var {
  font-size:   10px;
  font-family: monospace;
  color:       var(--jalpi-text-3);
  overflow:    hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Preset Linker bar (shown in inspector above tab body) ────────────────── */

.jalpi-preset-linker {
  display:       flex;
  align-items:   center;
  gap:           6px;
  padding:       7px 12px;
  border-bottom: 1px solid var(--jalpi-border);
  background:    rgba(var(--jalpi-accent-rgb), 0.04);
  flex-shrink:   0;
}

.jalpi-preset-linker svg { color: var(--jalpi-accent); flex-shrink: 0; }

.jalpi-preset-linker__label {
  font-size:   11px;
  font-weight: 700;
  color:       var(--jalpi-text-2);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.jalpi-preset-linker__select {
  flex:          1;
  padding:       3px 22px 3px 6px;
  background:    var(--jalpi-surface);
  border:        1px solid var(--jalpi-border);
  border-radius: 6px;
  font-size:     11.5px;
  color:         var(--jalpi-text);
  font-family:   var(--jalpi-font);
  appearance:    none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:   no-repeat;
  background-position: right 6px center;
  cursor:        pointer;
  outline:       none;
  transition:    border-color 0.12s;
  min-width:     0;
}

.jalpi-preset-linker__select:focus { border-color: var(--jalpi-accent); }

.jalpi-preset-linker__unlink {
  width:         20px;
  height:        20px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  background:    transparent;
  border:        none;
  border-radius: 4px;
  cursor:        pointer;
  color:         var(--jalpi-text-3);
  flex-shrink:   0;
  transition:    all 0.12s;
}

.jalpi-preset-linker__unlink:hover {
  color:       #ef4444;
  background:  rgba(239,68,68,0.08);
}

/* ── Device Banner (shown in inspector when editing tablet/mobile) ─────────── */

.jalpi-dev-banner {
  display:       flex;
  align-items:   center;
  gap:           7px;
  padding:       8px 12px;
  font-size:     11.5px;
  font-weight:   600;
  flex-shrink:   0;
  letter-spacing: 0.01em;
}

.jalpi-dev-banner--tablet {
  background:    rgba(59,130,246,0.07);
  color:         #3b82f6;
  border-bottom: 1px solid rgba(59,130,246,0.15);
}

.jalpi-dev-banner--mobile {
  background:    rgba(16,185,129,0.07);
  color:         #10b981;
  border-bottom: 1px solid rgba(16,185,129,0.15);
}

.jalpi-dev-banner strong { font-weight: 800; }

.jalpi-dev-banner__back {
  margin-left:   auto;
  padding:       2px 8px;
  background:    transparent;
  border:        1.5px solid currentColor;
  border-radius: 5px;
  cursor:        pointer;
  font-size:     10.5px;
  font-weight:   700;
  color:         inherit;
  font-family:   var(--jalpi-font);
  opacity:       0.8;
  transition:    opacity 0.12s;
}

.jalpi-dev-banner__back:hover { opacity: 1; }

/* ── 3-device Visibility toggle ─────────────────────────────────────────── */

.jalpi-vis-devices {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 2px;
}

.jalpi-vis-device {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             3px;
  padding:         8px 4px 6px;
  background:      rgba(16,185,129,0.05);
  border:          1.5px solid rgba(16,185,129,0.2);
  border-radius:   8px;
  cursor:          pointer;
  font-family:     var(--jalpi-font);
  transition:      all 0.12s;
}

.jalpi-vis-device:hover {
  border-color: rgba(16,185,129,0.45);
  background:   rgba(16,185,129,0.1);
}

.jalpi-vis-device.is-hidden {
  background:   rgba(239,68,68,0.05);
  border-color: rgba(239,68,68,0.25);
}

.jalpi-vis-device.is-hidden:hover {
  border-color: rgba(239,68,68,0.5);
  background:   rgba(239,68,68,0.1);
}

.jalpi-vis-device svg { color: #6b7280; flex-shrink: 0; }
.jalpi-vis-device.is-hidden svg { color: #ef4444; }

.jalpi-vis-device__name {
  font-size:      9.5px;
  font-weight:    700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color:          var(--jalpi-text-2);
}

.jalpi-vis-device__state {
  font-size:   9.5px;
  font-weight: 600;
  color:       #10b981;
}

.jalpi-vis-device.is-hidden .jalpi-vis-device__state { color: #ef4444; }

/* ── Breakpoint button labels in TopBar ─────────────────────────────────── */

.jalpi-topbar__bp-btn {
  flex-direction: column;
  gap: 1px;
  padding: 4px 8px;
  min-width: 52px;
}

.jalpi-topbar__bp-label {
  font-size:      9px;
  font-weight:    700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity:        0.65;
  line-height:    1;
}

.jalpi-topbar__bp-btn.is-active .jalpi-topbar__bp-label { opacity: 1; }
/* Active pill has a dark accent BACKGROUND (see the rule above), so the icon +
   label must be WHITE to stay visible — the earlier `color: var(--jalpi-accent)`
   made it accent-on-accent (invisible black blob). */
.jalpi-topbar__bp-btn.is-active { color: #fff; }

/* ================================================================
   Save Template Modal  (.jalpi-stm-)
   ================================================================ */

.jalpi-stm-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 10001; display: flex; align-items: center;
  justify-content: center; animation: jalpi-fade-in .1s ease;
}
.jalpi-stm {
  background: #fff; border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,.2), 0 4px 16px rgba(0,0,0,.06);
  width: 680px; max-width: 95vw; max-height: 90vh;
  overflow: hidden; display: flex; flex-direction: column;
}
.jalpi-stm__head {
  display: flex; align-items: center; gap: 9px;
  padding: 15px 18px; border-bottom: 1px solid #f3f4f6; flex-shrink: 0;
}
.jalpi-stm__head-title { flex: 1; font-size: 14px; font-weight: 700; color: #111827; }
.jalpi-stm__close {
  width: 28px; height: 28px; border: none; border-radius: 6px;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af; transition: background .1s, color .1s; font-family: var(--jalpi-font);
}
.jalpi-stm__close:hover { background: #f3f4f6; color: #374151; }
.jalpi-stm__body { display: grid; grid-template-columns: 1fr 260px; overflow: hidden; flex: 1; }

/* Form */
.jalpi-stm__form {
  padding: 18px 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px; border-right: 1px solid #f3f4f6;
}
.jalpi-stm__field { display: flex; flex-direction: column; gap: 5px; }
.jalpi-stm__label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; }
.jalpi-stm__req { color: #ef4444; }
.jalpi-stm__input, .jalpi-stm__textarea, .jalpi-stm__select {
  width: 100%; padding: 8px 10px; border: 1.5px solid #e5e7eb; border-radius: 7px;
  font-size: 13px; font-family: var(--jalpi-font); color: #111827; background: #fff;
  outline: none; box-sizing: border-box; transition: border-color .12s;
}
.jalpi-stm__input:focus, .jalpi-stm__textarea:focus, .jalpi-stm__select:focus {
  border-color: #1a1a1a; box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}
.jalpi-stm__textarea { resize: vertical; min-height: 52px; }

/* Type selector */
.jalpi-stm__types { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.jalpi-stm__type-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px; border: 1.5px solid #e5e7eb; border-radius: 8px;
  background: #fafafa; cursor: pointer; font-family: var(--jalpi-font); transition: all .1s;
}
.jalpi-stm__type-btn:hover           { border-color: #bbbbbb; background: #f2f2f2; }
.jalpi-stm__type-btn.is-active       { border-color: #1a1a1a; background: #f2f2f2; }
.jalpi-stm__type-icon                { color: #6b7280; display: flex; }
.jalpi-stm__type-btn.is-active .jalpi-stm__type-icon { color: #1a1a1a; }
.jalpi-stm__type-label               { font-size: 12px; font-weight: 700; color: #374151; }
.jalpi-stm__type-btn.is-active .jalpi-stm__type-label { color: #000000; }
.jalpi-stm__type-desc                { font-size: 10px; color: #9ca3af; }
.jalpi-stm__hint { font-size: 11px; color: #f59e0b; margin: 0; }

.jalpi-stm__error {
  padding: 8px 10px; background: #fff5f5;
  border: 1px solid #fecaca; border-radius: 6px; font-size: 12px; color: #ef4444;
}
.jalpi-stm__actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 2px; margin-top: auto; }
.jalpi-stm__cancel {
  padding: 8px 16px; border: 1.5px solid #e5e7eb; border-radius: 7px; background: #fff;
  font-size: 13px; font-weight: 600; font-family: var(--jalpi-font); color: #6b7280;
  cursor: pointer; transition: all .1s;
}
.jalpi-stm__cancel:hover { background: #f9fafb; color: #374151; }
.jalpi-stm__save {
  padding: 8px 18px; background: #1a1a1a; border: none; border-radius: 7px;
  font-size: 13px; font-weight: 700; font-family: var(--jalpi-font); color: #fff;
  cursor: pointer; transition: background .1s;
}
.jalpi-stm__save:hover:not(:disabled) { background: #000000; }
.jalpi-stm__save:disabled             { opacity: .55; cursor: not-allowed; }
.jalpi-stm__save.is-saved             { background: #10b981; }

/* Preview sidebar */
.jalpi-stm__preview {
  background: #f9fafb; padding: 14px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.jalpi-stm__preview-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #9ca3af; flex-shrink: 0;
}
.jalpi-stm__preview-scroll { flex: 1; overflow-y: auto; }
.jalpi-stm__preview-empty { font-size: 12px; color: #9ca3af; text-align: center; padding: 24px 0; }

/* NodeWire */
.jalpi-nodewire {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 4px; border: 1px solid transparent; margin-bottom: 2px;
}
.jalpi-nodewire__type {
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; min-width: 54px; flex-shrink: 0;
}
.jalpi-nodewire__text {
  font-size: 11px; color: #6b7280;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}
.jalpi-nodewire__more { font-size: 10px; color: #9ca3af; padding: 1px 6px; font-style: italic; }

/* ================================================================
   Template Preview Modal  (.jalpi-tpl-prev-)
   ================================================================ */

.jalpi-tpl-prev-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 10002; display: flex; align-items: center;
  justify-content: center; animation: jalpi-fade-in .1s ease;
}
.jalpi-tpl-prev {
  background: #fff; border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  width: 620px; max-width: 95vw; max-height: 90vh;
  overflow: hidden; display: flex; flex-direction: column;
}
.jalpi-tpl-prev__head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid #f3f4f6; flex-shrink: 0;
}
.jalpi-tpl-prev__title-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.jalpi-tpl-prev__title { font-size: 15px; font-weight: 700; color: #111827; line-height: 1.3; }
.jalpi-tpl-prev__badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.jalpi-tpl-prev__cat { font-size: 11px; color: #6b7280; background: #f3f4f6; border-radius: 4px; padding: 2px 7px; }
.jalpi-tpl-prev__desc { font-size: 12px; color: #6b7280; margin: 0; }
.jalpi-tpl-prev__close {
  width: 30px; height: 30px; border: none; border-radius: 7px; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-family: var(--jalpi-font); transition: background .1s; flex-shrink: 0;
}
.jalpi-tpl-prev__close:hover { background: #f3f4f6; color: #374151; }
.jalpi-tpl-prev__body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.jalpi-tpl-prev__thumb {
  height: 160px; flex-shrink: 0; overflow: hidden;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.jalpi-tpl-prev__thumb img   { width: 100%; height: 100%; object-fit: cover; }
.jalpi-tpl-prev__thumb-icon  { opacity: 0.7; }
.jalpi-tpl-prev__tree        { padding: 16px 20px; flex: 1; }
.jalpi-tpl-prev__tree-label  {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #9ca3af; margin-bottom: 10px;
}
.jalpi-tpl-prev__footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid #f3f4f6; flex-shrink: 0;
}

/* Element type badge */
.jalpi-tpl-card__type--element { background: #f0fdf4; color: #16a34a; }

/* Card thumb hover-to-preview */
.jalpi-tpl-card__thumb { position: relative; cursor: pointer; }
.jalpi-tpl-card__preview-hint {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  gap: 5px; color: #fff; font-size: 12px; font-weight: 700;
  opacity: 0; transition: opacity .15s; font-family: var(--jalpi-font);
}
.jalpi-tpl-card__thumb:hover .jalpi-tpl-card__preview-hint { opacity: 1; }

.jalpi-tpl-card__cat { font-size: 10px; color: #9ca3af; }

/* ================================================================
   PropertiesPanel — Repeater + Table Editor controls
   ================================================================ */

/* Inline textarea */
.jalpi-textarea {
  width: 100%; box-sizing: border-box;
  padding: 7px 10px; border: 1px solid var(--jalpi-border-2); border-radius: 6px;
  font-family: var(--jalpi-font); font-size: 12px; color: var(--jalpi-text);
  background: var(--jalpi-surface-2); resize: vertical; line-height: 1.5;
  transition: border-color .15s;
}
.jalpi-textarea:focus { outline: none; border-color: var(--jalpi-accent); box-shadow: 0 0 0 2px rgba(0,0,0,0.06); }

/* Range slider */
.jalpi-range { width: calc(100% - 36px); accent-color: var(--jalpi-accent); }
.jalpi-range-val { font-size: 11px; font-weight: 600; color: var(--jalpi-text-muted); min-width: 32px; text-align: right; }

/* Generic item repeater */
.jalpi-repeater { display: flex; flex-direction: column; gap: 8px; }

.jalpi-repeater__item {
  border: 1px solid var(--jalpi-border-2); border-radius: 8px;
  background: var(--jalpi-surface-2); overflow: hidden;
}

.jalpi-repeater__item-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px 5px 10px; background: var(--jalpi-surface-3); border-bottom: 1px solid var(--jalpi-border);
}

.jalpi-repeater__item-num {
  font-size: 10px; font-weight: 700; color: var(--jalpi-text-muted);
  text-transform: uppercase; letter-spacing: .05em;
}

.jalpi-repeater__remove {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border: none; border-radius: 4px;
  background: transparent; color: #ef4444; cursor: pointer; transition: background .1s;
}
.jalpi-repeater__remove:hover { background: #fee2e2; }

.jalpi-repeater__item-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; }

.jalpi-repeater__add {
  width: 100%; padding: 7px 0; border: 1px dashed var(--jalpi-border-2); border-radius: 7px;
  background: transparent; font-family: var(--jalpi-font); font-size: 12px; font-weight: 600;
  color: var(--jalpi-accent); cursor: pointer; transition: background .12s, border-color .12s;
}
.jalpi-repeater__add:hover { background: rgba(0,0,0,0.03); border-color: var(--jalpi-accent); }

/* ── Image Carousel — gallery thumbnail picker (Elementor-style) ─────────── */
.jalpi-ic-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 2px 0 8px;
}
.jalpi-ic-gallery__item {
  position: relative;
}
.jalpi-ic-gallery__thumb {
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  background: var(--jalpi-surface-3);
  border: 2px solid var(--jalpi-border-2);
  transition: border-color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.jalpi-ic-gallery__thumb:hover { border-color: var(--jalpi-accent); }
.jalpi-ic-gallery__thumb img   { width: 100%; height: 100%; object-fit: cover; display: block; }
.jalpi-ic-gallery__empty       { font-size: 18px; color: var(--jalpi-text-muted); }
.jalpi-ic-gallery__remove {
  position: absolute;
  top: -5px; right: -5px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #ef4444; color: #fff;
  border: none; font-size: 13px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
}
.jalpi-ic-gallery__item:hover .jalpi-ic-gallery__remove { opacity: 1; }
.jalpi-ic-gallery__add-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  border: 2px dashed var(--jalpi-border-2);
  background: var(--jalpi-surface-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--jalpi-text-muted);
  transition: border-color .15s, color .15s;
}
.jalpi-ic-gallery__add-thumb:hover { border-color: var(--jalpi-accent); color: var(--jalpi-accent); }

/* Accordion compact item list */
.jalpi-acc-items-label {
  font-size: 11px; font-weight: 600; color: var(--jalpi-text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}

.jalpi-acc-items { display: flex; flex-direction: column; gap: 4px; }

/* Each item card */
.jalpi-acc-item-row {
  border: 1px solid var(--jalpi-border-2); border-radius: 8px;
  background: var(--jalpi-surface-2); overflow: hidden; margin-bottom: 4px;
}
.jalpi-acc-item-row.is-open { border-color: var(--jalpi-accent); }

/* Header row: toggle + icon + label + copy + delete */
.jalpi-acc-item-row__head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; min-height: 40px;
}
.jalpi-acc-item-row__toggle {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex-shrink: 0; border: none; border-radius: 4px;
  background: transparent; color: var(--jalpi-text-muted); cursor: pointer;
  transition: background .1s, color .1s;
}
.jalpi-acc-item-row__toggle:hover { background: var(--jalpi-surface-3); color: var(--jalpi-text); }

.jalpi-acc-item-row__label {
  flex: 1; font-size: 14px; font-weight: 500; color: var(--jalpi-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}

.jalpi-acc-item-row__btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex-shrink: 0; border: none; border-radius: 5px;
  background: transparent; color: var(--jalpi-text-muted); cursor: pointer;
  transition: background .1s, color .1s;
}
.jalpi-acc-item-row__btn:hover { background: var(--jalpi-surface-3); color: var(--jalpi-text); }
.jalpi-acc-item-row__btn--del:hover { background: #fee2e2; color: #ef4444; }

/* Expanded content: Title input + body textarea */
.jalpi-acc-item-row__body {
  border-top: 1px solid var(--jalpi-border-2); padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--jalpi-surface);
}

.jalpi-add-item-btn {
  width: 100%; margin-top: 8px; padding: 7px 0;
  border: 1px dashed var(--jalpi-border-2); border-radius: 7px;
  background: transparent; font-family: var(--jalpi-font); font-size: 12px; font-weight: 600;
  color: var(--jalpi-accent); cursor: pointer; transition: background .12s, border-color .12s;
}
.jalpi-add-item-btn:hover { background: rgba(0,0,0,0.03); border-color: var(--jalpi-accent); }

.jalpi-acc-icon-label {
  font-size: 11px; font-weight: 600; color: var(--jalpi-text);
  margin: 10px 0 4px; text-transform: none;
}

.jalpi-acc-section-sep {
  height: 1px; background: var(--jalpi-border-2); margin: 12px 0;
}

/* Table editor */
.jalpi-table-editor { display: flex; flex-direction: column; gap: 8px; }

.jalpi-table-editor__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2px;
}

.jalpi-table-editor__label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--jalpi-text-muted);
}

.jalpi-table-editor__add-col {
  font-size: 11px; font-weight: 600; color: var(--jalpi-accent); background: none;
  border: 1px solid var(--jalpi-border-2); border-radius: 5px; padding: 2px 8px; cursor: pointer;
  transition: background .1s;
}
.jalpi-table-editor__add-col:hover { background: rgba(0,0,0,0.04); }

.jalpi-table-editor__headers { display: flex; gap: 4px; flex-wrap: wrap; }

.jalpi-table-editor__cell {
  flex: 1; min-width: 60px; padding: 5px 8px;
  font-size: 11px; border: 1px solid var(--jalpi-border-2); border-radius: 5px;
  font-family: var(--jalpi-font); background: var(--jalpi-surface-2);
}
.jalpi-table-editor__cell:focus { outline: none; border-color: var(--jalpi-accent); }

.jalpi-table-editor__rows { display: flex; flex-direction: column; gap: 4px; }

.jalpi-table-editor__row {
  display: flex; gap: 4px; align-items: center;
}

/* ── Button panel extras ─────────────────────────────────────────────────── */

/* "Open in new tab" inline checkbox under Link field */
.jalpi-link-opts {
  margin-top: 4px;
}
.jalpi-link-opts__check {
  display:     inline-flex;
  align-items: center;
  gap:         5px;
  font-size:   11px;
  color:       var(--jalpi-text-muted);
  cursor:      pointer;
  user-select: none;
}
.jalpi-link-opts__check input { margin: 0; cursor: pointer; accent-color: var(--jalpi-accent); }

/* Small helper text below a field */
.jalpi-field-note {
  margin:    4px 0 0;
  font-size: 10px;
  color:     var(--jalpi-text-muted);
  line-height: 1.4;
}

/* Icon picker — 3-button row + floating grid */
.jalpi-btn-icon-picker {
  position: relative;
  display:  flex;
  gap:      4px;
  flex-wrap: wrap;
  align-items: center;
}
.jalpi-btn-icon-opt {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           30px;
  height:          28px;
  border:          1.5px solid var(--jalpi-border-2);
  border-radius:   6px;
  background:      var(--jalpi-surface-2);
  color:           var(--jalpi-text-muted);
  cursor:          pointer;
  transition:      border-color .15s, background .15s;
}
.jalpi-btn-icon-opt:hover { border-color: var(--jalpi-accent); color: var(--jalpi-accent); }
.jalpi-btn-icon-opt.is-active {
  border-color: var(--jalpi-accent);
  background:   color-mix(in srgb, var(--jalpi-accent) 10%, transparent);
  color:        var(--jalpi-accent);
}

/* Floating icon grid */
.jalpi-btn-icon-grid {
  position:         absolute;
  top:              calc(100% + 4px);
  left:             0;
  z-index:          9999;
  display:          grid;
  grid-template-columns: repeat(6, 28px);
  gap:              3px;
  padding:          8px;
  background:       var(--jalpi-surface);
  border:           1px solid var(--jalpi-border-2);
  border-radius:    8px;
  box-shadow:       0 8px 24px rgba(0,0,0,0.12);
  max-height:       180px;
  overflow-y:       auto;
}
.jalpi-btn-icon-cell {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           28px;
  height:          28px;
  border:          1.5px solid transparent;
  border-radius:   5px;
  background:      none;
  cursor:          pointer;
  color:           var(--jalpi-text);
  transition:      border-color .12s, background .12s;
}
.jalpi-btn-icon-cell svg { width: 14px; height: 14px; }
.jalpi-btn-icon-cell:hover   { background: var(--jalpi-hover); }
.jalpi-btn-icon-cell.is-selected {
  border-color: var(--jalpi-accent);
  background:   color-mix(in srgb, var(--jalpi-accent) 10%, transparent);
}

/* ── Button panel helpers ────────────────────────────────────────────────── */

/* Inline control row: input + icon buttons side by side */
.jalpi-ctrl-row {
  display:     flex;
  align-items: center;
  gap:         4px;
  flex:        1;
  min-width:   0;
}
.jalpi-ctrl-row .jalpi-input { flex: 1; min-width: 0; }

/* Remove inner padding and override WP admin min-height for the URL input inside the stacked Link row */
.jalpi-prop-row--stack .jalpi-ctrl-row > .jalpi-input { padding: 0 6px; flex: 1; min-width: 0; }


/* Link field — input + settings + dynamic grouped in one bordered box (Elementor-style) */
.jalpi-link-field .jalpi-ctrl-row {
  border:        1px solid var(--jalpi-border-2);
  border-radius: 4px;
  background:    var(--jalpi-surface-2);
  overflow:      hidden;
  gap:           0;
  height:        30px;
}
.jalpi-link-field .jalpi-ctrl-row > .jalpi-input {
  border:      none;
  background:  transparent;
  box-shadow:  none;
  padding:     0 6px;
  height:      100%;
  color:       var(--jalpi-text);
}
.jalpi-link-field .jalpi-ctrl-row > .jalpi-input:focus { outline: none; box-shadow: none; }
.jalpi-link-field .jalpi-ctrl-row:focus-within {
  border-color: var(--jalpi-accent);
  box-shadow:   0 0 0 2px rgba(var(--jalpi-accent-rgb), 0.12);
}
/* Settings (link) icon button */
.jalpi-link-settings-btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
  width:           24px;
  height:          100%;
  border:          none;
  border-left:     1px solid var(--jalpi-border-2);
  border-radius:   0;
  background:      var(--jalpi-surface-3);
  color:           var(--jalpi-text-muted);
  cursor:          pointer;
  padding:         0;
  transition:      color 0.1s, background 0.1s;
}
.jalpi-link-settings-btn:hover { color: var(--jalpi-accent); background: var(--jalpi-accent-dim); }
/* Dynamic tag button — flush right, same style */
.jalpi-link-field .jalpi-ctrl-row .jalpi-dyntag__btn {
  border:        none;
  border-left:   1px solid var(--jalpi-border-2);
  border-radius: 0;
  background:    var(--jalpi-surface-3);
  height:        100%;
  width:         24px;
  flex-shrink:   0;
}

/* Small square icon button (gear, etc.) */
.jalpi-icon-btn {
  flex-shrink:     0;
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           22px;
  height:          22px;
  border:          1px solid var(--jalpi-border-2);
  border-radius:   5px;
  background:      var(--jalpi-surface-2);
  color:           var(--jalpi-text-muted);
  cursor:          pointer;
  transition:      border-color .15s, color .15s;
}
.jalpi-icon-btn:hover { border-color: var(--jalpi-accent); color: var(--jalpi-accent); }

/* "Open in new tab" checkbox under Link field */
.jalpi-link-newtab {
  display:     inline-flex;
  align-items: center;
  gap:         5px;
  margin-top:  5px;
  font-size:   11px;
  color:       var(--jalpi-text-muted);
  cursor:      pointer;
  user-select: none;
}
.jalpi-link-newtab input { margin: 0; accent-color: var(--jalpi-accent); cursor: pointer; }

/* Dynamic-tag sparkle indicator in label */
.jalpi-dyntag-badge {
  font-size:    9px;
  color:        #a855f7;
  margin-left:  2px;
  vertical-align: middle;
  line-height:  1;
}

/* Toggle button group (Icon Position) */
.jalpi-toggle-group {
  display: flex;
  gap:     3px;
}
.jalpi-toggle-btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           30px;
  height:          26px;
  border:          1px solid var(--jalpi-border-2);
  border-radius:   5px;
  background:      var(--jalpi-surface-2);
  color:           var(--jalpi-text-muted);
  cursor:          pointer;
  transition:      border-color .15s, background .15s, color .15s;
}
.jalpi-toggle-btn:hover { border-color: var(--jalpi-accent); color: var(--jalpi-accent); }
.jalpi-toggle-btn.is-active {
  border-color: var(--jalpi-accent);
  background:   color-mix(in srgb, var(--jalpi-accent) 12%, transparent);
  color:        var(--jalpi-accent);
}

/* Slider + number input row (Icon Spacing) */
.jalpi-slider-row {
  display:     flex;
  align-items: center;
  gap:         8px;
  width:       100%;
}
.jalpi-range {
  flex:             1;
  min-width:        0;
  max-width:        120px;
  height:           3px;
  accent-color:     var(--jalpi-accent);
  cursor:           pointer;
}
.jalpi-slider-row .jalpi-dim-wrap { flex-shrink: 0; }

/* Field note with padding variant */
.jalpi-field-note--pad {
  padding: 0 0 6px;
}

/* ── Panel resizer (between left/right panels and canvas) ────────────────── */

.jalpi-elements-panel-wrap {
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
  height:         100%;
}
.jalpi-elements-panel-wrap .jalpi-elements-panel {
  width: 100%;
  flex:  1;
}

.jalpi-panel-resizer {
  flex-shrink: 0;
  width:       4px;
  cursor:      col-resize;
  background:  transparent;
  position:    relative;
  z-index:     100;
  align-self:  stretch;
}
.jalpi-panel-resizer::after {
  content:    '';
  position:   absolute;
  top:        0;
  bottom:     0;
  left:       1px;
  width:      2px;
  background: transparent;
  transition: background 0.15s;
}
.jalpi-panel-resizer:hover::after,
.jalpi-panel-resizer.is-active::after { background: var(--jalpi-accent); }
.jalpi-panel-resizer.is-active        { background: rgba(124,58,237,0.05); }

/* ── Resize handles ──────────────────────────────────────────────────────── */

/* Section bottom-edge height handle */
.jalpi-rz-handle--h {
  position:        absolute;
  bottom:          0;
  left:            0;
  right:           0;
  height:          8px;
  cursor:          ns-resize;
  display:         flex;
  align-items:     center;
  justify-content: center;
  opacity:         0;
  transition:      opacity 0.15s;
  z-index:         50;
}
/* Show on section hover or selection */
.jalpi-canvas-node--section:hover .jalpi-rz-handle--h,
.jalpi-canvas-node--section.is-selected .jalpi-rz-handle--h,
.jalpi-rz-handle--h.is-dragging { opacity: 1; }

.jalpi-rz-handle__grip {
  width:         40px;
  height:        4px;
  border-radius: 2px;
  background:    var(--jalpi-accent);
  box-shadow:    0 1px 4px rgba(0,0,0,0.2);
}

/* Column resize divider (zero width, overflows visually) */
.jalpi-col-divider {
  position:   relative;
  width:      0;
  align-self: stretch;
  cursor:     col-resize;
  z-index:    50;
  flex-shrink: 0;
}
/* Thin always-visible line */
.jalpi-col-divider::before {
  content:    '';
  position:   absolute;
  top:        0;
  bottom:     0;
  left:       -1px;
  width:      2px;
  background: rgba(0,0,0,0.08);
  transition: background 0.15s;
}
.jalpi-col-divider:hover::before,
.jalpi-col-divider.is-dragging::before {
  background: var(--jalpi-accent);
}
/* Centered grip pill */
.jalpi-col-divider__grip {
  position:   absolute;
  top:        50%;
  left:       50%;
  transform:  translate(-50%, -50%);
  width:      6px;
  height:     36px;
  border-radius: 3px;
  background: transparent;
  transition: background 0.15s;
}
.jalpi-col-divider:hover .jalpi-col-divider__grip,
.jalpi-col-divider.is-dragging .jalpi-col-divider__grip {
  background: var(--jalpi-accent);
  box-shadow: 0 0 0 3px rgba(var(--jalpi-accent-rgb), 0.15);
}

/* Floating tooltip during drag */
.jalpi-rz-tip {
  position:       fixed;
  background:     #1a1a1a;
  color:          #fff;
  font-size:      11px;
  font-family:    var(--jalpi-font, sans-serif);
  padding:        3px 8px;
  border-radius:  4px;
  pointer-events: none;
  white-space:    nowrap;
  z-index:        9999;
  display:        none;
  box-shadow:     0 2px 8px rgba(0,0,0,0.2);
}

/* ── Icon Preview Panel (Properties panel large preview box) ────────────── */
.jalpi-icon-preview-panel {
  position: relative;
  margin: 8px 12px 12px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--jalpi-border, rgba(255,255,255,0.08));
  background-color: var(--jalpi-surface-2, #1c1c1e);
  transition: border-color 0.15s;
}
.jalpi-icon-preview-panel:hover {
  border-color: rgba(255,255,255,0.2);
}
.jalpi-icon-preview-panel__box {
  /* Checkered transparent background */
  background-image:
    linear-gradient(45deg, #2a2a2e 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a2e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a2e 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a2e 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0px;
  background-color: #222224;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  padding: 20px;
}
.jalpi-icon-preview-panel__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--jalpi-text-3, #71717a);
  font-size: 11px;
  user-select: none;
}
.jalpi-icon-preview-panel__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,0.55);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.jalpi-icon-preview-panel:hover .jalpi-icon-preview-panel__remove {
  opacity: 1;
}

/* ── Interaction Engine (AnimationTab in PropertiesPanel.tsx) ──────────────── */

.jalpi-ia-hint {
  font-size:  11.5px;
  color:      var(--jalpi-text-3);
  margin:     0 0 10px;
  line-height: 1.5;
}

.jalpi-ia-presets {
  display:  flex;
  flex-wrap: wrap;
  gap:      6px;
}
.jalpi-ia-preset-btn {
  padding:       5px 12px;
  background:    var(--jalpi-surface-2);
  border:        1px solid var(--jalpi-border-2);
  border-radius: 20px;
  font-size:     11.5px;
  font-weight:   500;
  color:         var(--jalpi-text-2);
  cursor:        pointer;
}
.jalpi-ia-preset-btn:hover { color: var(--jalpi-accent); border-color: var(--jalpi-accent); }

.jalpi-ia-rule {
  border:        1px solid var(--jalpi-border);
  border-radius: 9px;
  overflow:      hidden;
  margin-bottom: 8px;
  transition:    border-color 0.12s;
}
.jalpi-ia-rule:last-child { margin-bottom: 10px; }
.jalpi-ia-rule.is-open     { border-color: rgba(var(--jalpi-accent-rgb), 0.4); }
.jalpi-ia-rule.is-disabled { opacity: 0.55; }

.jalpi-ia-rule__header {
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     9px 10px;
  cursor:      pointer;
  transition:  background 0.1s;
}
.jalpi-ia-rule__header:hover { background: var(--jalpi-hover); }

.jalpi-ia-rule__title {
  flex:        1;
  min-width:   0;
  font-size:   12px;
  font-weight: 600;
  color:       var(--jalpi-text);
  overflow:    hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jalpi-ia-rule__toggle { display: inline-flex; }

.jalpi-ia-rule__del {
  width:           24px;
  height:          24px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  background:      transparent;
  border:          none;
  border-radius:   5px;
  cursor:          pointer;
  color:           var(--jalpi-text-3);
  opacity:         0;
  transition:      opacity 0.12s, background 0.12s, color 0.12s;
}
.jalpi-ia-rule__header:hover .jalpi-ia-rule__del { opacity: 1; }
.jalpi-ia-rule__del:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

.jalpi-ia-rule__chevron {
  flex-shrink: 0;
  color:       var(--jalpi-text-3);
  transition:  transform 0.18s;
}
.jalpi-ia-rule.is-open .jalpi-ia-rule__chevron { transform: rotate(180deg); }

.jalpi-ia-rule__body {
  padding:    10px 10px 12px;
  border-top: 1px solid var(--jalpi-border);
  background: var(--jalpi-surface-2);
}

/* ── Interaction rule move-up/down + restart-preview (Phase X) ────────── */
.jalpi-ia-rule__order {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.jalpi-ia-rule__order button {
  border: none; background: none; cursor: pointer; padding: 1px 2px;
  color: var(--jalpi-text-dim); display: flex; align-items: center; justify-content: center;
}
.jalpi-ia-rule__order button:hover:not(:disabled) { color: var(--jalpi-text); }
.jalpi-ia-rule__order button:disabled { opacity: 0.25; cursor: default; }

.jalpi-ia-rule__restart {
  border: 1px solid var(--jalpi-border-2);
  background: var(--jalpi-surface);
  border-radius: var(--jalpi-radius-sm);
  color: var(--jalpi-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  margin: 6px 0 2px;
}
.jalpi-ia-rule__restart:hover { color: var(--jalpi-text); border-color: var(--jalpi-border-3); background: var(--jalpi-surface-3); }
.jalpi-ia-rule__restart svg { flex-shrink: 0; }

/* ── Animation Preset Picker (Phase X) ──────────────────────────────────
   Entrance is gated behind prefers-reduced-motion, matching the pattern
   already used on the public frontend (assets/css/frontend.css) — the
   editor's own stylesheet doesn't do this elsewhere yet, but new work here
   shouldn't add to that gap. Tokens used below are all real, defined
   :root custom properties (never --jalpi-panel/--jalpi-text-1/2/3/--jalpi-
   hover, which are referenced but undefined elsewhere in this file). */
.jalpi-ap-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.jalpi-ap-modal {
  width: 100%; max-width: 640px; max-height: 80vh;
  background: var(--jalpi-surface);
  border: 1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-lg);
  box-shadow: var(--jalpi-shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .jalpi-ap-modal { animation: jalpi-ap-modal-in 0.16s cubic-bezier(.4,0,.2,1) both; }
}
@keyframes jalpi-ap-modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.jalpi-ap-modal__header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--jalpi-border);
}
.jalpi-ap-search {
  flex: 1;
  border: 1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--jalpi-text);
  background: var(--jalpi-surface-2);
}
.jalpi-ap-search:focus-visible { outline: 2px solid var(--jalpi-accent); outline-offset: 1px; }
.jalpi-ap-close {
  border: none; background: none; cursor: pointer; flex-shrink: 0;
  color: var(--jalpi-text-muted); padding: 6px; border-radius: var(--jalpi-radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.jalpi-ap-close:hover { color: var(--jalpi-text); background: var(--jalpi-surface-3); }
.jalpi-ap-close:focus-visible, .jalpi-ap-cat:focus-visible, .jalpi-ap-item:focus-visible {
  outline: 2px solid var(--jalpi-accent); outline-offset: 1px;
}

.jalpi-ap-cats {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--jalpi-border);
}
.jalpi-ap-cat {
  border: 1px solid var(--jalpi-border-2);
  background: var(--jalpi-surface);
  color: var(--jalpi-text-muted);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
}
.jalpi-ap-cat:hover { color: var(--jalpi-text); }
.jalpi-ap-cat.is-active { background: var(--jalpi-accent); border-color: var(--jalpi-accent); color: #fff; }

.jalpi-ap-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; padding: 14px;
}
.jalpi-ap-item {
  border: 1px solid var(--jalpi-border-2);
  background: var(--jalpi-surface-2);
  border-radius: var(--jalpi-radius);
  padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
}
.jalpi-ap-item:hover { border-color: var(--jalpi-accent); background: var(--jalpi-surface); transform: translateY(-1px); }
.jalpi-ap-item__stage {
  width: 100%; height: 40px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.jalpi-ap-item__box {
  width: 22px; height: 22px;
  background: var(--jalpi-accent);
  border-radius: 5px;
  display: inline-block;
}
.jalpi-ap-item__label { font-size: 11.5px; color: var(--jalpi-text-muted); text-align: center; }

.jalpi-ap-count {
  padding: 8px 14px; margin: 0;
  font-size: 11.5px; color: var(--jalpi-text-dim);
  border-top: 1px solid var(--jalpi-border);
}

/* ── Timeline Editor (Phase X) — bottom dock, no persisted timeline data:
   every bar here is a direct view of a child's own interaction rule delay/
   duration (see TimelinePanel.tsx's header comment). ─────────────────── */
.jalpi-tl-overlay {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9500;
  display: flex; justify-content: center;
  pointer-events: none;
}
.jalpi-tl-panel {
  pointer-events: auto;
  width: 100%; max-width: 1100px; max-height: 46vh;
  background: var(--jalpi-surface);
  border: 1px solid var(--jalpi-border-2);
  border-bottom: none;
  border-radius: var(--jalpi-radius-lg) var(--jalpi-radius-lg) 0 0;
  box-shadow: var(--jalpi-shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .jalpi-tl-panel { animation: jalpi-tl-in 0.18s cubic-bezier(.4,0,.2,1) both; }
}
@keyframes jalpi-tl-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.jalpi-tl-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--jalpi-border);
  flex-shrink: 0;
}
.jalpi-tl-title { font-weight: 600; font-size: 13px; color: var(--jalpi-text); margin-right: 4px; }
.jalpi-tl-trigger {
  border: 1px solid var(--jalpi-border-2); border-radius: var(--jalpi-radius-sm);
  background: var(--jalpi-surface-2); color: var(--jalpi-text); font-size: 12px; padding: 5px 6px;
}
.jalpi-tl-btn {
  border: 1px solid var(--jalpi-border-2); background: var(--jalpi-accent); color: #fff;
  border-radius: var(--jalpi-radius-sm); padding: 6px 14px; font-size: 12px; cursor: pointer;
}
.jalpi-tl-btn--sm { padding: 4px 9px; background: var(--jalpi-surface); color: var(--jalpi-text); }
.jalpi-tl-btn--sm:hover { background: var(--jalpi-surface-3); }
.jalpi-tl-stagger {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--jalpi-text-muted);
  margin-left: auto;
}
.jalpi-tl-stagger input {
  width: 56px; border: 1px solid var(--jalpi-border-2); border-radius: var(--jalpi-radius-sm);
  padding: 4px 6px; font-size: 12px; background: var(--jalpi-surface-2); color: var(--jalpi-text);
}
.jalpi-tl-close {
  border: none; background: none; cursor: pointer; color: var(--jalpi-text-muted); padding: 6px;
  border-radius: var(--jalpi-radius-sm); display: flex; align-items: center; justify-content: center;
}
.jalpi-tl-close:hover { color: var(--jalpi-text); background: var(--jalpi-surface-3); }
.jalpi-tl-close:focus-visible, .jalpi-tl-btn:focus-visible, .jalpi-tl-trigger:focus-visible {
  outline: 2px solid var(--jalpi-accent); outline-offset: 1px;
}

.jalpi-tl-ruler {
  position: relative; height: 22px; flex-shrink: 0;
  border-bottom: 1px solid var(--jalpi-border); background: var(--jalpi-surface-2);
}
.jalpi-tl-ruler__tick {
  position: absolute; top: 4px; font-size: 10px; color: var(--jalpi-text-dim);
  font-family: var(--jalpi-mono); transform: translateX(-50%);
}
.jalpi-tl-playhead {
  position: absolute; top: 0; bottom: -1000px; width: 2px; background: var(--jalpi-danger);
  pointer-events: none;
}

.jalpi-tl-tracks { flex: 1; overflow: auto; }
.jalpi-tl-track {
  display: flex; align-items: center; border-bottom: 1px solid var(--jalpi-border);
  min-height: 40px;
}
.jalpi-tl-track__label {
  width: 160px; flex-shrink: 0; padding: 0 12px; font-size: 12px; color: var(--jalpi-text-muted);
  text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.jalpi-tl-track__lane { position: relative; height: 40px; flex-shrink: 0; }
.jalpi-tl-track__add {
  position: absolute; left: 0; top: 6px;
  border: 1px dashed var(--jalpi-border-3); background: none; color: var(--jalpi-text-dim);
  border-radius: var(--jalpi-radius-sm); padding: 5px 10px; font-size: 11.5px; cursor: pointer;
}
.jalpi-tl-track__add:hover { color: var(--jalpi-text); border-color: var(--jalpi-accent); }

.jalpi-tl-bar {
  position: absolute; top: 6px; height: 28px;
  background: var(--jalpi-accent-dim); border: 1.5px solid var(--jalpi-accent);
  border-radius: var(--jalpi-radius-sm); cursor: grab;
}
.jalpi-tl-bar:active { cursor: grabbing; }
.jalpi-tl-bar__handle {
  position: absolute; right: -3px; top: 0; bottom: 0; width: 8px; cursor: ew-resize;
}

/* Icon Box canvas preview — make the chosen icon fill its sized box
   regardless of icon type (built-in SVGs have a viewBox but often no explicit
   width/height; font icons inherit font-size). Mirrors the frontend rule in
   assets/css/frontend.css so the editor preview matches the published output. */
.jalpi-iconbox-preview svg,
.jalpi-iconbox-preview img { width: 100%; height: 100%; display: block; }
.jalpi-iconbox-preview i  { font-size: var(--jalpi-ib-size, 48px); line-height: 1; }

/* ── Multi-icon picker control (schema-widget content editor) ──────────── */
.jalpi-multiicon {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
}
.jalpi-multiicon__chip {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; cursor: pointer;
  border: 1px solid var(--jalpi-border-2); border-radius: var(--jalpi-radius-sm);
  background: var(--jalpi-surface); color: var(--jalpi-text-muted);
  transition: border-color .12s, background .12s, color .12s, transform .12s;
}
.jalpi-multiicon__chip:hover { border-color: var(--jalpi-border-3); transform: translateY(-1px); }
.jalpi-multiicon__chip.is-on { color: #fff; }
.jalpi-multiicon__chip:focus-visible { outline: 2px solid var(--jalpi-accent); outline-offset: 1px; }
.jalpi-multiicon__glyph {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; line-height: 1;
}
.jalpi-multiicon__label { font-size: 10px; text-align: center; line-height: 1.1; }

/* Segmented button group (Elementor-style background "Type" switcher).
   Single-select pills sharing one bordered track; active pill filled. */
.jalpi-btngroup {
  display: flex;
  width: 100%;
  gap: 0;
  border: 1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  overflow: hidden;
  background: var(--jalpi-surface);
}
.jalpi-btngroup__btn {
  flex: 1 1 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 8px; cursor: pointer;
  border: 0; background: transparent;
  color: var(--jalpi-text-muted);
  font-size: 12px; font-weight: 500; line-height: 1;
  transition: background .12s, color .12s;
}
.jalpi-btngroup__btn + .jalpi-btngroup__btn { border-left: 1px solid var(--jalpi-border-2); }
.jalpi-btngroup__btn:hover { background: var(--jalpi-hover, rgba(0,0,0,.04)); color: var(--jalpi-text); }
.jalpi-btngroup__btn.is-active { background: var(--jalpi-accent); color: #fff; }
.jalpi-btngroup__btn:focus-visible { outline: 2px solid var(--jalpi-accent); outline-offset: -2px; }
.jalpi-btngroup__glyph { font-size: 13px; line-height: 1; }

/* Schema color control — a compact swatch (Elementor-style) rather than a
   full-width bar. Left-aligned within its control column. */
.jalpi-input--color {
  width: 56px;
  min-width: 56px;
  flex: 0 0 auto;
  padding: 2px;
  cursor: pointer;
}

/* Schema slider — single row: the track flexes to fill, with a compact number
   box pinned to the right (Elementor-style inline slider). */
.jalpi-slider-dim--compact {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.jalpi-slider-dim--compact .jalpi-slider-dim__track {
  flex: 1 1 auto;
  min-width: 0;
}
.jalpi-slider-dim--compact .jalpi-slider-dim__row {
  width: 90px;
  flex: 0 0 auto;
  height: 34px;
}
.jalpi-slider-dim--compact .jalpi-slider-dim__num {
  text-align: center;
  padding: 4px 8px;
}
.jalpi-slider-dim--compact .jalpi-slider-dim__unit {
  padding: 0 6px;
  font-size: 11px;
}

/* Elementor-style repeater (Social Icons list). Collapsible items with a header
   row (glyph + name + duplicate/delete) and an "+ Add Item" button. */
.jalpi-repeater { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.jalpi-repeater__item {
  border: 1px solid var(--jalpi-border-2);
  border-radius: var(--jalpi-radius-sm);
  background: var(--jalpi-surface);
  overflow: hidden;
}
.jalpi-repeater__head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; cursor: pointer; user-select: none;
}
.jalpi-repeater__head:hover { background: var(--jalpi-hover, rgba(0,0,0,.03)); }
.jalpi-repeater__glyph {
  width: 18px; text-align: center; font-weight: 700; font-size: 13px; line-height: 1; flex: 0 0 auto;
}
.jalpi-repeater__name { flex: 1 1 auto; font-size: 12px; font-weight: 500; color: var(--jalpi-text); min-width: 0; }
.jalpi-repeater__btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; border: 0; background: transparent;
  color: var(--jalpi-text-muted); cursor: pointer; border-radius: 4px;
}
.jalpi-repeater__btn:hover { background: var(--jalpi-hover, rgba(0,0,0,.06)); color: var(--jalpi-text); }
.jalpi-repeater__body {
  padding: 10px; border-top: 1px solid var(--jalpi-border-2);
  background: var(--jalpi-surface-2, var(--jalpi-surface));
}
.jalpi-repeater__picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px;
  padding: 8px; border: 1px dashed var(--jalpi-border-3, var(--jalpi-border-2)); border-radius: var(--jalpi-radius-sm);
}
.jalpi-repeater__pick {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; cursor: pointer;
  border: 1px solid var(--jalpi-border-2); border-radius: var(--jalpi-radius-sm);
  background: var(--jalpi-surface); color: var(--jalpi-text); font-size: 11px;
}
.jalpi-repeater__pick:hover { border-color: var(--jalpi-accent); }
.jalpi-repeater__add {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 12px; cursor: pointer;
  border: 1px dashed var(--jalpi-border-3, var(--jalpi-border-2)); border-radius: var(--jalpi-radius-sm);
  background: transparent; color: var(--jalpi-accent); font-size: 12px; font-weight: 600;
}
.jalpi-repeater__add:hover:not(:disabled) { background: var(--jalpi-accent-dim, rgba(0,0,0,.03)); }
.jalpi-repeater__add:disabled { opacity: .5; cursor: not-allowed; }

/* Separate the fields that follow a repeater (e.g. Social Share's Style / Shape
   rows after the "+ Add Item" button) so they don't crowd the repeater. */
.jalpi-repeater + .jalpi-prop-row { margin-top: 14px; }

/* ═══════════════════════════════════════════════════════════════════════════
   Template Library — categories, tags, favourites, grid/list, infinite scroll
   Appended after the base rules so these win without !important.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Category pills wrap onto multiple rows: there are 24 categories. */
.jalpi-tpl-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.jalpi-tpl-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid #e3e5e8;
  border-radius: 999px;
  background: #fff;
  color: #3c434a;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.jalpi-tpl-cat-btn:hover { background: #f4f6f8; border-color: #c9ced4; }
.jalpi-tpl-cat-btn.is-active { background: #2563eb; border-color: #2563eb; color: #fff; }

.jalpi-tpl-cat-btn__count {
  min-width: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .08);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}
.jalpi-tpl-cat-btn.is-active .jalpi-tpl-cat-btn__count { background: rgba(255, 255, 255, .25); }

/* Scope tabs (All / Favorites / Recently Used) and the grid-list toggle. */
.jalpi-tpl-scope,
.jalpi-tpl-viewmode {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid #e3e5e8;
  border-radius: 8px;
  background: #f6f7f8;
}

.jalpi-tpl-scope__btn,
.jalpi-tpl-viewmode__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #50575e;
  font-size: 12px;
  cursor: pointer;
}
.jalpi-tpl-scope__btn.is-active,
.jalpi-tpl-viewmode__btn.is-active {
  background: #fff;
  color: #1d2327;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

/* Tag filter row */
.jalpi-tpl-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
}
.jalpi-tpl-tags__label {
  color: #787c82;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.jalpi-tpl-tag {
  padding: 3px 9px;
  border: 1px solid #e3e5e8;
  border-radius: 999px;
  background: #fff;
  color: #50575e;
  font-size: 11px;
  cursor: pointer;
}
.jalpi-tpl-tag:hover { background: #f4f6f8; }
.jalpi-tpl-tag.is-active { background: #1d2327; border-color: #1d2327; color: #fff; }

/* Favourite star, pinned to the thumbnail. */
.jalpi-tpl-card__thumb { position: relative; }
.jalpi-tpl-card__fav {
  position: absolute;
  top: 7px;
  right: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #6b7280;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease, transform .15s ease;
}
.jalpi-tpl-card:hover .jalpi-tpl-card__fav,
.jalpi-tpl-card__fav:focus-visible { opacity: 1; }
.jalpi-tpl-card__fav.is-on { opacity: 1; color: #f59e0b; }
.jalpi-tpl-card__fav:hover { transform: scale(1.08); }

/* Per-card tag chips */
.jalpi-tpl-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.jalpi-tpl-card__tag {
  padding: 2px 7px;
  border: 0;
  border-radius: 4px;
  background: #f0f1f3;
  color: #646970;
  font-size: 10px;
  cursor: pointer;
}
.jalpi-tpl-card__tag:hover { background: #e2e4e7; color: #1d2327; }

/* List view: one row per template, thumbnail on the left. */
.jalpi-tpl-grid.is-list { grid-template-columns: 1fr; }
.jalpi-tpl-grid.is-list .jalpi-tpl-card {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 14px;
}
.jalpi-tpl-grid.is-list .jalpi-tpl-card__thumb { height: 86px; }
.jalpi-tpl-grid.is-list .jalpi-tpl-card__actions {
  border-top: 0;
  padding-right: 12px;
}

/* Infinite-scroll sentinel + end cap */
.jalpi-tpl-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
}
.jalpi-tpl-endcap {
  margin: 16px 0 4px;
  color: #8c8f94;
  font-size: 12px;
  text-align: center;
}

/* Narrow panels: stack the filter bar and drop to a single column. */
@media (max-width: 782px) {
  .jalpi-tpl-grid.is-list .jalpi-tpl-card {
    grid-template-columns: 96px 1fr;
  }
  .jalpi-tpl-grid.is-list .jalpi-tpl-card__actions {
    grid-column: 1 / -1;
    padding: 0 12px 12px;
  }
}


/* "Browse Templates" entry in the add-section picker. */
.jalpi-qadd__templates {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid #d5d9de;
  border-radius: 7px;
  background: #fff;
  color: #1d2327;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.jalpi-qadd__templates:hover { background: #f4f6f8; border-color: #b8bfc7; }

/* ═══════════════════════════════════════════════════════════════════════════
   Template Library — sidebar layout
   A flat chip bar wrapped onto 5 rows and ate 59% of the modal, so categories
   moved into a scrollable sidebar grouped by kind. Empty categories are not
   rendered at all, so the list only shows destinations worth clicking.
   ═══════════════════════════════════════════════════════════════════════════ */

.jalpi-tpl-main {
  display: flex;
  flex: 1;
  min-height: 0;          /* lets the children scroll instead of the modal */
}

.jalpi-tpl-side {
  flex: 0 0 208px;
  overflow-y: auto;
  padding: 12px 10px 16px;
  border-right: 1px solid #eceef0;
  background: #fbfbfc;
}

.jalpi-tpl-side__group { margin-top: 14px; }

.jalpi-tpl-side__title {
  display: block;
  padding: 0 10px 6px;
  color: #8c8f94;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.jalpi-tpl-side__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #2c3338;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background .13s ease, color .13s ease;
}
.jalpi-tpl-side__item:hover { background: #f0f1f3; }
.jalpi-tpl-side__item.is-active { background: #2563eb; color: #fff; font-weight: 600; }

.jalpi-tpl-side__count {
  flex: none;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .07);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}
.jalpi-tpl-side__item.is-active .jalpi-tpl-side__count { background: rgba(255, 255, 255, .26); }

/* Right-hand column: slim toolbar above the scrolling grid. */
.jalpi-tpl-content {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.jalpi-tpl-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid #eceef0;
}
.jalpi-tpl-toolbar__count {
  flex: 1;
  color: #646970;
  font-size: 12px;
}

/* The body now scrolls inside the content column. */
.jalpi-tpl-main .jalpi-tpl-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Narrow editors: sidebar becomes a horizontal strip above the grid. */
@media (max-width: 900px) {
  /* min-height:0 is required on BOTH axes here: without it the stacked body
     grows to its content height (measured ~3x the modal) instead of scrolling
     inside the modal. */
  .jalpi-tpl-main { flex-direction: column; min-height: 0; }
  .jalpi-tpl-content { min-height: 0; }
  .jalpi-tpl-side {
    flex: none;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 9px 12px;
    border-right: 0;
    border-bottom: 1px solid #eceef0;
    white-space: nowrap;
  }
  .jalpi-tpl-side__group { display: flex; gap: 6px; margin-top: 0; }
  .jalpi-tpl-side__title { display: none; }
  .jalpi-tpl-side__item { width: auto; padding: 6px 11px; border-radius: 999px; }
}

/* Card meta: stack name → badges → tags. The base rule lays these out in a
   row with space-between, which made the category badge and tag chips collide
   with the template name once tags were added. */
.jalpi-tpl-grid .jalpi-tpl-card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}
.jalpi-tpl-grid .jalpi-tpl-card__name {
  display: block;
  width: 100%;
  overflow: hidden;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jalpi-tpl-grid .jalpi-tpl-card__tags { margin-top: 0; }

/* List view keeps the meta column left-aligned beside the thumbnail. */
.jalpi-tpl-grid.is-list .jalpi-tpl-card__meta { padding: 10px 14px 10px 0; }
