/* ============================================================
   慧港教练 · 网页中台 拖拽装修器样式
   依赖 app.css 的变量与通用类（.btn / .field / .flabel / .fctl / .sw / .note / .fimg / .fcolor / .fro）

   ★ 2026-10-29 布局改造：对标拾东集（凡科门店装修器式）的画布与排版模式
     —— 三栏网格 + 竖排导轨 + 面板化三段式 + 宫格组件库 + 画布外悬浮工具条
     —— 仅改布局与排版，服务端接口、数据、业务逻辑一律不动

   布局结构（与拾东集 .b-* 同构，沿用慧港的 bl-* 前缀）：
     .builder            三栏网格容器
     .bl-panel           通用面板（头 .ph / 体 .pb）
       .bl-rail          左栏竖排导轨（模块/页面/风格/控件）
       .bl-pane-wrap     导轨右侧内容区
       .bl-pane          单个面板（同一时刻只显示一个）
     .bl-canvas-panel    中：画布
     .bl-props-panel     右：属性
   ============================================================ */

/* ============================================================
   一、外壳与三栏网格
   ============================================================ */
.builder {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(400px, 470px);
  gap: 16px;
  flex: 1;
  min-height: 0;
}
/* 属性面板收起时，中间画布吃掉多出来的宽度 */
.builder.no-props { grid-template-columns: minmax(300px, 340px) minmax(0, 1fr); }
.builder.no-props .bl-props-panel { display: none; }

/* 顶栏独占一行，不参与三栏网格 */
.bl-top {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #EDF1F6;
  border-radius: 16px;
  box-shadow: var(--sh);
  flex-shrink: 0;
}

/* ---------------- 通用面板 ---------------- */
.bl-panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #EDF1F6;
}
/* 面板头 */
.bl-panel .ph {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #FFFFFF, #FAFBFD);
  flex-shrink: 0;
}
.bl-panel .ph .b-ph-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bl-panel .ph .b-ph-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* 面板体（各自滚动，三列互不影响） */
.bl-panel .pb {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.bl-panel .pb::-webkit-scrollbar { width: 8px; }
.bl-panel .pb::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 4px; }

/* ---------------- 顶栏内容 ---------------- */
.bl-pages {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  padding-bottom: 2px;
}
.bl-pages::-webkit-scrollbar { height: 5px; }
.bl-pages::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 3px; }

.bl-page {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 12px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  background: #fff;
  color: var(--text2);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.bl-page:hover { border-color: var(--brand-l); color: var(--brand); }
.bl-page i {
  font-style: normal;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #EEF2F6;
  color: var(--sub);
}
.bl-page.on {
  background: linear-gradient(135deg, var(--brand-d) 0%, var(--brand) 100%);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(48, 104, 184, .28);
}
.bl-page.on i { background: rgba(255, 255, 255, .22); color: #fff; }

.bl-top-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.bl-status {
  font-size: 12px;
  color: var(--sub);
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg);
  white-space: nowrap;
}
.bl-status.dirty { background: var(--gold-bg); color: var(--gold); font-weight: 600; }

/* ============================================================
   二、左栏：竖排导轨 + 面板切换（对标拾东集 .b-rail / .b-pane）
   ============================================================ */
.bl-lib-panel { flex-direction: row; }

/* 竖排导轨：68px 窄条 */
.bl-rail {
  width: 68px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: linear-gradient(180deg, #F7FAFD, #FFFFFF);
  border-right: 1px solid var(--line);
}
.bl-rail-item {
  width: 56px;
  padding: 9px 2px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--sub);
  transition: .15s;
  user-select: none;
}
.bl-rail-item .ic { font-size: 17px; line-height: 1; }
.bl-rail-item .nm { font-size: 11px; font-weight: 500; }
.bl-rail-item:hover { background: var(--brand-bg); color: var(--brand); }
.bl-rail-item.on {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(48, 104, 184, .26);
}

/* 导轨右侧内容区 */
.bl-pane-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bl-pane {
  display: none;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.bl-pane.on { display: flex; }

/* ---------------- 左栏：模块页签（胶囊分段，拾东集同款） ---------------- */
.bl-pal-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px 8px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.bl-pal-tab {
  flex: 1;
  text-align: center;
  padding: 7px 4px;
  font-size: 13px;
  font-weight: 500;
  color: #4E5969;
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  transition: color .15s, background .15s;
}
.bl-pal-tab:hover { color: var(--brand); background: var(--brand-bg); }
.bl-pal-tab.on {
  color: #fff;
  background: var(--brand);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(48, 104, 184, .28);
}

/* 组件分组标题：小圆点 + 深字 */
.pal-group { margin-bottom: 16px; }
.pal-group .gt {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #1A2233;
  margin: 0 0 10px;
  letter-spacing: 0;
}
.pal-group .gt::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #C0C8D4;
  flex: none;
}

/* 组件宫格：方块、图标上文字下（拾东集同款规格） */
.pal-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 9px;
}
.pal {
  border: 1px solid #E5E6EB;
  border-radius: 8px;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: grab;
  background: #fff;
  font-size: 12px;
  color: #333;
  user-select: none;
  text-align: center;
  line-height: 1.3;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.pal:hover {
  border-color: var(--brand);
  background: #F5F9FF;
  box-shadow: 0 2px 8px rgba(48, 104, 184, .10);
}
.pal:active { cursor: grabbing; }
.pal .ic { font-size: 20px; line-height: 1; }
.pal .nm { font-weight: 500; color: #333; }
.pal.dragging { opacity: .4; border-style: dashed; }

/* 组件说明（面板体内的脚注） */
.bl-lib-note {
  margin: 12px 0 2px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--brand-bg);
  color: #2B5A9E;
  font-size: 11px;
  line-height: 1.7;
  border: 1px solid #CFE0F5;
}

/* ---------------- 左栏：页面列表面板 ---------------- */
.bl-pagelist { padding: 4px 0; }
.bl-pl-hd {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
  color: var(--text2);
}
.bl-pl-hd:hover { background: #F2F7FD; }
.bl-pl-hd .nm { font-weight: 700; letter-spacing: .5px; }
.bl-pl-hd .cur {
  color: var(--brand);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bl-pl-hd .ar { margin-left: auto; color: #8A94A6; font-size: 11px; }
.bl-pl-hd .st { font-size: 10.5px; padding: 1px 7px; border-radius: 20px; white-space: nowrap; }
.bl-pl-hd .st.ok { background: var(--ok-bg); color: var(--ok); }
.bl-pl-hd .st.draft { background: var(--gold-bg); color: var(--gold); }

.bl-pl-body { padding: 2px 8px 8px; max-height: none; }
.bl-pl-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 9px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  border: 1px solid transparent;
}
.bl-pl-item:hover { background: #F2F7FD; border-color: #DCE8F6; }
.bl-pl-item.on {
  background: var(--brand-bg);
  border-color: #B8D6F5;
  color: var(--brand);
  font-weight: 600;
}
.bl-pl-item .no { width: 14px; text-align: right; color: #A8B0BE; font-size: 11px; flex: none; }
.bl-pl-item.on .no { color: var(--brand); }
.bl-pl-item .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bl-pl-item .tab {
  font-size: 10.5px;
  color: #7C8AA0;
  background: #F1F5FA;
  border-radius: 6px;
  padding: 1px 6px;
  flex: none;
}
.bl-pl-item .st { font-size: 10.5px; padding: 1px 6px; border-radius: 20px; flex: none; }
.bl-pl-item .st.ok { background: var(--ok-bg); color: var(--ok); }
.bl-pl-item .st.draft { background: #F1F3F5; color: #6B7280; }
.bl-pl-tip { font-size: 11px; color: #98A2B3; line-height: 1.6; padding: 8px 9px 2px; }

/* ---------------- 左栏：风格面板 ---------------- */
.bl-style-group { margin-bottom: 16px; }
.bl-style-group .gt {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #1A2233;
  margin: 0 0 10px;
}
.bl-style-group .gt::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #C0C8D4;
  flex: none;
}
.bl-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.bl-swatch {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(27, 58, 99, .14);
  transition: .15s;
}
.bl-swatch:hover { transform: translateY(-1px); }
.bl-swatch.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-bg); }

/* ============================================================
   三、中栏：画布面板
   ============================================================ */
.bl-canvas-panel { position: relative; }

.bl-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* ★ 2026-10-30 右侧预留工具通道（58px = 20px 常规内边距 + 38px 工具条位）
     为什么预留：手机框宽度固定 375px，画布面板一窄手机框就居中不下、
     会溢出面板，工具条就没地方放（之前只能压到真机画面上）。
     右侧留出一条固定通道，工具条永远有家 —— 既不压画面，也不压属性面板。 */
  padding: 20px 58px 20px 20px;
  background:
    linear-gradient(0deg, rgba(48, 104, 184, .035), rgba(48, 104, 184, .035)),
    repeating-linear-gradient(45deg, #F7FAFD 0 12px, #F2F6FB 12px 24px);
}
.bl-scroll::-webkit-scrollbar { width: 8px; }
.bl-scroll::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 4px; }

/* 手机外框
   ⚠ 宽度固定 375px：这是小程序真机最常用的逻辑宽度，
     预览页里的 1rpx = 100vw/750 直接落到 0.5px，与真机像素级一致。
     随手改宽会同时改变所有 rpx 的换算结果 —— 看起来"只是画布宽了点"，
     实际上整页比例都变了，反而更难发现。 */
.phone {
  width: 375px;
  margin: 0 auto;
  background: #fff;
  border-radius: 30px;
  box-shadow: 0 14px 40px rgba(27, 58, 99, .18), 0 0 0 9px #1F2C3D, 0 0 0 11px #35455B;
  overflow: hidden;
  position: relative;
}
.phone-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px 6px;
  font-size: 11px;
  color: #fff;
  background: var(--brand-d);
  letter-spacing: .3px;
}
.phone-title { font-weight: 600; font-size: 12px; }

/* 画布：iframe 直接渲染小程序的真实组件，故此处**不加任何内边距**。
   曾经这里写 padding: 12px 14px，是给手写近似预留的；
   现在是真机同源渲染，任何额外内边距都会让画布与真机差一圈。 */
.phone-body {
  position: relative;
  min-height: 420px;
  padding: 0;
  background: #f4f6f9;
}
.bl-frame {
  display: block;
  width: 100%;
  height: 640px;
  border: 0;
  background: #f4f6f9;
}

/* 模块操作层：透明覆盖在 iframe 上，按 iframe 内实测的模块位置摆放 */
.bl-overlay { position: absolute; inset: 0; pointer-events: none; }
.bl-slot {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: auto;
  border-radius: 6px;
}
.bl-slot:hover { box-shadow: inset 0 0 0 2px rgba(48, 104, 184, .35); }
.bl-slot.on { box-shadow: inset 0 0 0 2px var(--brand); }
.bl-slot.hidden-mod { background: repeating-linear-gradient(45deg, rgba(94,107,126,.06) 0 8px, transparent 8px 16px); }
.bl-slot.hidden-mod.on { box-shadow: inset 0 0 0 2px var(--sub); }

/* 槽位上的小拖拽手柄（★ 2026-10-29 布局改造）
   原先模块内嵌一整条操作横条，压住模块顶部约 26px，遮住商品图与标题。
   现在操作入口搬到画布外的竖排悬浮工具条（.bl-cbar），
   槽位上只留这一个 16px 的小手柄，鼠标移入才显现，基本不挡内容。 */
.bl-slot-hnd {
  position: absolute;
  top: 2px;
  left: 4px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: rgba(48, 104, 184, .82);
  color: #fff;
  font-size: 9px;
  letter-spacing: -1px;
  cursor: grab;
  user-select: none;
  opacity: 0;
  transition: opacity .12s;
}
.bl-slot:hover .bl-slot-hnd { opacity: 1; }
.bl-slot.on .bl-slot-hnd { opacity: 1; }
.bl-slot-hnd:active { cursor: grabbing; }

/* ★ 2026-10-30：模块右上角的「✎ 内容」标记
   —— 让运营一眼看出"这个模块可以单独打开编辑"，双击它也会打开编辑弹窗。 */
.bl-slot-edit {
  position: absolute;
  top: 2px;
  right: 4px;
  height: 16px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  border-radius: 5px;
  background: rgba(31, 36, 46, .78);
  color: #DCE4EF;
  font-size: 9.5px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transition: opacity .12s, background .12s;
}
.bl-slot:hover .bl-slot-edit { opacity: 1; }
.bl-slot-edit:hover { background: rgba(48, 104, 184, .92); color: #fff; }

/* 未渲染模块（隐藏 / 渲染为空 / 渲染失败）：无法在 iframe 里定位，单独列在画布上方 */
.bl-ghosts {
  max-width: 375px;
  margin: 0 auto 10px;
}
.bl-ghost {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #FFF8E8;
  border: 1px solid #EFDCB4;
  font-size: 11.5px;
  color: #8A5D13;
  cursor: pointer;
}
.bl-ghost.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(200,135,30,.25); }
.bl-ghost b {
  font-weight: 600;
  color: #7A4E08;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bl-ghost .g-why {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #A8843C;
}
.bl-ghost .g-ops { margin-left: auto; display: flex; gap: 2px; flex-shrink: 0; }
.bl-ghost .g-ops button {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #E4CFA2;
  border-radius: 5px;
  background: #fff;
  color: #8A5D13;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.bl-ghost .g-ops button:hover { border-color: var(--gold); background: #FFF3DA; }
.bl-ghost .g-ops button.dg:hover { border-color: var(--warn); color: #fff; background: var(--warn); }

/* 手机壳自带的 mock 底栏已删除：底栏由画布 iframe 内的 app-tabbar 组件真源码渲染 */

/* 空态
   注意：它现在画在 .bl-overlay 里（盖在空 iframe 上），而不是取代画布容器。
   如果画布渲染失败，同一个位置会显示失败原因 —— 两者都要求"可见"，
   白屏是最糟的结果：运营分不清是"这个页面没配东西"还是"渲染挂了"。 */
.bl-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--sub2);
  font-size: 13px;
  line-height: 2;
  border: 2px dashed var(--line2);
  border-radius: var(--r);
  background: #fff;
}
.bl-overlay > .bl-empty { position: absolute; inset: 16px; pointer-events: auto; }
.bl-empty span { font-size: 11.5px; color: #B4C1D0; }

/* ============================================================
   四、画布外悬浮工具条（拾东集 #b-cbar 同款）
   ------------------------------------------------------------
   拾东集的做法：工具条不在组件里、也不在手机框里，
   而是一颗 fixed 定位的深色竖排图标条，停在手机框右侧的灰色区域，
   垂直跟随选中组件 —— 组件内容完全不被挡。
   拾东集 2026-10-28 之前也是「组件内横条」，客户第三次反馈
   "竖条压住商品图片，没法编辑"才搬到画布外。

   教练平台的画布是 iframe 真机渲染，中台摸不到 iframe 内的 DOM，
   所以定位依据是 .bl-slot 的实测 top/height（与 slot 覆盖层同一套坐标）。

   ★ 2026-10-30 定位约束：
   工具条保持**独立浮层**（不进画布面板内部 —— 进去会挡住真机画面、影响编辑），
   但位置由 JS 按「编辑器容器 .builder 的边界」夹取：
   贴在手机框右侧 → 放不下改贴左侧 → 都放不下就贴容器右缘。
   任何情况下都留在编辑项目页面内，不会跑到窗口外或压到属性面板上。
   ============================================================ */
.bl-cbar {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(31, 36, 46, .95);
  border: 1px solid rgba(255, 255, 255, .10);
  box-shadow: 0 8px 24px rgba(16, 32, 48, .32);
  backdrop-filter: blur(6px);
}
.bl-cbar button {
  width: 27px;
  height: 27px;
  min-width: 27px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #DCE4EF;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background .12s, color .12s;
}
.bl-cbar button:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.bl-cbar button.src { color: #8FC1FF; }
.bl-cbar button.src:hover { background: rgba(143, 193, 255, .22); color: #D6E9FF; }
.bl-cbar .cb-sep { width: 15px; height: 1px; background: rgba(255, 255, 255, .18); margin: 3px 0; }
.bl-cbar button[data-act="del"]:hover { background: #E5484D; color: #fff; }
.bl-cbar button[data-act="list"]:hover { background: var(--gold); color: #fff; }

/* 工具条上的模块名（横排在工具条左侧，不撑高竖条） */
.bl-cbar-cap {
  position: fixed;
  z-index: 59;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(31, 36, 46, .92);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

/* ============================================================
   五、右侧：属性面板
   ============================================================ */
.bl-props-panel { display: flex; flex-direction: column; }

/* 属性面板内的分组标题（小竖条 + 标题） */
.bl-props-body .ps-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand);
  margin: 2px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px dashed var(--line);
}
.bl-props-body .ps-title::before {
  content: '';
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--brand);
}

/* 属性面板里的分栏（内容分区） */
.bl-props-body .pgroup { margin-bottom: 14px; }

/* 空态：页面设置（拾东集 .b-pageinfo 同款） */
.bl-pageinfo {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}
.bl-pageinfo > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  border-bottom: 1px solid #F1F5FA;
}
.bl-pageinfo > div:last-child { border-bottom: 0; }
.bl-pageinfo span { color: var(--sub); }
.bl-pageinfo b { color: var(--text); }
.bl-pageinfo b.ok { color: var(--ok); }
.bl-pageinfo b.draft { color: var(--gold); }
.bl-pageacts { display: flex; flex-wrap: wrap; gap: 8px; }
.bl-pageacts .btn { flex: 1 1 auto; min-width: 112px; }

/* ============================================================
   六、拖拽进行中
   ------------------------------------------------------------
   .bl-overlay 平时 pointer-events:none —— 它整块盖在 iframe 上，
   若能收事件，真机预览就没法滚动了。但拖拽期间必须反过来：
   只有它接管指针，落点才能算到"模块之间的空白"。
   同一时间把 iframe 的指针关掉，省得拖到手机上时事件被预览页吃掉。
   ============================================================ */
body.bl-dragging .bl-overlay { pointer-events: auto; }
body.bl-dragging .bl-frame { pointer-events: none; }
body.bl-dragging .bl-slot { cursor: grabbing; }
body.bl-dragging .bl-empty {
  border-color: var(--accent);
  background: #F2F8FF;
  color: var(--brand);
}
body.bl-dragging .bl-scroll {
  background:
    linear-gradient(0deg, rgba(48, 104, 184, .07), rgba(48, 104, 184, .07)),
    repeating-linear-gradient(45deg, #F7FAFD 0 12px, #F2F6FB 12px 24px);
}

/* 模块槽位拖拽态 */
.bl-slot.dragging { opacity: .45; }
.bl-slot.over { box-shadow: inset 0 0 0 2px var(--accent); }
.bl-slot.over::before {
  content: '';
  position: absolute;
  left: 8px; right: 8px; top: -2px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .9);
}
/* 落在"这一块下方"（拖到末尾或两块之间）：指示线画在底边 */
.bl-slot.over-below { box-shadow: inset 0 0 0 2px var(--accent); }
.bl-slot.over-below::before { top: auto; bottom: -2px; }

/* ============================================================
   七、条目级拖拽条（选中"服务/教练/内容"模块后浮在每张卡片上）
   ============================================================ */
.bl-islot {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: auto;
  border-radius: 6px;
  cursor: grab;
}
.bl-islot:active { cursor: grabbing; }
.bl-islot.dragging { opacity: .45; }
.bl-islot.over { box-shadow: inset 0 0 0 2px var(--accent); }
.bl-islot.over::before {
  content: '';
  position: absolute;
  left: 8px; right: 8px; top: -2px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .9);
}
.bl-islot.over-below { box-shadow: inset 0 0 0 2px var(--accent); }
.bl-islot.over-below::before { top: auto; bottom: -2px; }
.bl-islot .bl-ish {
  position: absolute;
  top: 4px; left: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(48, 104, 184, .82);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.bl-islot.is-hidden .bl-ish { background: rgba(94, 107, 126, .8); }
.bl-islot .bl-iops {
  position: absolute;
  top: 3px; right: 4px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity .12s;
}
.bl-islot:hover .bl-iops { opacity: 1; }
.bl-islot .bl-iops button {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line2);
  border-radius: 5px;
  background: rgba(255, 255, 255, .96);
  color: var(--text2);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(27, 58, 99, .2);
}
.bl-islot .bl-iops button:hover { border-color: var(--brand); color: var(--brand); }

/* ============================================================
   八、右侧面板：本页排序与显隐
   ============================================================ */
.ord-box { display: flex; flex-direction: column; gap: 4px; }
.ord-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.ord-row.is-hidden { background: #F5F7FA; border-style: dashed; opacity: .75; }
.ord-no {
  flex-shrink: 0;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--brand-bg);
  color: var(--brand);
  font-size: 10.5px;
  font-weight: 600;
}
.ord-row.is-hidden .ord-no { background: var(--bg); color: var(--sub2); }
.ord-nm { min-width: 0; display: flex; flex-direction: column; }
.ord-nm b {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ord-nm i {
  font-style: normal;
  font-size: 10.5px;
  color: var(--sub2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ord-ops { margin-left: auto; display: flex; gap: 3px; flex-shrink: 0; }
.ord-ops button {
  min-width: 22px; height: 22px;
  padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line2);
  border-radius: 5px;
  background: #fff;
  color: var(--text2);
  font-size: 11px;
  cursor: pointer;
}
.ord-ops button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.ord-ops button:disabled { opacity: .35; cursor: default; }
.ord-hd {
  margin-top: 6px;
  font-size: 11px;
  color: var(--sub2);
  padding: 2px 2px 0;
}
/* 「显示数量」以外的条目：仍可排序/隐藏，但标明当前不会出现在页面上 */
.ord-over {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 8px;
  background: #FFF4E5;
  border: 1px solid #F0DCBE;
  color: #9A6B1F;
  font-size: 10px;
  white-space: nowrap;
}

/* ---- 模式切换（自动跟随资料库 / 手动挑选）---- */
.ord-mode {
  display: flex;
  gap: 0;
  margin-bottom: 6px;
  border: 1px solid var(--line2);
  border-radius: 7px;
  overflow: hidden;
}
.ord-mode .om {
  flex: 1;
  padding: 6px 4px;
  border: 0;
  background: #fff;
  color: var(--text2);
  font-size: 11.5px;
  cursor: pointer;
  transition: .12s;
}
.ord-mode .om + .om { border-left: 1px solid var(--line2); }
.ord-mode .om:hover { background: var(--bg); }
.ord-mode .om.on {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* ---- 「本页展示 N 项 / 共 M 项」+ 挑选入口 ---- */
.ord-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 6px;
}
.ord-cnt { font-size: 11.5px; color: var(--sub2); }
.ord-cnt b { color: var(--brand); font-size: 12.5px; }
.ord-tools .btn { margin-left: auto; }

/* ---- 「挑选条目」弹窗 ---- */
.pk-list {
  max-height: 52vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}
.pk-i {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: .12s;
}
.pk-i:hover { border-color: var(--brand-l); }
.pk-i.on { border-color: var(--brand); background: var(--brand-bg); }
.pk-ck {
  flex-shrink: 0;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line2);
  border-radius: 4px;
  background: #fff;
  color: #fff;
  font-size: 11px;
  line-height: 1;
}
.pk-i.on .pk-ck { background: var(--brand); border-color: var(--brand); }
.pk-nm { min-width: 0; display: flex; flex-direction: column; }
.pk-nm b {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pk-nm i {
  font-style: normal; font-size: 10.5px; color: var(--sub2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pk-ord {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 20px;
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
}
.pk-hd {
  margin: 6px 2px 2px;
  font-size: 11px;
  color: var(--sub2);
}
.pk-hd.on { color: var(--brand); font-weight: 600; }

/* ============================================================
   九、上架状态（上架 / 下架 与 显示 / 隐藏 是两件事，视觉上必须能一眼分开）
   ------------------------------------------------------------
   配色取舍：不用 warn（红）——下架是**正常运营动作**，不是错误。
   用中性石板灰 + 虚线，读起来是"暂停"，不是"出事了"。
   ============================================================ */

/* 顶栏页面卡片上的未上架角标 */
.bl-page em.off {
  font-style: normal;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 4px;
  background: #EEF2F6;
  color: var(--sub);
  font-size: 10px;
  font-weight: 600;
}
.bl-page.has-off { border-style: dashed; }
.bl-page.has-off.on em.off { background: rgba(255, 255, 255, .24); color: #fff; }

/* 画布工具条右侧的「客户可见 x / y 块」 */
.bl-live {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok);
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--ok-bg);
  white-space: nowrap;
}
.bl-live.has-off { color: var(--sub); background: #EEF2F6; }

/* 未上架模块的幽灵条：换一套配色，与"已隐藏/渲染为空"区分开 */
.bl-ghost.off-list {
  background: #F4F6F9;
  border-style: dashed;
  border-color: var(--line2);
  color: var(--sub);
}
.bl-ghost.off-list b { color: var(--text2); }
.bl-ghost.off-list.on { border-color: var(--sub); box-shadow: 0 0 0 2px rgba(124, 140, 160, .22); }
.bl-ghost .g-off {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 4px;
  background: #E2E8F0;
  color: #55627A;
  font-size: 10px;
  font-weight: 600;
}

/* 上架/下架按钮是两字文案（↑架 / ↓架），比图标按钮宽一些 */
.bl-ghost .g-ops button[data-act="list"] {
  width: auto;
  padding: 0 6px;
  letter-spacing: .5px;
}

/* 属性面板里的上架徽标 */
.fbadge.off { background: #E2E8F0; color: #55627A; }

/* ============================================================
   十、窄屏降级
   ------------------------------------------------------------
   ★ 2026-10-30 断点调整：
     画布列最小宽度必须容得下「手机框 375px + 工具通道 58px + 内边距」，
     否则手机框会居中溢出面板、工具条就无处安放。
     所以画布列下限取 450px；窗口不够宽时整体退成单列，
     而不是把画布压扁让手机框溢出。
   ============================================================ */
@media (max-width: 1500px) {
  .builder { grid-template-columns: minmax(240px, 280px) minmax(450px, 1fr) minmax(320px, 360px); }
  .builder.no-props { grid-template-columns: minmax(240px, 280px) minmax(450px, 1fr); }
  .bl-rail { width: 58px; }
  .bl-rail-item { width: 48px; }
  .pal-items { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}
@media (max-width: 1240px) {
  .builder { grid-template-columns: minmax(210px, 240px) minmax(450px, 1fr) minmax(280px, 320px); }
  .builder.no-props { grid-template-columns: minmax(210px, 240px) minmax(450px, 1fr); }
  .bl-rail { width: 50px; }
  .bl-rail-item { width: 42px; }
  .bl-rail-item .ic { font-size: 15px; }
  .pal-items { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .bl-panel .ph { padding: 10px 12px; font-size: 12.5px; }
  .bl-panel .pb { padding: 10px; }
}
@media (max-width: 1120px) {
  /* 再窄就退成单列：属性面板移到画布下方，画布列独占整行，
     手机框 + 工具通道一定有位置 */
  .builder { grid-template-columns: minmax(0, 1fr); grid-auto-rows: min-content; }
  .builder .bl-panel { max-height: 420px; }
  .builder .bl-canvas-panel { max-height: none; }
  .phone { width: 100%; max-width: 375px; box-shadow: 0 10px 28px rgba(27, 58, 99, .16); }
  /* 单列时手机框左边对齐，工具通道挪到左边 —— 避免右内边距把内容挤出容器 */
  .bl-scroll { padding: 20px 20px 20px 78px; }
}

/* ============================================================
   2026-11-25 画布改造：常驻编辑胶囊 + 右侧画布排版面板
   ============================================================ */
/* 模块级「✎ 编辑」胶囊常驻可见（原来只在 hover 时出现，运营看不到） */
.bl-slot-edit {
  opacity: .92;
  background: rgba(31, 36, 46, .82);
  border: 1px solid rgba(255, 255, 255, .18);
  z-index: 4;
}
.bl-slot.on .bl-slot-edit { opacity: 1; background: var(--brand); color: #fff; border-color: transparent; }
.bl-slot:hover .bl-slot-edit { opacity: 1; }

/* 每条内容一条独立胶囊（画在覆盖层上，避开 iframe 的点击拦截） */
.hg-cap {
  position: absolute;
  transform: translateX(-100%);
  pointer-events: auto;
  z-index: 6;
  height: 17px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  font-size: 9.5px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 1px 4px rgba(16, 32, 56, .22);
  transition: filter .1s;
}
.hg-cap.item { background: rgba(48, 104, 184, .94); color: #fff; }
.hg-cap.jump { background: rgba(30, 122, 75, .94); color: #fff; }
.hg-cap:hover { filter: brightness(1.18); }

/* 右侧「画布尺寸与排版 / 跳转设置」面板 */
.ps-layout { margin-bottom: 14px; }
.ps-sec {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 10px;
  overflow: hidden;
}
.ps-sec > summary {
  cursor: pointer;
  padding: 9px 11px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand);
  background: #F7FAFE;
  list-style: none;
  user-select: none;
}
.ps-sec > summary::-webkit-details-marker { display: none; }
.ps-sec > summary::before { content: '▸'; display: inline-block; margin-right: 6px; transition: transform .12s; }
.ps-sec[open] > summary::before { transform: rotate(90deg); }
.ps-sec-body { padding: 10px 11px 12px; }
.ps-lrow { margin-bottom: 9px; }
.ps-lrow > label { display: block; font-size: 11.5px; color: var(--sub); margin-bottom: 4px; }
.ps-lctl { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--sub2); }
.ps-lctl select,
.ps-lctl input:not([type="color"]):not([type="checkbox"]) { flex: 1 1 auto; min-width: 0; font-size: 12px; }
.ps-lctl input[type="color"] { width: 34px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.ps-lhint { font-size: 10.5px; line-height: 1.6; color: var(--sub2); margin-top: 3px; }
.ps-lacts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.ps-lacts .btn { flex: 0 0 auto; }
.ps-lacts .muted { font-size: 10.5px; }
.ps-subttl { font-size: 11.5px; font-weight: 700; color: var(--text); margin: 12px 0 7px; padding-top: 9px; border-top: 1px dashed var(--line); }
.ps-jitems { display: flex; flex-direction: column; gap: 7px; }
.ps-jitem { display: grid; grid-template-columns: 62px 1fr; gap: 5px; align-items: center; }
.ps-jname { font-size: 11px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-jitem input, .ps-jitem select { min-width: 0; width: 100%; font-size: 11px; }
.ps-jitem select { grid-column: 1 / -1; }
#bl-caps.on { background: var(--brand); color: #fff; border-color: var(--brand); }


/* ============================================================
   2026-11-25 补充：右侧「本页模块」增删 + 宫格辅助线
   ============================================================ */

/* ---- 本页模块清单 ---- */
.mm-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--sub);
  margin-bottom: 8px;
}
.mm-hd b { color: var(--text); }
.mm-hd b.ok { color: #1E7A4B; }
.mm-list { display: flex; flex-direction: column; gap: 4px; }
.mm-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.mm-row:hover { border-color: var(--brand-l); background: #F7FAFE; }
.mm-row.on { border-color: var(--brand); background: #EFF6FF; }
.mm-row.off { opacity: .62; }
.mm-no {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #EEF2F6;
  color: var(--sub);
  font-size: 9.5px;
}
.mm-nm { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.mm-nm b {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-nm i { font-style: normal; font-size: 9.5px; color: var(--sub2); }
.mm-ops { display: flex; gap: 1px; flex-shrink: 0; }
.mm-ops button {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #F4F7FB;
  color: var(--text2);
  font-size: 9.5px;
  cursor: pointer;
}
.mm-ops button:hover { background: var(--brand); color: #fff; }
.mm-ops button.dg { color: #C0453F; }
.mm-ops button.dg:hover { background: #C0453F; color: #fff; }
.mm-ops button:disabled { opacity: .3; cursor: not-allowed; }

/* ---- 添加模块弹窗 ---- */
.mm-add-grid { display: flex; flex-direction: column; gap: 12px; max-height: 60vh; overflow-y: auto; }
.mm-add-gt { font-size: 11.5px; font-weight: 700; color: var(--brand-d); margin-bottom: 5px; }
.mm-add-i {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  margin-bottom: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.mm-add-i:hover { border-color: var(--brand); background: #F4F9FF; }
.mm-add-i .ic { width: 18px; text-align: center; color: var(--brand); font-size: 12px; }
.mm-add-i .tx { display: flex; flex-direction: column; line-height: 1.3; }
.mm-add-i .tx b { font-size: 12px; font-weight: 600; }
.mm-add-i .tx i { font-style: normal; font-size: 10px; color: var(--sub2); }

/* ---- 宫格辅助线 ---- */
.bl-guides { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.bl-guides > i {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(48, 104, 184, .055);
  outline: 1px solid rgba(48, 104, 184, .14);
  outline-offset: -1px;
}
.bl-guide-mid {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-left: 1px dashed rgba(232, 144, 28, .55);
}
.bl-guide-cap {
  position: absolute;
  left: 5px;
  top: 5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(27, 58, 99, .74);
  color: #fff;
  font-size: 9.5px;
  letter-spacing: .2px;
}
.bl-slot-no {
  position: absolute;
  top: 2px;
  left: 16px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(27, 58, 99, .8);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  z-index: 5;
}


/* ============================================================
   2026-11-25 简化：顶栏只留一个主按钮 + 「中心」页签
   ============================================================ */
/* 「仅存草稿」降级成文字链：不再是必经步骤，但需要时点得到 */
.bl-save-link {
  border: 0;
  background: none;
  padding: 0 4px;
  color: var(--sub);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.bl-save-link:hover { color: var(--brand); }
/* 选中模块时竖条只剩一个图标，不需要原来那排分隔线 */
.bl-cbar .cb-sep { display: none; }
