/* 智能花盆 Web 大屏 —— 默认暗黑主题，:root.light 为明亮主题 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0c1818;
  --bg2: #132f2f;
  --card: #0f2222;
  --line: #1f3a3a;
  --text: #e8f2f0;
  --sub: #8fa8a4;
  --accent: #00c8b8;
  --accent-dark: #009482;
  --red: #ff5a5a;
  --orange: #ff9900;
  --warn: #fbbf24;
  /* 主题相关杂项：输入框/顶栏/侧栏底色、ECharts 配色（JS 里按主题取同名值） */
  --ipt-bg: #0a1a1a;
  --bar-bg: rgba(12, 24, 24, .6);
  --side-bg: rgba(10, 20, 20, .45);
  --hover-bg: rgba(0, 200, 184, .06);
  --active-bg: rgba(0, 200, 184, .1);
  --tip-bg: rgba(15, 34, 34, .95);
  /* 进度条填充的柔光（深浅主题各一档，直接写 rgba 会在白底上发脏） */
  --bar-glow: rgba(0, 200, 184, .35);
  color-scheme: dark;
}
/* 明亮主题：同一套变量换浅色值，青色 accent 加深一点保证白底对比度 */
:root.light {
  --bg: #eef4f3;
  --bg2: #dfecea;
  --card: #ffffff;
  --line: #d3e0de;
  --text: #1c2b2a;
  --sub: #5f7a76;
  --accent: #00a08f;
  --accent-dark: #00897b;
  --red: #e5484d;
  --orange: #e8890c;
  --warn: #b45309;
  --ipt-bg: #f3f8f7;
  --bar-bg: rgba(255, 255, 255, .72);
  --side-bg: rgba(255, 255, 255, .55);
  --hover-bg: rgba(0, 160, 143, .07);
  --active-bg: rgba(0, 160, 143, .13);
  --tip-bg: rgba(255, 255, 255, .97);
  --bar-glow: rgba(0, 160, 143, .22);
  color-scheme: light;
}
[v-cloak] { display: none; }
body {
  background: linear-gradient(180deg, var(--bg2), var(--bg) 70%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
  transition: background .25s, color .25s;
}
.accent { color: var(--accent); }
.empty { color: var(--sub); font-size: 13px; padding: 12px 4px; }

/* ---------- 通用 ---------- */
.btn { border: 0; border-radius: 8px; cursor: pointer; font-size: 14px; padding: 10px 16px; transition: .2s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent-dark); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: transparent; color: var(--sub); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
/* 「停止运行」：运行态下红色描边 + 红字（透明底，和 ghost 按钮同构只用颜色区分） */
.btn-stop {
  background: transparent; color: var(--red);
  border: 1px solid var(--red); font-weight: 600;
}
.btn-stop:hover { background: rgba(255, 90, 90, .14); border-color: var(--red); color: var(--red); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.ipt {
  width: 100%; background: var(--ipt-bg); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font-size: 14px; padding: 11px 12px; outline: none;
}
.ipt:focus { border-color: var(--accent); }
/* 下拉框（定时器的"控制开关"）：暗色主题下原生 option 列表默认白底黑字，这里跟着主题走 */
select.ipt { padding-right: 8px; }
select.ipt option { background: var(--card); color: var(--text); }
.ipt.time { width: 130px; }

/* ---------- 登录页 ---------- */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card {
  width: 380px; max-width: 100%; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px;
}
.auth-title { text-align: center; font-size: 19px; margin-bottom: 24px; letter-spacing: .5px; }

/* 登录页 LOGO：透明底 PNG，数字按主题切换（暗=白字 / 亮=深蓝字），无需白底衬 */
.auth-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-logo img { height: 104px; width: auto; display: block; }
.auth-tabs { display: flex; gap: 24px; margin-bottom: 18px; color: var(--sub); }
.auth-tabs span { cursor: pointer; padding-bottom: 6px; border-bottom: 2px solid transparent; }
.auth-tabs span.active { color: var(--accent); border-color: var(--accent); }
.auth-card .ipt { margin-bottom: 14px; }
.auth-err { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; }
.auth-ok { color: var(--accent); font-size: 13px; margin-top: 12px; text-align: center; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--bar-bg);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 600; }
/* 顶栏 LOGO：透明底 PNG，主题切换时由 Vue 换图（见 app.js 的 logoSrc） */
.logo-chip { display: inline-flex; align-items: center; }
.logo-chip img { height: 40px; width: auto; display: block; }
.brand-div { width: 1px; height: 24px; background: var(--line); }
.brand-name { font-size: 17px; letter-spacing: .6px; }
.top-right { display: flex; align-items: center; gap: 14px; }
.who { color: var(--sub); }
.who-edit { cursor: pointer; user-select: none; transition: color .15s; }
.who-edit:hover { color: var(--accent); }
.ws-dot { font-size: 13px; }
.ws-dot::before { content: "●"; margin-right: 5px; }
.ws-dot.open { color: var(--accent); }
.ws-dot.connecting { color: var(--orange); }
.ws-dot.closed { color: var(--red); }

/* 登录页的主题切换按钮：没有顶栏，固定在右上角 */
.theme-fab { position: fixed; top: 14px; right: 16px; z-index: 20; }

/* ---------- 布局 ---------- */
/* 顶栏高度随 LOGO 变化，用 flex 撑满视口，避免写出"100vh - 固定值"导致多一条滚动条 */
.main { display: flex; flex-direction: column; min-height: 100vh; }
.layout { display: flex; flex: 1; min-height: 0; }
.side {
  width: 270px; flex-shrink: 0; border-right: 1px solid var(--line);
  padding: 20px 16px; background: var(--side-bg);
  position: relative;                      /* 拖拽落点指示线 .drop-line 的定位基准 */
}
.side-title { font-size: 14px; color: var(--sub); margin-bottom: 10px; }
/* 标题行：左边「我的设备」，右边「长按拖动排序」提示 */
.side-head { display: flex; align-items: center; justify-content: space-between; }
.side-head .side-title { margin-bottom: 10px; }
.side-tip { font-size: 11px; color: var(--sub); opacity: .75; margin-bottom: 10px; }
.dev-item {
  padding: 12px; border-radius: 10px; cursor: pointer; margin-bottom: 8px;
  border: 1px solid transparent; transition: .15s;
}
.dev-item:hover { background: var(--hover-bg); }
.dev-item.active { background: var(--active-bg); border-color: var(--accent); }
.dev-name { font-size: 15px; display: flex; align-items: center; gap: 6px; }
/* 设备名：超长省略；改名入口只在铅笔图标，点名称=选中设备 */
.dev-title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 铅笔图标：平时隐藏，鼠标悬停整条设备时才显示，避免视觉噪音 */
.edit-ico {
  flex-shrink: 0; font-size: 13px; color: var(--sub); cursor: pointer;
  opacity: 0; transition: opacity .15s, color .15s;
}
.dev-item:hover .edit-ico { opacity: 1; }
.edit-ico:hover { color: var(--accent); }
/* 改名输入框：与列表行高对齐 */
.rename-ipt {
  flex: 1; min-width: 0;
  background: var(--ipt-bg); border: 1px solid var(--accent); border-radius: 6px;
  color: var(--text); font-size: 15px; padding: 4px 8px; outline: none;
}
.dev-key { font-size: 12px; color: var(--sub); margin-top: 4px; line-height: 1.9; }

/* 设备卡片上的绑定码：点击弹二维码。
   nowrap：侧栏只有 270px，卡片内宽 ~214px，"绑定码 QZRTUP ▦"被挤成两行（"绑定码"上、"QZRTUP"下）
   会让人以为码是分开的，这里锁死成一行；真放不下就让下面的共享/解绑换行（.dev-foot 允许 wrap） */
.dev-bindcode {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--sub);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 2px 5px;
  display: inline-block;
  white-space: nowrap;
  cursor: pointer;
}
.dev-bindcode:hover { color: var(--accent); border-color: var(--accent); }
.qr-ico { margin-left: 4px; }

/* 设备卡片底部操作行：左边绑定码、右边共享/解绑。
   允许换行：绑定码锁成一行、按钮（.dev-acts）也成包，窄侧栏或页面放大时整包落到第二行，
   不会出现"绑定码被折断"或"只剩解绑孤零零换行" */
.dev-foot {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 6px;
  row-gap: 4px;
}
/* 共享 + 解绑：当一整块参与排版，整块右对齐（窄了整块换行，不会拆开） */
.dev-acts {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto; flex: none;
}
.dev-acts .dev-share { margin-left: 0; }
.dev-foot .dev-bindcode { margin-top: 0; }

/* 解绑入口：平时半透明低调显示，鼠标移上去变红，降低误触概率 */
.dev-unbind {
  font-size: 11px;
  color: var(--sub);
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: .5;
  transition: opacity .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.dev-item:hover .dev-unbind { opacity: 1; }
.dev-unbind:hover { color: #ff6b6b; border-color: rgba(255, 107, 107, .45); }

/* 共享入口：和解绑同一行的轻量按钮，hover 变主色（不是危险操作） */
.dev-share {
  font-size: 11px;
  color: var(--sub);
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: .5;
  margin-left: auto;
  transition: opacity .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.dev-item:hover .dev-share { opacity: 1; }
.dev-share:hover { color: var(--accent); border-color: var(--accent); }

/* 开发者「发布产品」唯一入口：造物卡片右下角的琥珀色描边胶囊，始终完全可见。
   侧栏标题栏与造物大屏顶栏的按钮已按需求移除，别再加回来。 */
.dev-pub {
  font-size: 12px; color: #ffc266;
  padding: 2px 9px; border: 1px solid rgba(255, 194, 102, .55);
  border-radius: 12px; background: rgba(255, 194, 102, .12);
  cursor: pointer; flex-shrink: 0; opacity: 1; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.dev-item:hover .dev-pub { background: rgba(255, 194, 102, .2); border-color: #ffc266; }
.dev-pub:hover { color: #ffd699; background: rgba(255, 194, 102, .24); border-color: #ffc266; }

/* 运行大屏（点 ▶ 运行之后）顶栏的「发布产品」：琥珀描边，和旁边灰色的
   「自动排列 / 发布预览 / 删除项目」区分开，避免与「发布预览」混淆。 */
.btn.btn-ghost.btn-pub-run {
  color: #ffc266; border-color: rgba(255, 194, 102, .55); background: rgba(255, 194, 102, .1);
}
.btn.btn-ghost.btn-pub-run:hover {
  color: #ffd699; border-color: #ffc266; background: rgba(255, 194, 102, .2);
}

/* 亮色主题：琥珀字在白底上对比不足，压深 */
:root.light .dev-pub, :root.light .btn.btn-ghost.btn-pub-run {
  color: #8a5800; border-color: rgba(138, 88, 0, .45); background: rgba(138, 88, 0, .08);
}
:root.light .dev-item:hover .dev-pub, :root.light .btn.btn-ghost.btn-pub-run:hover {
  color: #6b4400; border-color: #8a5800; background: rgba(138, 88, 0, .15);
}
/* 被驳回：卡片徽章转红，开发者一眼能看出要改 */
.dev-pub.is-rejected { color: #ff9a9a; border-color: rgba(255,90,90,.5); background: rgba(255,90,90,.12); }
.dev-pub.is-rejected:hover { color: #ffc0c0; border-color: #ff9a9a; background: rgba(255,90,90,.22); }
:root.light .dev-pub.is-rejected { color: #b4232a; border-color: rgba(180,40,40,.45); background: rgba(220,60,60,.08); }
:root.light .dev-pub.is-rejected:hover { color: #8f1c22; border-color: #b4232a; background: rgba(220,60,60,.15); }
/* 发布弹窗：造物下拉 + 无造物提示 */
.pub-sel { cursor: pointer; }
.pub-empty { font-size: 12px; color: var(--orange); line-height: 1.5; }

/* 发布弹窗：界面图上传（按钮 + 缩略图预览 + 仍可手填外链 URL） */
.pub-up { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
.pub-up-cap { font-size: 12px; color: var(--sub); margin-bottom: 7px; }
.pub-up-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; flex-wrap: wrap; }
.pub-up-btn {
  display: inline-flex; align-items: center;
  font-size: 12px; font-family: inherit; color: var(--accent);
  background: transparent; border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 10px; cursor: pointer; white-space: nowrap;
}
.pub-up-btn:hover { border-color: var(--accent); }
/* 当前「粘贴目标」的图片框：点一下切换，Ctrl+V / 右键粘贴就传到这个框 */
.pub-up.active { border-color: var(--accent); }
.pub-up-target { color: var(--accent); margin-left: 4px; }
.pub-paste-hint { font-size: 11px; color: var(--sub); line-height: 1.65; }
.pub-paste-tip { flex: none; margin-top: 8px; font-size: 12px; color: var(--accent); line-height: 1.5; }
.pub-up-thumb {
  width: 44px; height: 44px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--line); flex: none;
}
.pub-up-hint { font-size: 11px; color: var(--sub); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pub-up-clear { font-size: 11px; color: var(--red); cursor: pointer; white-space: nowrap; }
.pub-up .ipt { width: 100%; }
/* 发布弹窗内容长（驳回原因 + 两张界面图 + 提示）时：
   标题和底部按钮固定在卡片上下两端，只有中间这块上下滚动，
   不会出现「弹窗比屏幕高、按钮和上面字段都够不着」的情况。 */
.pub-modal {
  max-width: calc(100vw - 32px); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
  padding-bottom: 14px;
}
.pub-modal .dlg-title { flex: none; margin-bottom: 8px; }
.pub-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.pub-scroll::-webkit-scrollbar { width: 6px; }
.pub-scroll::-webkit-scrollbar-track { background: transparent; }
.pub-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.pub-btns { flex: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.pub-locked { font-size: 12px; color: #ffc266; line-height: 1.55; margin-top: 10px; }
:root.light .pub-locked { color: #8a5800; }
.pub-relayout { font-size: 12px; color: #ffc266; line-height: 1.55; margin-top: 10px; }
:root.light .pub-relayout { color: #8a5800; }
/* 被驳回的申请：发布弹窗顶部红框，把管理员的原因原样给开发者看 */
.pub-reject {
  margin: 0 0 14px; padding: 11px 13px; border-radius: 10px;
  border: 1px solid rgba(255,90,90,.42); background: rgba(255,90,90,.10);
  font-size: 12.5px; line-height: 1.65; color: #ffb3b3;
}
.pub-reject b { display:block; font-size: 13px; color: #ff8f8f; margin-bottom: 4px; }
.pub-reject-note { color: #ffd0d0; word-break: break-all; }
.pub-reject-tip { margin-top: 5px; opacity: .82; }
:root.light .pub-reject { background: rgba(220,60,60,.07); border-color: rgba(180,40,40,.35); color: #a33636; }
:root.light .pub-reject b { color: #b4232a; }
:root.light .pub-reject-note { color: #7d2020; }

/* 家人共享的设备：设备码后面挂个小标签，一眼区分"这是别人共享给我的" */
.dev-role {
  margin-left: 8px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--accent);
  border: 1px solid var(--accent);
  opacity: .85;
  letter-spacing: .5px;
}

/* 造物标题栏里那颗「家人共享」：侧栏那张小卡片上的 10px 太小，标题旁边看不清 */
.dev-role.big {
  font-size: 12px;
  padding: 2px 9px;
  margin-left: 0;
}

/* 设备当前固件版本：只在设备卡片里挂在设备码后面（主区标题旁不重复显示）。
   设备上报的字段是 fw（WS） / firmware（列表接口），applyState 里统一同步。 */
.dev-fw {
  margin-left: 6px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--sub);
  border: 1px solid var(--line);
  opacity: .9;
  letter-spacing: .3px;
  white-space: nowrap;
}

/* 商品型号（运营后台型号库里维护，随设备带出来）：侧栏卡片挂小字、主区标题旁挂大一点的标签。
   型号码就是设备 ID 的前缀（如 HBM26110087 → HBM），所以小字里只展示商品名不重复报码。 */
.dev-model {
  margin-left: 6px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--sub);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.dev-model.big {
  font-size: 12px;
  padding: 2px 9px;
  color: var(--accent);
  border-color: var(--accent);
  opacity: .85;
  letter-spacing: .5px;
}

/* ---------- 设备列表拖拽排序 ---------- */
/* 卡片文字不可选中：长按拖动时否则会顺手选中一片文字（输入框单独放开） */
.dev-item { user-select: none; -webkit-user-select: none; }
.dev-item .rename-ipt { user-select: text; -webkit-user-select: text; }
/* 按下待触发长按：轻微下沉，提示"已经按住" */
.dev-item.pressing { transform: scale(.985); background: var(--hover-bg); }
/* 拖拽中：抬起来跟手（transform 由 JS 逐帧写内联样式，所以关掉过渡，否则会发飘） */
.dev-item.dragging {
  position: relative; z-index: 30;
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
  transition: none;
  cursor: grabbing;
}
.dev-item.dragging:hover { background: var(--card); }
/* 落点指示线：夹在两台设备之间的青色细线（两端的圆点让它即使压在被拖卡片上也一眼能认出） */
.drop-line {
  position: absolute; left: 16px; right: 16px; height: 3px;
  background: var(--accent); border-radius: 3px;
  box-shadow: 0 0 10px var(--accent);
  pointer-events: none; z-index: 40;   /* 高于拖拽中的卡片，保证落点始终看得见 */
  transform: translateY(-1px);
}
.drop-line::before, .drop-line::after {
  content: ""; position: absolute; top: 50%; width: 7px; height: 7px;
  margin-top: -3.5px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.drop-line::before { left: -3px; }
.drop-line::after { right: -3px; }
body.dev-dragging, body.dev-dragging .dev-item { cursor: grabbing; }
body.dev-dragging { user-select: none; -webkit-user-select: none; }

/* ---------- 通用确认弹层（配色跟主题走） ---------- */
.dlg-card {
  width: 328px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.dlg-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.dlg-text { margin: 0 0 18px; font-size: 13px; line-height: 1.75; color: var(--sub); }
.dlg-warn { color: var(--red); font-weight: 700; }
.dlg-btns { display: flex; gap: 10px; justify-content: flex-end; }
.dlg-btn {
  padding: 8px 18px; border-radius: 8px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--sub);
}
.dlg-btn.ghost:hover { color: var(--text); border-color: var(--accent); }
.dlg-btn.danger { background: #c0392b; border-color: #c0392b; color: #fff; }
.dlg-btn.primary { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.dlg-btn.primary:hover { background: var(--accent); border-color: var(--accent); }

/* 初始密码安全提醒：一句话独占一行（2026-11-10：删掉「不修改也可以…」后半句）。
   卡片比通用弹窗宽一点，保证 13px 中文单行放得下；极窄屏才允许折行，避免溢出。 */
.dlg-card-tip { width: 380px; max-width: calc(100vw - 32px); }
.pw-tip-one { white-space: nowrap; }

/* 服务商（上级所属单位）弹层：大屏右上角「服务商」按钮打开 */
.sp-card { width: 340px; max-width: calc(100vw - 32px); }
.sp-rows { display: flex; flex-direction: column; gap: 13px; margin-top: 4px; }
.sp-row { display: flex; align-items: baseline; gap: 12px; font-size: 14px; }
.sp-row > span { color: var(--sub); min-width: 56px; flex: none; }
.sp-row > b { color: var(--text); font-weight: 600; word-break: break-all; }
.sp-empty { color: var(--sub); font-size: 13px; padding: 6px 0; }
@media (max-width: 420px) { .pw-tip-one { white-space: normal; } }

/* 修改密码弹层：三个输入框竖排 */
.pw-form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.pw-ok { color: var(--accent); font-size: 13px; margin-top: 10px; }

/* ---------- 注册滑块验证 ----------
   底图 3:2（后端 300x180），宽度撑满卡片；碎片按百分比定位，所以整块跟着卡片宽度等比缩放，
   拖动比例（sliderFrac）是纯比例值，不管容器多宽都不用重新测量。
   尺寸全部由接口下发的 w/h/ps 决定（见 index.html 的 :style），改底图比例不用动 CSS。 */
.sl-box { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.sl-stage {
  position: relative; width: 100%; aspect-ratio: 5 / 3;   /* 兜底值，实际由接口的 w/h 覆盖 */
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line);
  background: #223; user-select: none;
}
.sl-bg { width: 100%; height: 100%; display: block; object-fit: cover; }
.sl-piece {
  position: absolute; width: 15.333%;              /* 兜底：碎片 46 / 图宽 300，实际由接口的 ps/w 覆盖 */
  aspect-ratio: 1 / 1; pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
  transition: left .06s linear;
}
.sl-track {
  position: relative; height: 38px; border-radius: 19px;
  background: var(--track-bg, rgba(255, 255, 255, .06));
  border: 1px solid var(--line); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.sl-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(45, 160, 140, .22), rgba(45, 160, 140, .62));
}
.sl-text {
  position: relative; font-size: 12px; color: var(--sub); letter-spacing: .5px;
  pointer-events: none; padding-left: 6px; transition: opacity .15s;
}
/* 拖动时提示文字淡下去：不然圆块滑过来正好压在字上，看着像排版坏了 */
.sl-track.dragging .sl-text { opacity: .16; }
.sl-handle {
  position: absolute; top: 0; width: 38px; height: 36px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #04231f; font-size: 20px; font-weight: 700;
  cursor: grab; touch-action: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  transition: left .06s linear;
}
.sl-handle:active { cursor: grabbing; }
.sl-track.busy .sl-handle { opacity: .7; }
.sl-track.ok { border-color: var(--accent); }
.sl-track.ok .sl-fill { background: rgba(45, 160, 140, .45); }
.sl-track.ok .sl-text { color: var(--accent); }
.sl-track.ok .sl-handle { background: var(--accent); color: #04231f; }
/* 通过后把文案挪到图上角：留在滑块条中间会被圆块压住（圆块正好停在缺口位置） */
.sl-badge {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: var(--accent);
  font-size: 12px; font-weight: 600; letter-spacing: .5px;
  backdrop-filter: blur(2px);
}
.dlg-btn.danger:hover { background: #e04a3a; }
.dlg-btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ---------- 绑定码二维码弹层 ---------- */
.qr-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
.qr-card {
  background: #fff; border-radius: 14px; padding: 18px 20px 16px;
  text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.qr-title { color: #12312f; font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.qr-box { line-height: 0; }                 /* 消掉 svg 下方间隙 */
.qr-box svg { width: 190px; height: 190px; }
.qr-code {
  margin-top: 8px; font-size: 22px; font-weight: 700;
  letter-spacing: 6px; color: #12312f;
}
.qr-hint { margin-top: 6px; font-size: 12px; color: #7b8f8b; }
.qr-close {
  margin-top: 12px; padding: 7px 26px; border: 0; border-radius: 8px;
  background: #009482; color: #fff; font-size: 13px; cursor: pointer;
}
.dev-online { font-size: 12px; flex-shrink: 0; }
.dev-online.on { color: var(--accent); }
.dev-online.off { color: var(--sub); }
.dev-online.big { font-size: 14px; }
.bind-box {
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
/* 绑定码输入：等宽 + 拉字距 + 居中，6 位码一眼能看清、好核对 */
.bind-code-ipt {
  text-align: center; letter-spacing: 4px; text-transform: uppercase;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px;
}
.bind-code-ipt::placeholder { letter-spacing: 0; font-size: 13px; font-family: inherit; }
.bind-hint { font-size: 12px; color: var(--sub); line-height: 1.5; margin-top: -2px; }
/* 绑定 / 共享 模式切换：标题右侧的小链接 */
.bind-title { display: flex; align-items: baseline; justify-content: space-between; }
.bind-mode {
  font-size: 12px; color: var(--accent); cursor: pointer;
  border-bottom: 1px dashed transparent;
}
.bind-mode:hover { border-bottom-color: var(--accent); }

/* ---------- 家人共享弹层 ---------- */
.dlg-share { width: 360px; }
.share-code-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 6px;
}
.share-code {
  flex: 1;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 24px; letter-spacing: 6px; text-align: center;
  padding: 10px 12px; border-radius: 10px;
  background: var(--hover-bg); border: 1px dashed var(--line);
  color: var(--text);
}
.share-code.empty { color: var(--sub); opacity: .6; letter-spacing: 4px; }
.share-expire { font-size: 12px; color: var(--sub); margin-bottom: 14px; line-height: 1.6; }
.share-members {
  border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 16px;
  max-height: 180px; overflow-y: auto;
}
.share-members-title { font-size: 12px; color: var(--sub); margin-bottom: 8px; }
.share-member {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); padding: 5px 0;
}
.share-member .sm-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-member .sm-role {
  font-size: 11px; color: var(--sub);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
}
.share-member .sm-role.owner { color: var(--accent); border-color: var(--accent); }
.share-member .sm-del {
  font-size: 12px; color: var(--sub); cursor: pointer; padding: 2px 6px;
  border-radius: 6px; opacity: .75;
}
.share-member .sm-del:hover { color: #ff6b6b; opacity: 1; }
.share-member.empty-member { color: var(--sub); font-size: 12px; }

/* ---------- 主面板 ---------- */
.panel { flex: 1; padding: 24px 32px; overflow-x: hidden; }
.empty-panel { display: flex; align-items: center; justify-content: center; color: var(--sub); }
.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.panel-head h2 { font-size: 20px; font-weight: 600; }

/* ---------- 仪表 ---------- */
.gauge-row { display: flex; justify-content: space-around; flex-wrap: wrap; margin: 8px 0 10px; }
.gauge-box { text-align: center; }
.gauge-wrap { position: relative; }        /* 状态文字覆盖层的定位基准 */
.gauge { width: 220px; height: 190px; }
/* 状态文字：压在表盘内部指针末端下方（对应原 ECharts 坐标系里 55%+28% 半径的位置），
   颜色由 JS 按档位插值后通过内联 style 注入 */
.gauge-status {
  position: absolute; left: 0; right: 0; top: 68.3%;
  transform: translateY(-50%);
  text-align: center; font-size: 14px; font-weight: 500;
  pointer-events: none; transition: color .3s;
}
.gauge-label { color: var(--sub); font-size: 14px; margin-top: -12px; }

/* ---------- 控制区 ---------- */
.ctrl-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 18px 0 8px; }
.ctrl-btn {
  min-width: 170px; padding: 14px 22px; font-size: 15px; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--accent); border: 1.5px solid var(--accent); transition: .2s;
  user-select: none; -webkit-user-select: none;
}
.ctrl-btn.on { background: var(--accent); color: #04211e; font-weight: 600; box-shadow: 0 0 18px rgba(0,200,184,.45); }
.ctrl-btn:active { transform: scale(.97); }
/* 水泵超时保护锁提示（设备上报 autoLock=true 时显示） */
.lock-tip {
  font-size: 12px; color: var(--orange); border: 1px solid var(--orange);
  border-radius: 10px; padding: 1px 8px; margin-left: 10px; cursor: help;
}
.ctrl-switch { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.ctrl-switch input { width: 38px; height: 20px; accent-color: var(--accent); }

.slider-row { display: flex; align-items: center; gap: 14px; margin: 12px 0 4px; font-size: 15px; }
.slider-row input[type=range] { flex: 1; max-width: 420px; accent-color: var(--accent); }

/* ---------- 历史曲线 ---------- */
.chart-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 8px; }
.chart-head h3 { font-size: 16px; }
.range-tabs { display: flex; gap: 6px; }
.range-tabs span {
  font-size: 13px; color: var(--sub); padding: 4px 12px; border-radius: 14px;
  cursor: pointer; border: 1px solid var(--line); transition: .15s;
}
.range-tabs span.active { color: var(--accent); border-color: var(--accent); }
.chart { width: 100%; height: 300px; }
/* 曲线标题行右侧：导出按钮 + 范围标签 组合 */
.chart-tools { display: flex; align-items: center; gap: 10px; }
.chart-tools .btn-sm { padding: 4px 12px; font-size: 13px; }

/* ============ 浇水记录卡片 ============ */
.water-box {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.water-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.water-head h3 { font-size: 16px; }
.water-stats { display: flex; gap: 12px; margin-bottom: 14px; }
.wstat {
  flex: 1; text-align: center;
  background: var(--hover-bg); border-radius: 10px; padding: 12px 8px;
}
.wstat b { display: block; font-size: 20px; color: var(--accent); margin-bottom: 4px; }
.wstat span { font-size: 12px; color: var(--sub); }
.water-row {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--text);
  padding: 6px 2px; border-bottom: 1px solid var(--line);
}
.water-row:last-child { border-bottom: 0; }
.water-row.empty { color: var(--sub); justify-content: center; padding: 14px 0; }
.w-time { flex: 1; min-width: 0; }
.w-mode {
  flex-shrink: 0; font-size: 11px; padding: 1px 8px; border-radius: 9px;
  border: 1px solid var(--line); color: var(--sub);
}
.w-mode.manual { color: #ff9900; border-color: #ff9900; }
.w-mode.auto { color: var(--accent); border-color: var(--accent); }
.w-dur { flex-shrink: 0; color: var(--sub); }

/* ================= 我的造物（DIY 自由创作） ================= */
/* 侧栏：造物分组与设备分组之间留出区分度，否则两类卡片看起来一样 */
.diy-head { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.side-new {
  font-size: 12px; color: var(--accent); cursor: pointer; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px;
}
.side-new:hover { border-color: var(--accent); background: var(--hover-bg); }
.diy-tag {
  margin-left: 8px; font-size: 11px; color: var(--accent);
  border: 1px solid rgba(0, 200, 184, .35); border-radius: 10px; padding: 1px 7px;
}
/* 侧栏卡片里的小标签（DIY·N 个组件 / 已发布 / 家人共享 / 固件 vX / 商品型号）：
   一律 inline-block + nowrap —— 否则宽度不够时浏览器会把「已发布」从中间折断成两行
   （变成"已发"换行"布"，还各带半截底色）。放不下就让整个标签落到下一行 */
.diy-tag, .pub-tag, .dev-role, .dev-fw, .dev-model {
  display: inline-block;
  white-space: nowrap;
}
/* 造物卡的「点击进入造物大屏」：只是一句提示，宁可省略号也不要折成两行（右侧还有共享/删除） */
.diy-hint-mini {
  font-size: 11px; color: var(--sub); opacity: .8;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.diy-item .dev-title { font-weight: 500; }

/* 顶栏右侧：在线状态 + 删除按钮 */
.diy-head-right { display: flex; align-items: center; gap: 12px; }
.panel-head h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 接入信息条 */
.diy-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 4px 0 14px;
}
.diy-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--sub);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 9px; background: var(--side-bg);
}
.diy-badge b { color: var(--text); font-weight: 600; }
.diy-badge b.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .3px; }
.diy-badge .eye { color: var(--accent); cursor: pointer; font-style: normal; font-size: 11px; }
.diy-badge .eye:hover { text-decoration: underline; }
/* 点一下复制：整块可点，悬停描边变色 + 内容提亮，给个"这能点"的暗示 */
.diy-badge.copyable { cursor: pointer; user-select: none; transition: border-color .15s, background .15s; }
.diy-badge.copyable:hover { border-color: var(--accent); background: var(--hover-bg); }
.diy-badge.copyable:hover b { color: var(--accent); }
.diy-badge.copyable:active { transform: translateY(1px); }

/* 复制反馈提示条 */
.copy-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 999; padding: 9px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: #04231f;
  background: var(--accent); box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}
.copy-toast.bad { background: #e5534b; color: #fff; }

/* 画布 + 右栏：align-items 用 stretch，画布向下延伸时右栏（组件库等）跟着一样高 */
.diy-body { display: flex; gap: 16px; align-items: stretch; }
.diy-canvas-wrap { flex: 1; min-width: 0; }
.diy-canvas {
  position: relative; height: 560px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px;
  background-color: var(--ipt-bg);
  background-image: radial-gradient(circle, rgba(0, 200, 184, .13) 1px, transparent 1px);
  background-size: 22px 22px;
}
.canvas-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 40px; pointer-events: none;
}
.ce-box { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 440px; }
.ce-ico { color: var(--line); }
.ce-title { color: var(--text); font-size: 16px; font-weight: 600; letter-spacing: .5px; }
.ce-desc { color: var(--sub); font-size: 13px; line-height: 2; }
.ce-desc b { color: var(--accent); font-weight: 600; }
.canvas-tip { font-size: 11px; color: var(--sub); opacity: .8; margin-top: 8px; text-align: right; }

/* 画布上的组件 */
.diy-comp {
  position: absolute; padding: 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card);
  cursor: grab; touch-action: none; user-select: none;
  transition: border-color .15s, box-shadow .15s;
}
.diy-comp:hover { border-color: rgba(0, 200, 184, .45); }
/* 开关/滑杆本身就是一条带边框的窄控件：外层去掉 padding 和卡片底，
   让这条按钮正好等于组件尺寸（180x64 / 260x64），不再被 10px 内边距吃掉一圈 */
.diy-comp.ty-button, .diy-comp.ty-slider, .diy-comp.ty-stepper { padding: 0; border: 0; background: transparent; }
/* 没有边框就改用 outline 表示悬停/选中（outline 不占盒子尺寸，控件能正好 180x64） */
.diy-comp.ty-button:hover, .diy-comp.ty-slider:hover, .diy-comp.ty-stepper:hover { outline: 1px dashed rgba(0, 200, 184, .55); outline-offset: 3px; }
.diy-comp.ty-button.selected, .diy-comp.ty-slider.selected, .diy-comp.ty-stepper.selected {
  outline: 2px solid var(--accent); outline-offset: 3px; box-shadow: none;
}
.diy-comp.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 200, 184, .18); z-index: 2; }
.diy-comp.dragging { cursor: grabbing; box-shadow: 0 10px 26px rgba(0, 0, 0, .3); z-index: 5; }
/* 组件上的小工具：平时隐藏，悬停才出现，避免画布看起来很乱 */
.comp-tools {
  position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; opacity: 0;
  transition: opacity .15s; z-index: 2;
}
.diy-comp:hover .comp-tools { opacity: 1; }
.comp-tools span {
  width: 20px; height: 20px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; font-size: 11px;
  color: var(--sub); background: var(--side-bg); border: 1px solid var(--line); cursor: pointer;
}
.comp-tools span:hover { color: var(--text); border-color: var(--accent); }

/* 图标（统一 24x24 描边，颜色跟随 currentColor） */
.di { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.di.small { width: 16px; height: 16px; opacity: .6; }
/* 图标渐变的 <defs> 容器：不占位、不显示 */
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* 仪表盘 */
.comp-gauge { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.cg-svg { width: 100%; height: 100%; }
.cg-track { fill: none; stroke: var(--line); stroke-width: 10; }
.cg-bar {
  fill: none; stroke-width: 10; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 60px 60px;
  transition: stroke-dasharray .3s ease;
}
.cg-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.cg-center b { font-size: 26px; color: var(--text); }
.cg-center b i { font-size: 12px; font-style: normal; color: var(--sub); margin-left: 2px; }
.cg-center span { font-size: 12px; color: var(--sub); }

/* 开关按钮（按下会下发指令，状态来自设备回报） */
.comp-btn {
  width: 100%; height: 100%; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; border: 1.5px solid var(--accent); color: var(--accent);
  font-family: inherit; font-size: 15px; transition: .2s; padding: 0 14px;
  position: relative; user-select: none; -webkit-user-select: none; touch-action: none;
}
/* 按住模式：右上角"点动"角标，虚线边框区别于点击模式 */
.comp-btn.hold { border-style: dashed; }
.comp-btn.hold::after {
  content: '点动'; position: absolute; top: 4px; right: 6px;
  font-size: 9px; line-height: 1; padding: 2px 4px; border-radius: 4px;
  color: var(--sub); border: 1px solid var(--line); opacity: .75;
}
.comp-btn:hover { background: var(--hover-bg); }
.comp-btn .di { width: 20px; height: 20px; }
/* em = 组件名称（次要），span = 开/关状态（主） */
.comp-btn em {
  font-size: 13px; font-style: normal; opacity: .85;
  max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.comp-btn span { font-size: 15px; font-weight: 600; }
.comp-btn.on {
  color: #04231f; border-color: var(--accent);
  background: linear-gradient(160deg, var(--accent), var(--accent-dark));
  box-shadow: 0 0 18px rgba(0, 200, 184, .35);
}
.comp-btn.on span, .comp-btn.on em { color: #04231f; }
/* 按住时的即时反馈：还没决定"点动"还是"拖动"，先给一圈淡光。
   130ms 内移动超过 8px 就变成拖动（见 pressStart），这圈光跟着消失。 */
.comp-btn.armed { box-shadow: 0 0 0 2px rgba(0, 200, 184, .28); }
.comp-btn.on.armed { box-shadow: 0 0 18px rgba(0, 200, 184, .35), 0 0 0 3px rgba(0, 200, 184, .22); }
/* 已经在拖这个组件了：光标说明现在松手不会触发开关 */
.run-cell.dragging .comp-btn, .diy-comp.dragging .comp-btn { cursor: grabbing; }

/* 圆形开关（组件设置里的「形状 = 圆形」）：整块是个直径 96 的圆，
   图标在上、名称在下。字号跟长方形保持一致（13 / 15），只收紧行高把两行压进圆里 */
.comp-btn.round { border-radius: 50%; flex-direction: column; gap: 2px; padding: 0 6px; }
.comp-btn.round .di { width: 22px; height: 22px; }
.comp-btn.round em { font-size: 13px; line-height: 1.25; max-width: 100%; }
.comp-btn.round span { font-size: 15px; line-height: 1.2; }

/* 拨动开关（Toggle）/ 复选框（Checkbox）：系统设置里的原生观感，
   点一下切换并下发 1/0；拖位置和其它组件一样走「按住后移动 8px」判定 */
.comp-sw, .comp-ck {
  width: 100%; height: 100%; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; border: 0; border-radius: 12px; background: transparent;
  color: var(--text); font-family: inherit; cursor: pointer; position: relative;
  user-select: none; -webkit-user-select: none; touch-action: none; transition: background .2s;
}
.comp-sw:hover, .comp-ck:hover { background: var(--hover-bg); }
.comp-sw.armed, .comp-ck.armed { box-shadow: 0 0 0 2px rgba(0, 200, 184, .28); }
.tg-label {
  flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.comp-sw.on .tg-label, .comp-ck.on .tg-label { color: var(--text); }
/* 开关本体：胶囊轨道 + 圆钮；打开时轨道变主题色、圆钮滑到右边 */
.sw-track {
  flex: 0 0 auto; width: 52px; height: 30px; border-radius: 999px;
  background: var(--line); position: relative; transition: background .2s;
}
.sw-knob {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; transition: left .2s;
}
.comp-sw.on .sw-track { background: var(--accent); }
.comp-sw.on .sw-knob { left: 25px; }
/* 勾选框：圆角方块，勾上时填主题色 */
.ck-box {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px;
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  transition: background .2s, border-color .2s;
}
.ck-box svg {
  width: 17px; height: 17px; fill: none; stroke: transparent; stroke-width: 3;
  stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s;
}
.comp-ck.on .ck-box { background: var(--accent); border-color: var(--accent); }
.comp-ck.on .ck-box svg { stroke: #04231f; }

/* 滑杆 */
.comp-slider {
  width: 100%; height: 100%; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  /* 滑杆不要外圈亮边（用户要求）：边框设为透明，只保留底色，
     尺寸和之前完全一致（1.5px 仍在，只是不画颜色），改了样式也不会跳位 */
  border: 1.5px solid transparent; border-radius: 12px; background: var(--ipt-bg);
  transition: background .2s;
}
.comp-slider:hover { background: var(--hover-bg); }
.cs-name {
  font-size: 13px; color: var(--text); flex-shrink: 0; max-width: 42%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.comp-slider input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); cursor: pointer; }
/* 垂直滑杆（「方向 = 垂直」）：名称在上、滑杆竖直、数值在下。
   writing-mode: vertical-lr + direction: rtl 让滑杆竖过来，并且底部是最小值、顶部是最大值 */
.comp-slider.vertical { flex-direction: column; gap: 6px; padding: 10px 0; }
.comp-slider.vertical .cs-name { max-width: 100%; text-align: center; }
.comp-slider.vertical input[type="range"] {
  flex: 1; min-height: 0; width: 26px;
  writing-mode: vertical-lr; direction: rtl;
}
.comp-slider.vertical .cs-val { min-width: 0; text-align: center; }
.cs-val { font-size: 14px; color: var(--accent); flex-shrink: 0; min-width: 34px; text-align: right; }

/* 进度条：只读显示完成度（= 花盆小程序「土壤湿度」那条：名称+数值一行、下面一条圆角轨道）。
   用 flex-wrap 让轨道自己占满第二行（basis:100%）；垂直时整条转成列：名称 → 轨道 → 数值，
   填充从轨道底部往上长（轨道 align-items:flex-end + 内层 height） */
.comp-bar {
  width: 100%; height: 100%; display: flex; flex-wrap: wrap;
  align-content: center; align-items: baseline; gap: 8px;
}
.cb-name {
  flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cb-val { flex: none; font-size: 14px; font-weight: 500; color: var(--accent); }
.cb-track {
  flex: 0 0 100%; height: 12px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.cb-track > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--accent); box-shadow: 0 0 10px var(--bar-glow);
  transition: width .3s ease, height .3s ease;
}
.comp-bar.vertical {
  flex-wrap: nowrap; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px;
}
.comp-bar.vertical .cb-name { flex: none; max-width: 100%; text-align: center; }
/* 竖向读成「名称 / 轨道 / 数值」，和垂直滑杆一个顺序（DOM 里数值在轨道前面，用 order 挪到底下） */
.comp-bar.vertical .cb-val { flex: none; order: 3; }
.comp-bar.vertical .cb-track {
  flex: 1 1 auto; order: 2; width: 12px; height: auto; min-height: 48px;
  display: flex; align-items: flex-end;
}
.comp-bar.vertical .cb-track > i { width: 100%; height: 0; }

/* 加减按钮：名称 + − 值 +，外形和滑杆保持一致（同一条窄控件） */
.comp-step {
  width: 100%; height: 100%; display: flex; align-items: center; gap: 8px; padding: 0 10px;
  /* 与滑杆/开关按钮同一套亮边 */
  border: 1.5px solid var(--accent); border-radius: 12px; background: var(--ipt-bg);
  transition: box-shadow .2s;
}
.comp-step:hover { box-shadow: 0 0 0 3px var(--accent-soft, rgba(0, 200, 184, .12)); }
.step-name {
  /* 不撑满：整条控件多宽是按名字算出来的（stepWidth），名称只占自己需要的宽度，
     两字的名字不会再在后面留一大截空白 */
  flex: 0 1 auto; min-width: 0; font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.step-btn {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 18px; line-height: 1;
  color: var(--accent); background: transparent; border: 1.5px solid var(--accent);
  transition: background .15s, color .15s, transform .1s;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.step-btn:hover { background: var(--accent); color: #04231f; }
.step-btn:active { transform: scale(.92); }
.step-val { flex-shrink: 0; min-width: 44px; text-align: center; font-size: 15px; color: var(--accent); }
.step-val i { font-style: normal; font-size: 11px; color: var(--sub); margin-left: 1px; }

/* 状态灯 */
.comp-led { width: 100%; height: 100%; display: flex; align-items: center; gap: 10px; padding: 6px; }
.led-dot {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  background: var(--line); border: 1px solid var(--line); transition: .2s;
}
.comp-led.on .led-dot { background: #2ecc71; border-color: #2ecc71; box-shadow: 0 0 12px rgba(46, 204, 113, .6); }
/* 两行字只占自己需要的宽度，图标紧跟着字走。
   原来这里是 flex:1，会把这行撑满格子 → 240 宽的状态灯里，图标被顶到最右边，
   和文字之间空出一大截（运行大屏上看着两块是一个整体散开了）。 */
.led-txt { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.led-txt b { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.led-txt span { font-size: 11px; color: var(--sub); }

/* 人体存在：红外人体图标，有人(1)绿 / 无人(0/无数据/离线)灰，图标颜色由 presenceFill 内联给 path */
/* 人体存在：和心率组件同款竖排——红外图标在上（放大到接近心形的尺寸），下方名称 + 有人/无人 */
.comp-presence {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 6px; box-sizing: border-box;
}
.presence-ico { width: 60px; height: 60px; flex-shrink: 0; transition: .2s; }
.comp-presence.on .presence-ico { filter: drop-shadow(0 0 6px rgba(34, 197, 94, .5)); }
.presence-txt { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-width: 0; max-width: 100%; }
.presence-txt b { font-size: 13px; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-txt span { font-size: 11px; color: var(--sub); }

/* 数值卡片 / 文字 */
.comp-value { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.comp-value b { font-size: 28px; color: var(--text); }
.comp-value b i { font-size: 12px; font-style: normal; color: var(--sub); margin-left: 2px; }
.comp-value span { font-size: 12px; color: var(--sub); }
/* 数值卡片报警闪烁：用 box-shadow 画描边（不占布局，组件尺寸不会跳）；
   颜色来自模板内联的 --al，与弹窗颜色一致 */
.comp-value.firing, .pv-value.firing {
  border-radius: 10px;
  animation: valAlarmBlink .9s steps(1) infinite;
}
.comp-value.firing b, .pv-value.firing b { color: var(--al); }
@keyframes valAlarmBlink {
  0%, 49%   { box-shadow: 0 0 0 2px var(--al), 0 0 20px -5px var(--al); }
  50%, 100% { box-shadow: 0 0 0 2px transparent, 0 0 0 transparent; }
}
.comp-text { width: 100%; height: 100%; display: flex; align-items: center; color: var(--sub); font-size: 13px; line-height: 1.5; }

/* 心率组件：爱心 + 下方 bpm（运行视图 / 调试画布共用 .comp-heart）。
   动画时长由内联 style 的 animationDuration 控制（= 60 / bpm 秒），这里只定形状与配色 */
.comp-heart {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
}
/* 心形：与小程序端同款画法（两个圆角方块分别旋转 ±45° 拼出双瓣 + 尖底），
   比 SVG path 更标准、更对称；颜色走 --heart-color（组件配置 color） */
.heart-shape {
  position: relative; width: 64px; height: 58px;
  transform-origin: center;
  animation: heartBeat 1s ease-in-out infinite;
  will-change: transform;
}
.heart-shape::before, .heart-shape::after {
  content: ''; position: absolute; top: 0;
  width: 32px; height: 50px;
  border-radius: 32px 32px 0 0;
  background: var(--heart-color, #ff4d6d);
}
.heart-shape::before { left: 32px; transform: rotate(-45deg); transform-origin: 0 100%; }
.heart-shape::after  { left: 0;    transform: rotate(45deg);  transform-origin: 100% 100%; }
.heart-bpm { display: flex; align-items: baseline; gap: 3px; color: var(--text); }
.heart-bpm b { font-size: 22px; font-weight: 700; line-height: 1; }
.heart-bpm i { font-size: 12px; font-style: normal; color: var(--sub); }
.heart-label { font-size: 12px; color: var(--sub); }
/* 手机预览里的爱心稍小一点 */
.pv-heart { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.pv-heart .heart-shape { width: 48px; height: 44px; }
.pv-heart .heart-shape::before, .pv-heart .heart-shape::after { width: 24px; height: 37px; border-radius: 24px 24px 0 0; }
.pv-heart .heart-shape::before { left: 24px; }
.pv-heart .heart-shape::after  { left: 0; }
.heart-shape.heart-still { animation: none; }   /* bpm≤0 / 无数据 / 离线：心形静止不跳 */
/* 心率报警：心形保持跳动，同时叠加一圈和报警色同色的呼吸光晕（心跳用 transform、光晕用 filter，互不打架） */
.heart-shape.heart-alert { animation: heartBeat 1s ease-in-out infinite, heartGlow 1.3s ease-in-out infinite; }
@keyframes heartGlow {
  0%, 100% { filter: drop-shadow(0 0 5px var(--heart-color)); }
  50%      { filter: drop-shadow(0 0 16px var(--heart-color)); }
}

/* lub-dub 双拍：一个周期里快速两下（咚-嗒），比单跳更像真实心跳 */
@keyframes heartBeat {
  0%   { transform: scale(1); }
  14%  { transform: scale(1.18); }
  28%  { transform: scale(1); }
  42%  { transform: scale(1.10); }
  56%  { transform: scale(1); }
  100% { transform: scale(1); }
}

/* 呼吸组件：肺随呼吸频率缩放（呼吸越快动画越快），运行视图 / 调试画布共用 .comp-breath。
   动画时长由内联 style 的 animationDuration 控制（= 60 / 呼吸频率 秒），这里只定形状与配色 */
.comp-breath {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
}
/* 肺：内嵌原始 SVG（多色实心），随 --breath-color 呼吸光晕；缩放动画作用在容器上 */
.breath-shape {
  position: relative; width: 60px; height: 60px;
  transform-origin: center;
  animation: breathPulse 4.5s ease-in-out infinite;   /* 默认静息节奏，duration 会被内联覆盖 */
  will-change: transform;
}
/* 原始肺.svg：9 段 path 各自多色，铺满容器；viewBox=1024 原生坐标无需 transform */
.breath-lung { display: block; width: 100%; height: 100%; }
.breath-bpm { display: flex; align-items: baseline; gap: 3px; color: var(--text); }
.breath-bpm b { font-size: 22px; font-weight: 700; line-height: 1; }
.breath-bpm i { font-size: 12px; font-style: normal; color: var(--sub); }
.breath-label { font-size: 12px; color: var(--sub); }
/* 手机预览里的肺稍小一点 */
.pv-breath { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.pv-breath .breath-shape { width: 46px; height: 46px; }
/* 频率≤0 / 无数据 / 离线：肺静止不缩放 */
.breath-shape.breath-still { animation: none; }
/* 报警：保持缩放，叠加一圈报警色呼吸光晕 */
.breath-shape.breath-alert { animation: breathPulse 4.5s ease-in-out infinite, breathGlow 1.3s ease-in-out infinite; }
@keyframes breathGlow {
  0%, 100% { filter: drop-shadow(0 0 4px var(--breath-color)); }
  50%      { filter: drop-shadow(0 0 14px var(--breath-color)); }
}
/* 吸气-呼气：一周期里平滑放大再缩小，呼吸越快 duration 越短、动画越快 */
@keyframes breathPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

/* 血氧组件：水滴 + 下方 SpO2%（%），运行视图 / 调试画布共用 .comp-spo2。
   水滴用纯 CSS 画（一个方块 border-radius 三圆一尖、再旋转 45° 让尖角朝上），颜色走 --spo2-color。
   .spo2-drop 本身不旋转，形状交给 ::before，O₂ 文字单独居中、不被旋转 */
.comp-spo2 {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
}
.spo2-drop {
  position: relative;
  width: 46px; height: 46px;
  /* 正常态：一圈和水滴同色的光晕（--spo2-color 默认青色；报警时会被换成报警色） */
  filter: drop-shadow(0 0 8px var(--spo2-color, #36cffb));
}
.spo2-drop::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--spo2-color, #36cffb);
  border-radius: 0 50% 50% 50%;
  transform: rotate(45deg);
}
.spo2-drop .o2 {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -1px;
}
.spo2-val { display: flex; align-items: baseline; gap: 3px; color: var(--text); }
.spo2-val b { font-size: 22px; font-weight: 700; line-height: 1; }
.spo2-val i { font-size: 12px; font-style: normal; color: var(--sub); }
.spo2-label { font-size: 12px; color: var(--sub); }
/* 灰色静止态：值≤0 / 无数据 / 设备离线 → 图标变灰、停掉一切动画、去掉彩色光晕（与心率离线态一致） */
.spo2-drop.gray { animation: none !important; filter: none; }
.spo2-drop.gray::before { background: #9aa0a6; }
/* 呼吸动画：整颗水滴（含 O₂）轻轻缩放，像吸气-呼气 */
.spo2-drop.breathe { animation: spo2Breathe 3.2s ease-in-out infinite; }
@keyframes spo2Breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
/* 低氧报警：水滴变报警色 + 脉冲光晕（在 ::before 上做，保持 45° 旋转）。
   颜色直接用 var(--spo2-color)（spo2DropColor 在报警时已换成报警色），与正常态光晕同色系 */
.spo2-drop.alert { filter: none; }
.spo2-drop.alert::before {
  box-shadow: 0 0 8px 2px var(--spo2-color);
  animation: spo2AlertPulse 1.3s ease-in-out infinite;
}
@keyframes spo2AlertPulse {
  0%, 100% { transform: rotate(45deg) scale(1);    box-shadow: 0 0 6px 1px var(--spo2-color); }
  50%      { transform: rotate(45deg) scale(1.06); box-shadow: 0 0 14px 4px var(--spo2-color); }
}
/* 手机预览里的水滴稍小一点 */
.pv-spo2 { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.pv-spo2 .spo2-drop { width: 36px; height: 36px; }
.pv-spo2 .spo2-drop .o2 { font-size: 13px; }

/* 历史数据组件（调试画布里的占位卡）：显示要画哪几条线，进运行视图才真正画图。
   卡片和数值卡片一样大（176×112），字段名要最多塞下 6 条 → 字号/内距/间隙都收紧 */
.comp-chart {
  width: 100%; height: 100%; display: flex; flex-direction: column; gap: 5px;
  justify-content: center; padding: 0 2px; overflow: hidden;
}
.cc-head { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
.cc-head .di { color: var(--accent); }
.cc-fields { display: flex; flex-wrap: wrap; gap: 5px; row-gap: 4px; }
.cc-fields span {
  font-size: 11px; line-height: 1.35; padding: 2px 7px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--sub); white-space: nowrap;
}
.cc-fields i { font-style: normal; font-size: 11px; color: var(--sub); opacity: .8; }
.cc-hint { font-size: 11px; color: var(--sub); opacity: .75; }

/* 定时器卡片（调试画布）：和数值卡片一样大，时间用大字号，下面是"打开/关闭 谁" */
.comp-timer {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  justify-content: center; gap: 2px; padding: 0 4px; overflow: hidden;
}
.tm-head { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; min-width: 0; }
.tm-head .di { width: 16px; height: 16px; flex: none; }
.tm-head > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-time {
  font-size: 30px; line-height: 1.1; color: var(--text); font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: .5px;
}
.tm-line {
  font-size: 12px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: none;   /* 卡片是 flex column：文字行必须禁止压缩，否则高度不够时被压成一条缝 */
}
.tm-next {
  font-size: 11px; color: var(--sub); opacity: .8;
  /* 卡片只有 180 宽，长文案必须单行省略，否则最后两个字会掉到第二行 */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: none;
}
/* 停用：整卡褪色 + 时间划掉，一眼看出"这个现在不生效" */
.comp-timer.off { opacity: .5; }
.comp-timer.off .tm-time { text-decoration: line-through; }
/* 启用/停用胶囊（只在运行视图出现，画布上在设置面板里改） */
.tm-toggle {
  margin-left: auto; flex: none; font-family: inherit; font-size: 11px; line-height: 1;
  padding: 4px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--sub);
}
.tm-toggle.on { color: var(--accent); border-color: var(--accent); background: rgba(0, 200, 184, .12); }

/* ---------- 造物 · 运行视图（花盆大屏同款布局，组件可自由拖动） ---------- */
.run-tip { font-size: 12px; color: var(--sub); margin: 2px 0 4px; }
.run-tip b { color: var(--accent); font-weight: 600; }

/* 运行画布：组件绝对定位，坐标存在 diy_components.rx/ry（和调试画布 x/y 分开） */
.run-canvas {
  position: relative; margin-top: 10px; border-radius: 12px;
  border: 1px solid var(--line);
  background-color: var(--ipt-bg);
  /* 高度由 runCanvasH 跟着最靠下的组件走；横向可滚动——
     窄屏（手机）上看不到的组件往右滑就有，绝不能为了"看得见"去改坐标，
     否则手机上开一次大屏就会把桌面摆好的布局压乱（见 mounted 里的 resize 注释）。
     overscroll-behavior 只锁横向：纵向交给页面，鼠标滚轮照样能上下滚（锁了 contain 会让页面滚不动） */
  overflow: auto; overscroll-behavior-x: contain;
}
.run-cell {
  position: absolute; padding: 10px; border-radius: 12px;
  /* 组件自己不垫底色：暗色主题下 var(--card) 就是一块块"黑砖"，压在大屏底图上面很脏。
     现在只有组件本身（表盘弧线 / 控件描边 / 数值 / 曲线）露出来，和花盆大屏一个观感。 */
  border: 0; background: transparent;
  display: flex; align-items: stretch;
  cursor: default; touch-action: none; user-select: none; -webkit-user-select: none;
}
/* 高亮框只在"按住这个组件"时出现（runPress），鼠标扫过不闪框：
   运行视图是给人看的，不是编辑态，平时保持干净。
   ⚠️ 框不画在格子上（.run-cell），而是由 .run-frame 这个绝对定位的空元素按内容实测大小画
   （见 app.js pressFrameOf）：数值卡 220×150 的格子里数字是居中的，画格子框会空一大片。
   box-shadow 不占布局、圆角跟着走，拖到画布边缘也不会像 outline 那样被裁一条。 */
.run-cell.pressing { cursor: grabbing; z-index: 5; }
.run-frame {
  position: absolute; z-index: 4; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 1.5px var(--accent);
}
.run-cell.dragging { z-index: 6; }
/* 开关 / 滑杆本身就是一条带框的窄控件，外层不能再留内边距，否则控件被吃掉一圈 */
.run-cell.ty-button, .run-cell.ty-slider, .run-cell.ty-stepper { padding: 0; }
/* ⠿ 抓手：平时透明，鼠标移到组件上才淡淡出现（按钮/滑杆这类控件靠它拖动） */
.run-grip {
  position: absolute; top: 2px; left: 4px; z-index: 3;
  font-size: 13px; line-height: 1; color: var(--sub);
  opacity: 0; cursor: grab; letter-spacing: -1px; transition: opacity .15s;
}
.run-cell:hover .run-grip { opacity: .35; }
.run-cell.pressing .run-grip { cursor: grabbing; opacity: 1; }

/* 单元格里的组件铺满；控件整体放大一号，像"成品大屏"而不是调试态 */
.run-cell .comp-btn, .run-cell .comp-slider, .run-cell .comp-led,
.run-cell .comp-presence,
.run-cell .comp-value, .run-cell .comp-text, .run-cell .comp-timer,
.run-cell .comp-bar { width: 100%; }
/* 定时器：运行视图整体放大一档（时间 40px，隔着两米也看得清）。
   卡片只有 200×132：头部 + 40px 时间 + 两行说明正好塞满，
   所以每块都 flex:none、行距收紧，不然文字会被压扁（曾出现行高被压成 6px） */
.run-cell .comp-timer.run-timer { padding: 12px 14px; border-radius: 14px; gap: 2px; }
.run-cell .comp-timer .tm-head { font-size: 14px; line-height: 1.2; flex: none; }
.run-cell .comp-timer .tm-head .di { width: 18px; height: 18px; }
.run-cell .comp-timer .tm-time { font-size: 40px; line-height: 1.05; flex: none; }
.run-cell .comp-timer .tm-line { font-size: 13px; line-height: 1.25; }
.run-cell .comp-timer .tm-next { font-size: 12px; line-height: 1.25; }
.run-cell .tm-toggle { font-size: 11px; padding: 3px 8px; }
.run-cell .comp-btn { gap: 9px; font-size: 16px; border-radius: 14px; padding: 0 18px; }
.run-cell .comp-btn .di { width: 22px; height: 22px; }
.run-cell .comp-btn span { font-size: 16px; }
.run-cell .comp-btn em { font-size: 14px; }
.run-cell .comp-value b { font-size: 42px; }
.run-cell .comp-value b i { font-size: 14px; }
.run-cell .comp-value span { font-size: 13px; }
.run-cell .led-dot { width: 22px; height: 22px; }
.run-cell .led-txt b { font-size: 15px; }
.run-cell .led-txt span { font-size: 12px; }
.run-cell .presence-ico { width: 64px; height: 64px; }
.run-cell .presence-txt b { font-size: 15px; }
.run-cell .presence-txt span { font-size: 12px; }
.run-cell .cs-name { font-size: 14px; }
.run-cell .cs-val { font-size: 16px; }
.run-cell .comp-slider { padding: 0 14px; border-radius: 14px; }
/* 进度条在大屏上放大一档：数值 18px、轨道 14px、垂直轨道 16px（隔着两米也看得清） */
.run-cell .comp-bar { gap: 10px; }
.run-cell .cb-name { font-size: 15px; }
.run-cell .cb-val { font-size: 18px; }
.run-cell .cb-track { height: 14px; }
.run-cell .comp-bar.vertical { gap: 8px; }
.run-cell .comp-bar.vertical .cb-track { width: 16px; }
/* 运行视图里拨动开关/复选框放大一档（手指更好点） */
.run-cell .comp-sw, .run-cell .comp-ck { padding: 0 14px; gap: 12px; border-radius: 14px; }
.run-cell .tg-label { font-size: 14px; }
.run-cell .sw-track { width: 62px; height: 36px; }
.run-cell .sw-knob { width: 30px; height: 30px; }
.run-cell .comp-sw.on .sw-knob { left: 29px; }
.run-cell .ck-box { width: 30px; height: 30px; border-radius: 8px; }
.run-cell .ck-box svg { width: 19px; height: 19px; }
/* 运行视图里的圆形按钮 / 垂直滑杆：比调试画布大一圈（尺寸见 RUN_CIRCLE / RUN_SLIDER_V）。
   ⚠️ 这三条必须写在 `.run-cell .comp-btn/.comp-slider` 之后：上面那条把圆角写成了 14px，
   同优先级相加后会盖掉 `.comp-btn.round` 的 50%，圆按钮就会变成"圆角方块"。 */
.run-cell .comp-btn.round { border-radius: 50%; padding: 0 8px; gap: 2px; }
.run-cell .comp-btn.round .di { width: 26px; height: 26px; }
.run-cell .comp-btn.round em { font-size: 14px; line-height: 1.25; }
.run-cell .comp-btn.round span { font-size: 16px; line-height: 1.2; }
.run-cell .comp-slider.vertical { padding: 12px 0; }
.run-cell .comp-slider.vertical input[type="range"] { width: 30px; }
/* 运行视图里加减按钮和开关按钮一样大（200×64）：内距/间隙收紧，给名称留点宽度 */
.run-cell .comp-step { padding: 0 10px; border-radius: 14px; gap: 8px; }
.run-cell .step-name { font-size: 14px; }
.run-cell .step-btn { width: 34px; height: 34px; font-size: 20px; }
.run-cell .step-val { font-size: 17px; }
.run-cell .comp-text { font-size: 14px; }

/* 仪表盘单元格：表盘占满上部，名称居中压在底部（尺寸由 RUN_SIZE 给） */
.run-gauge { width: 100%; height: 100%; display: flex; flex-direction: column; }
.run-gauge .gauge-wrap { flex: 1; min-height: 0; }
.run-gauge .gauge { width: 100%; height: 100%; }
.run-gauge .gauge-label {
  flex-shrink: 0; height: 22px; line-height: 22px; margin-top: 0;
  text-align: center;                    /* 名称跟表盘居中对齐，不再贴左下角 */
}
/* 样式一：圆圈表盘按造物大屏的尺寸（c.w × c.h，模板里给的内联宽高）居中显示，
   不再拉满整格，字号也保持调试画布那套 */
.run-gauge > .comp-gauge { flex: 0 0 auto; margin: auto; }

/* 历史曲线单元格 */
.run-cell.ty-chart { padding: 12px 14px 8px; }
.run-chart { width: 100%; height: 100%; display: flex; flex-direction: column; min-width: 0; }
.rc-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px 10px; flex-shrink: 0; margin-bottom: 2px;
}
.rc-head b { font-size: 14px; font-weight: 600; color: var(--text); }
.rc-head > span { font-size: 11px; color: var(--sub); }
/* 曲线标题行右侧：5 个时间范围按钮 + 导出（和花盆大屏那排胶囊同一套观感） */
.rc-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.rc-tabs { display: flex; gap: 6px; }
.rc-tabs span {
  font-size: 12px; line-height: 1; color: var(--sub); padding: 6px 11px; border-radius: 13px;
  border: 1px solid var(--line); cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.rc-tabs span:hover { color: var(--text); border-color: var(--accent); }
.rc-tabs span.active {
  color: var(--accent); border-color: var(--accent); background: rgba(0, 200, 184, .10); font-weight: 600;
}
.rc-export { padding: 5px 11px; font-size: 12px; white-space: nowrap; }
.rc-box { flex: 1; min-height: 0; width: 100%; }
.rc-empty {
  position: absolute; left: 14px; right: 14px; top: 50%; transform: translateY(-50%);
  text-align: center; font-size: 12px; color: var(--sub); pointer-events: none;
}

.run-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 40px; text-align: center;
  color: var(--sub); font-size: 13px; line-height: 1.9;
  pointer-events: none;
}

/* 右栏 */
.diy-side {
  width: 320px; flex-shrink: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 12px; background: var(--side-bg);
  min-height: 560px; overflow: hidden;
}
.diy-tabs { display: flex; border-bottom: 1px solid var(--line); }
.diy-tabs span {
  flex: 1; text-align: center; font-size: 13px; color: var(--sub);
  padding: 11px 0; cursor: pointer; border-bottom: 2px solid transparent;
}
.diy-tabs span.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--hover-bg); }
.diy-pane { padding: 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }

.palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pal {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px; border-radius: 10px; cursor: pointer;
  background: var(--ipt-bg); border: 1px solid var(--line); color: var(--sub);
  font-family: inherit; font-size: 12px; transition: .15s;
}
.pal:hover { color: var(--accent); border-color: var(--accent); background: var(--hover-bg); }
/* 点过但还没点确定：这一格亮着，提醒"正在右边填设置" */
.pal.active { color: var(--accent); border-color: var(--accent); background: rgba(0, 200, 184, .12); }
.pal .di { width: 22px; height: 22px; }

/* 组件设置表单 */
.comp-form { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.cf-title { font-size: 12px; color: var(--accent); display: flex; align-items: center; gap: 6px; }
/* 添加组件时的价格提示（只在"新加"时出现，改已有组件不再收费） */
.cf-cost {
  font-style: normal; font-size: 11px; color: var(--sub);
  background: rgba(127, 127, 127, .12); border-radius: 6px; padding: 1px 6px;
}
.cf-close {
  margin-left: auto; font-style: normal; font-size: 11px; line-height: 1;
  width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  border-radius: 5px; color: var(--sub); border: 1px solid var(--line); cursor: pointer;
}
.cf-close:hover { color: var(--text); border-color: var(--accent); }
.cf-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sub); }
.cf-row > span { width: 56px; flex-shrink: 0; }
.cf-row .ipt { padding: 7px 9px; font-size: 13px; }
.cf-row .ipt.mini { width: 62px; }
.cf-row .ipt.mini2 { width: 76px; }
.cf-row .ipt.color { width: 44px; height: 30px; padding: 2px; }
/* 选了表盘类型后，单位/范围/颜色由预设决定：置灰表示"改了也不生效" */
.cf-row .ipt:disabled { opacity: .4; cursor: not-allowed; }
.cf-icons { display: flex; flex-wrap: wrap; gap: 5px; }
.cf-icons span {
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: 7px; border: 1px solid var(--line); color: var(--sub); cursor: pointer;
}
.cf-icons span:hover { color: var(--text); border-color: var(--accent); }
.cf-icons span.active { color: #04231f; background: var(--accent); border-color: var(--accent); }
.cf-icons .di { width: 15px; height: 15px; }
.cf-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.cf-pills span {
  padding: 6px 10px; font-size: 12px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); color: var(--sub); white-space: nowrap;
}
.cf-pills span:hover { color: var(--text); border-color: var(--accent); }
.cf-pills span.active { color: #04231f; background: var(--accent); border-color: var(--accent); }
/* 选「每周」后展开的七个星期：等宽小方块，一行排满（不用 flex-wrap 换行） */
.cf-pills.cf-days { gap: 4px; flex-wrap: nowrap; }
.cf-pills.cf-days span {
  width: 26px; padding: 6px 0; text-align: center;
  display: inline-flex; align-items: center; justify-content: center;
}
/* 表盘类型五个胶囊（样式一/样式二/温度/湿度/土壤）：标签独占一行，
   胶囊用整行宽度排开，右栏窄也不会挤成三行 */
.cf-kinds { flex-direction: column; align-items: flex-start; gap: 6px; }
.cf-kinds > span { width: auto; }
.cf-kinds .cf-pills { gap: 5px; }
.cf-kinds .cf-pills span { padding: 4px 7px; font-size: 11px; }
/* 历史数据组件：可选的数据字段胶囊（勾哪个画哪条线） */
.cf-row.chart-fields { align-items: flex-start; }
.cf-row.chart-fields > span { padding-top: 6px; }
.cf-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cf-chips > span {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 8px; font-size: 12px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); color: var(--sub); white-space: nowrap;
}
.cf-chips > span:hover { color: var(--text); border-color: var(--accent); }
.cf-chips > span.active { color: var(--text); border-color: var(--accent); background: rgba(0, 200, 184, .12); }
.cf-chips em { font-style: normal; font-size: 10px; opacity: .6; }
.cf-dot { width: 7px; height: 7px; border-radius: 50%; opacity: .55; flex-shrink: 0; }
.cf-chips > span.active .cf-dot { opacity: 1; }
.cf-none { font-style: normal; font-size: 11px; color: var(--sub); opacity: .8; }
.cf-hint { font-size: 11px; line-height: 1.7; color: var(--sub); opacity: .85; }
/* 开关按钮「定时开关」：每条定时是一张卡。行与行之间留间距，
   避免「重复」和「状态」两行贴在一起被看成叠加 */
.cf-timers { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.cf-timer {
  position: relative;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: rgba(255, 255, 255, .025);
}
.cf-timer-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cf-timer-idx { font-size: 12px; font-weight: 600; color: var(--text); }
.cf-timer .cf-row { margin-bottom: 9px; }
.cf-timer .cf-row:last-child { margin-bottom: 0; }
/* 删除定时：圆角彩色底框（柔和红），和主按钮的青色区分开 */
.cf-del {
  border: none; border-radius: 8px; cursor: pointer;
  padding: 4px 12px; font-size: 12px; line-height: 1.4;
  background: rgba(255, 92, 92, .15); color: #ff8282;
}
.cf-del:hover { background: rgba(255, 92, 92, .26); color: #ff9f9f; }
/* 开关按钮内部：有启用中的定时时，显示一枚彩色定时器（时钟）图标 */
.tm-in {
  width: 14px; height: 14px; flex: none;
  stroke: #f5a623; stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
/* 长方形开关：时钟图标移到方框内右上角（圆形开关保持内联，不做绝对定位） */
.comp-btn:not(.round) .tm-in,
.pv-btn:not(.round) .tm-in {
  position: absolute; top: 5px; right: 6px;
}
.cf-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }
.diy-hint { font-size: 11px; line-height: 1.8; color: var(--sub); opacity: .9; }
.diy-hint code {
  font-family: ui-monospace, Consolas, monospace; font-size: 11px;
  background: var(--ipt-bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px;
}

/* 代码面板 */
.code-tabs { display: flex; gap: 6px; }
.code-tabs span {
  flex: 1; text-align: center; font-size: 12px; padding: 6px 0; border-radius: 8px;
  border: 1px solid var(--line); color: var(--sub); cursor: pointer;
}
.code-tabs span.active { color: #04231f; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.code-box {
  flex: 1; min-height: 260px; max-height: 360px; overflow: auto;
  margin: 0; padding: 10px; border-radius: 8px;
  background: var(--ipt-bg); border: 1px solid var(--line);
  font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.6;
  color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2;
}

/* 调试台 */
.debug-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--sub); }
/* 右侧两个控件成组，别被 space-between 拉开 */
.debug-tools { display: flex; align-items: center; gap: 8px; }
/* 自动滚屏：小号勾选框 + 文字，选中时整条变青色（和画布复选框一个观感，只是小一号） */
.dbg-auto {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 7px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); color: var(--sub);
  font-size: 11px; line-height: 1; white-space: nowrap;
  user-select: none; -webkit-user-select: none;
}
.dbg-auto:hover { color: var(--text); border-color: var(--accent); }
.dbg-auto .ck {
  width: 13px; height: 13px; border-radius: 4px; flex: none;
  border: 1px solid var(--line); color: #04231f;
  display: inline-flex; align-items: center; justify-content: center;
}
.dbg-auto .ck svg {
  width: 9px; height: 9px; fill: none; stroke: currentColor;
  stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0;     /* 选中才显示对勾（未选中就是一个空框） */
}
.dbg-auto.on { color: var(--accent); border-color: var(--accent); background: rgba(0, 200, 184, .12); }
.dbg-auto.on .ck { border-color: var(--accent); background: var(--accent); }
.dbg-auto.on .ck svg { opacity: 1; }
.debug-box {
  flex: 1; min-height: 320px; max-height: 460px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; background: var(--ipt-bg); padding: 6px;
  font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.7;
}
.dbg { display: flex; gap: 6px; padding: 2px 0; border-bottom: 1px dashed var(--line); word-break: break-all; }
.dbg:last-child { border-bottom: 0; }
.dbg-t { color: var(--sub); opacity: .7; flex-shrink: 0; }
.dbg-d { flex-shrink: 0; width: 28px; text-align: center; border-radius: 4px; font-size: 10px; }
.dbg.up .dbg-d { color: #2ecc71; }
.dbg.down .dbg-d { color: #569cd6; }   /* 示例里「下发」是蓝色，不是青色 */
.dbg.sys .dbg-d { color: var(--sub); }
.dbg.err .dbg-d { color: #ff6b6b; }
.dbg-x { color: #d4d4d4; }             /* JSON 标点：浅灰白 */
/* JSON 语法着色（对齐示例：上报键琥珀、下发键浅蓝、字符串红、数字橙） */
.dbg-x .j-key-up { color: #e5c07b; }
.dbg-x .j-key { color: #9cdcfe; }
.dbg-x .j-str { color: #f07178; }
.dbg-x .j-num { color: #ce9178; }
.dbg-x .j-bool { color: #569cd6; }
.dbg.err .dbg-x { color: #ff6b6b; }
.dbg.err .dbg-x span { color: inherit; }
/* 亮色主题：同样的分类换成深色，浅底上才看得清 */
:root.light .dbg-x { color: #333; }
:root.light .dbg-x .j-key-up { color: #9a6700; }
:root.light .dbg-x .j-key { color: #005a9e; }
:root.light .dbg-x .j-str { color: #c0392b; }
:root.light .dbg-x .j-num { color: #b35c00; }
:root.light .dbg-x .j-bool { color: #0b65c2; }
:root.light .dbg.up .dbg-d { color: #1a8a4a; }
:root.light .dbg.down .dbg-d { color: #0b65c2; }
.dbg-empty { color: var(--sub); padding: 12px 6px; line-height: 1.9; }
.dbg-empty code { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .side { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .gauge { width: 160px; height: 140px; }
  /* 造物大屏：右栏放到画布下方，画布矮一点 */
  .diy-body { flex-direction: column; }
  .diy-side { width: 100%; min-height: 420px; }
  .diy-canvas { height: 460px; }
}

@media (max-width: 620px) {
  /* 窄屏优先保 LOGO，产品名与分隔线让位 */
  .brand-div, .brand-name { display: none; }
  .topbar { padding: 12px 16px; }
}

/* ================= 造物 · 手机发布预览 =================
   手机壳尺寸按 iPhone 逻辑宽 375 做（外壳 392 = 375 + 边框），高度 806。
   屏内不是绝对定位：两列 grid 自己排，所以换成 360 宽的安卓也不会错位。 */
.ph-stage { user-select: none; -webkit-user-select: none; }
/* 拖动时整页鼠标统一显示"抓取中"，避免拖到格子外面又变回默认箭头 */
body.ph-dragging, body.ph-dragging * { cursor: grabbing !important; }
.ph-tip { font-size: 12px; color: var(--sub); margin: 4px 0 12px; line-height: 1.7; }
.ph-wrap { display: flex; gap: 22px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }

/* 左侧：手机里不显示的组件 */
.ph-tray { width: 196px; flex: none; border: 1px dashed var(--line); border-radius: 14px; padding: 12px; position: relative; transition: border-color .15s, background .15s; }
/* 把手机里的组件拖到左侧 = 从手机移除：托盘整块亮起来给个明确落点 */
.ph-tray.drop-active { border-color: var(--accent); background: rgba(0, 200, 184, .07); }
.ph-tray.drop-active::after {
  content: '松手：从手机移除'; position: absolute; left: 12px; right: 12px; bottom: 34px;
  padding: 6px 8px; border-radius: 8px; text-align: center; font-size: 11px;
  color: var(--accent); background: var(--card);
  border: 1px dashed var(--accent); pointer-events: none;
}
.ph-tray-h { font-size: 12px; color: var(--sub); margin-bottom: 10px; display: flex; justify-content: space-between; }
.ph-tray-h em { font-style: normal; color: var(--accent); }
.ph-tray-list { min-height: 60px; }
.ph-tray-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; margin-bottom: 8px; cursor: grab; touch-action: none;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  font-size: 12px; color: var(--text);
}
.ph-tray-item:hover { border-color: var(--accent); }
.ph-tray-item b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-tray-item span { font-size: 11px; color: var(--sub); flex: none; }
.ph-tray-item.picked { outline: 1.5px dashed var(--accent); opacity: .35; }
.ph-tray-empty { font-size: 11px; color: var(--sub); opacity: .8; padding: 8px 2px; }
.ph-tray-tip { font-size: 11px; color: var(--sub); opacity: .7; margin-top: 8px; }

/* 中间：手机壳（外观对齐微信开发者工具的设备模型：圆角外框 + 刘海 + 状态栏 + Home 条） */
/* 手机壳自带一整套主题变量（暗色），**不继承整站**：
   屏内那颗胶囊只切手机自己的明暗，所以整站是亮的时候手机也得能单独切回暗。
   色值照抄小程序 pages/index/index.wxss —— 预览里看到的必须和小程序真机是同一套色。 */
.phone-shell {
  --bg: #0c1818;
  --bg2: #132f2f;
  --card: #0f2222;
  --line: #1f3a3a;
  --text: #e8f2f0;
  --sub: #8fa8a4;
  --accent: #00c8b8;
  --accent-dark: #009482;
  --red: #ff5a5a;
  --orange: #ff9900;
  --warn: #fbbf24;
  --ipt-bg: #0a1a1a;
  --bar-bg: rgba(12, 24, 24, .6);
  --bar-glow: rgba(0, 200, 184, .35);
  /* 小程序 --bg-top / --bg-bottom / --c-inner / --c-track */
  --ph-top: #132f2f;
  --ph-bottom: #0c1818;
  --ph-inner: #0f2222;
  --ph-track: #273333;
  /* 机身固定深色（像真机）。外框线跟**整站**主题走，不跟手机屏走（由模板内联 --shell-line 决定）：
     整站暗 → 纯白发光圈（手机屏不管明暗都保留，暗底上要靠它勾出机身轮廓）；
     整站亮 → 黑边。 */
  --shell-body: #0d1113;
  --shell-line: #ffffff;
  color-scheme: dark;

  position: relative; width: 392px; flex: none; height: 806px;
  border-radius: 48px; padding: 10px;
  background: var(--shell-body); border: 1px solid var(--shell-line);
  /* 不加投影：深色大投影在暗色界面里像糊了一圈黑边，用户要求去掉 */
  transition: border-color .25s;
}
/* 手机屏的明亮模式（屏内胶囊打开时）：同一套变量换浅色值，作用域只到手机壳内部 */
.phone-shell.ph-light {
  --bg: #eef4f3;
  --bg2: #dfecea;
  --card: #ffffff;
  --line: #d3e0de;
  --text: #1c2b2a;
  --sub: #5f7a76;
  --accent: #00a08f;
  --accent-dark: #00897b;
  --red: #e5484d;
  --orange: #e8890c;
  --warn: #b45309;
  --ipt-bg: #f3f8f7;
  --bar-bg: rgba(255, 255, 255, .72);
  --bar-glow: rgba(0, 160, 143, .22);
  --ph-top: #ffffff;
  --ph-bottom: #e7eeec;
  --ph-inner: #fbfdfc;
  --ph-track: #d7e0de;
  /* 注意：这里不设 --shell-line —— 外框线只看整站主题（模板内联），手机屏切亮时
     整站若还是暗的，白圈要保留，不能被这套亮色变量改成黑边 */
  color-scheme: light;
}
.ph-notch {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 112px; height: 26px; background: var(--shell-body); border-radius: 0 0 18px 18px; z-index: 3;
}
.ph-screen {
  width: 100%; height: 100%; border-radius: 40px; overflow: hidden;
  display: flex; flex-direction: column; color: var(--text);
  /* 和小程序首页同一条渐变：上亮下暗（--bg-top → --bg-bottom 到 80%），
     以前这里用的是整站底色 var(--bg) 单色，看着"上面闷黑、下面发灰" */
  background: linear-gradient(180deg, var(--ph-top) 0%, var(--ph-bottom) 80%);
}
.ph-status {
  height: 34px; flex: none; display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 24px 5px; font-size: 11px; color: var(--text); opacity: .85;
}
/* 左上角时钟：等宽数字，分钟跳动时宽度不抖 */
.ph-clock { font-variant-numeric: tabular-nums; letter-spacing: .3px; line-height: 1; white-space: nowrap; }
/* 右侧信号 / Wi-Fi / 电池：整组等距，图标统一 11px 高，底边和时钟对齐 */
.ph-sig { display: flex; align-items: center; gap: 5px; }
.ph-ico { display: block; flex: none; }
.ph-bat { margin-left: 1px; }
.ph-bar {
  height: 40px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; font-size: 14px; font-weight: 500; border-bottom: 1px solid var(--line);
}
.ph-bar b { flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-back { color: var(--sub); font-size: 18px; line-height: 1; width: 26px; text-align: center; }
/* 主题胶囊：照小程序 .theme-toggle 的比例缩到手机屏尺寸（rpx→px 约 ÷2），
   背景/描边用手机屏自己那套变量，换主题时它自己也跟着变 */
.ph-theme {
  flex: none; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 400; line-height: 1.6; white-space: nowrap;
  color: var(--sub); background: var(--ph-inner); border: 1px solid var(--ph-track);
  cursor: pointer; user-select: none; transition: color .2s, border-color .2s;
}
.ph-theme:hover { color: var(--text); border-color: var(--accent); }
.ph-theme:active { transform: scale(.94); }
.ph-body { flex: 1; overflow-y: auto; padding: 12px; }
.ph-home {
  height: 22px; flex: none; position: relative;
}
.ph-home::after {
  content: ''; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  width: 118px; height: 4px; border-radius: 2px; background: var(--text); opacity: .35;
}

.ph-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
/* 屏内组件【无底框】：和小程序造物页 / 花盆首页一致，组件直接贴在屏幕底色上，
   没有卡片方框。鼠标移上去才用虚线描一下边界（只在编辑时有意义，不占视觉）。 */
.ph-cell {
  position: relative; min-height: 92px; padding: 10px; border-radius: 12px;
  border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: grab; overflow: hidden; touch-action: none;
}
.ph-cell:hover { outline: 1px dashed var(--line); outline-offset: -1px; }
.ph-cell.span2 { grid-column: 1 / -1; }
/* 被拖的那一格留在原地当占位符；真正跟着鼠标走的是下面那层 ghost */
.ph-cell.picked { outline: 2px dashed var(--accent); outline-offset: -2px; opacity: .28; z-index: 1; }
/* 当前会落进去的格子：边框亮一下，上下左右换位都有明确反馈 */
.ph-cell.ph-drop { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(0, 200, 184, .08); }
/* 组件左上角的小手柄：平时淡着，鼠标移上去才显出来；按钮/滑杆类组件靠它拖动 */
.ph-grip {
  position: absolute; top: 2px; left: 4px; z-index: 3;
  padding: 2px 4px; font-size: 14px; line-height: 1; color: var(--sub);
  opacity: 0; cursor: grab; transition: opacity .15s;
}
.ph-cell:hover .ph-grip { opacity: .65; }
.ph-grip:hover { color: var(--accent); opacity: 1 !important; }

/* 拖动浮层：整份克隆原组件，脱离网格跟指针走；主题变量在 phMakeGhost 里从手机壳复制 */
.ph-drag-ghost {
  position: fixed; z-index: 10000; pointer-events: none;
  box-sizing: border-box; min-height: 0; margin: 0;
  background: var(--card); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 200, 184, .2);
  opacity: .96; transform: scale(1.04) rotate(-1.2deg); transform-origin: 50% 50%;
  animation: ph-ghost-in .12s ease-out;
}
.ph-drag-ghost .ph-grip, .ph-drag-ghost .ph-span-tag { display: none; }
@keyframes ph-ghost-in { from { opacity: 0; transform: scale(.92); } to { opacity: .96; transform: scale(1.04) rotate(-1.2deg); } }
.ph-span-tag {
  position: absolute; right: 5px; bottom: 4px; font-size: 10px; color: var(--sub); opacity: .45;
}
.ph-empty { height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--sub); }
.ph-empty b { font-size: 13px; font-weight: 500; }
.ph-empty span { font-size: 11px; opacity: .7; }

/* 屏内组件（手机尺寸的一档：比大屏小、比画布紧凑） */
/* 表盘：尺寸对齐小程序造物页（280rpx ≈ 屏幕宽 375 时的 140px），
   环宽用百分比（内圈 83.5% = 280→234 的比例），窄屏缩壳时整只表盘等比缩小不变形 */
.pv-gauge { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pv-g-name { font-size: 15px; color: var(--text); }
.pv-ring {
  width: 140px; max-width: 100%; aspect-ratio: 1 / 1; border-radius: 50%;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.pv-ring-hole {
  /* 内圈要盖住 conic-gradient 的中心，底色跟手机屏"挖空"色一致（= 小程序 --c-inner）。
     手机屏现在是渐变，再用 var(--bg) 会在环心露出一块偏暗的圆盘 */
  width: 83.5%; height: 83.5%; border-radius: 50%; background: var(--ph-inner);
  display: flex; align-items: center; justify-content: center;
}
.pv-ring-hole b { font-size: 24px; font-weight: 700; }
/* 缺口里的档位文字（舒适 / 干旱…）+ 左右量程刻度，位置和花盆首页一致 */
.pv-g-status {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 1px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.pv-g-min, .pv-g-max { position: absolute; bottom: 0; font-size: 12px; color: var(--sub); }
.pv-g-min { left: 10px; }
.pv-g-max { right: 12px; }
.pv-value i, .pv-step b i { font-style: normal; font-size: 10px; opacity: .7; margin-left: 1px; }
.pv-value span { font-size: 11px; color: var(--sub); }
.pv-value { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pv-value b { font-size: 26px; font-weight: 700; line-height: 1.15; }
.pv-led { display: flex; align-items: center; gap: 9px; width: 100%; }
/* 人体存在手机预览：和 pv-heart 同款竖排——红外图标在上，下方名称+状态 */
.pv-presence { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.pv-presence .presence-ico { width: 48px; height: 48px; flex: none; }
.pv-presence.on .presence-ico { filter: drop-shadow(0 0 5px rgba(34, 197, 94, .5)); }
.pv-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); flex: none; }
.pv-led.on .pv-dot { background: #45d17a; box-shadow: 0 0 8px rgba(69, 209, 122, .6); }
.pv-led-t { display: flex; flex-direction: column; min-width: 0; }
.pv-led-t b { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-led-t span { font-size: 11px; color: var(--sub); }
.pv-btn {
  position: relative;
  width: 100%; height: 46px; border-radius: 10px; cursor: pointer; font-family: inherit;
  /* 亮边：和小程序造物页的按钮一致，强调色勾边 + 一层淡光晕（原来 --line 太淡，看不出是按钮） */
  border: 1.5px solid var(--accent); background: transparent; color: var(--text);
  box-shadow: 0 0 10px rgba(0, 200, 184, .18);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.pv-btn span { font-size: 13px; }
.pv-btn em { font-style: normal; font-size: 10px; color: var(--sub); }
.pv-btn.on { border-color: var(--accent); background: rgba(0, 200, 184, .12); box-shadow: 0 0 10px rgba(0, 200, 184, .35); }
.pv-btn.on span { color: var(--accent); }
/* 圆形开关（设置里「形状 = 圆形」）：手机上也得是正圆，
   不能被 .pv-btn 的 width:100% 拉成一条长方形。格子是 flex 居中的，所以直接定死直径就行 */
.pv-btn.round {
  width: 78px; height: 78px; border-radius: 50%;
  padding: 0 8px; gap: 0; flex: none;
}
.pv-btn.round span { font-size: 13px; line-height: 1.2; max-width: 100%; text-align: center; }
.pv-btn.round em { font-size: 10px; line-height: 1.2; }
.pv-sw { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
.pv-sw > span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-track { width: 44px; height: 24px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .18s; }
.pv-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .18s; }
.pv-sw.on .pv-track { background: var(--accent); }
.pv-sw.on .pv-knob { left: 23px; }
.pv-ck { width: 100%; display: flex; align-items: center; gap: 9px; cursor: pointer; }
.pv-box {
  width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line); flex: none;
  display: flex; align-items: center; justify-content: center; color: #04231f;
}
.pv-box svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.pv-ck.on .pv-box { background: var(--accent); border-color: var(--accent); }
.pv-ck.on .pv-box svg { opacity: 1; }
.pv-ck > span { font-size: 13px; }
/* 滑杆：抄花盆首页「土壤湿度」那条（标签左、数值右且用强调色，下面一条圆角细条） */
.pv-slider { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.pv-slider-h { display: flex; align-items: baseline; justify-content: space-between; font-size: 15px; color: var(--text); }
.pv-slider-h b { font-size: 15px; font-weight: 500; color: var(--accent); }
/* 细轨道 + 圆形滑块（= 小程序原生 slider，和花盆首页「浇水阈值」同一个样子）
   轨道留 8px 内缩，滑块在 0% / 100% 时才不会半截露到格子外 */
.pv-bar { position: relative; width: calc(100% - 16px); margin: 0 8px; height: 22px;
  background: transparent; cursor: pointer; touch-action: none; }
.pv-bar::before { content: ''; position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%); height: 4px; border-radius: 2px; background: var(--line); }
.pv-bar > i { position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  display: block; height: 4px; border-radius: 2px; background: var(--accent); }
.pv-bar > i::after { content: ''; position: absolute; right: 0; top: 50%;
  transform: translate(50%, -50%); width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
/* 不加 width 过渡：拖动时填充要立刻跟手，带过渡会拖尾（花盆那条是只读数据才用 .3s） */
/* 进度条（只读）：和小程序造物页、花盆「土壤湿度」同款。
   手机格子高度是自适应的，所以垂直那条给固定 110px，不能靠 flex:1 撑 */
.pv-prog { width: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.pv-prog-l {
  flex: 1 1 auto; min-width: 0; font-size: 15px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pv-prog-v { flex: none; font-size: 15px; font-weight: 500; color: var(--accent); }
.pv-prog-t {
  flex: 0 0 100%; height: 10px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.pv-prog-t > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--accent); box-shadow: 0 0 8px var(--bar-glow);
  transition: width .3s ease, height .3s ease;
}
.pv-prog.vertical { flex-wrap: nowrap; flex-direction: column; align-items: center; gap: 5px; }
.pv-prog.vertical .pv-prog-v { order: 3; }
.pv-prog.vertical .pv-prog-t {
  flex: none; order: 2; width: 12px; height: 110px; display: flex; align-items: flex-end;
}
.pv-prog.vertical .pv-prog-t > i { width: 100%; height: 0; }
.pv-step { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pv-step button {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 17px;
  border: 1.5px solid var(--accent); background: transparent; color: var(--accent);
}
.pv-step b { font-size: 16px; font-weight: 600; }
.pv-timer { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
/* 半行（两列网格）时定时器内容居中：和小程序造物页 .tm.tm-center 同口径，
   避免「预览里居中、手机上贴左」。整行保持左对齐，长说明更好读。 */
.ph-cell:not(.span2) .pv-timer { align-items: center; text-align: center; }
.pv-timer b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pv-timer span { font-size: 10px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pv-timer.off { opacity: .5; }
.ph-cell.ty-chart { min-height: 118px; align-items: stretch; justify-content: flex-start; gap: 4px; }
.pv-chart { width: 100%; display: flex; flex-direction: column; gap: 4px; height: 100%; }
.pv-chart-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pv-chart-h b { font-size: 12px; font-weight: 500; }
.pv-chart-h span { font-size: 10px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-chart-svg { width: 100%; height: 58px; }
.pv-chart-empty { font-size: 11px; color: var(--sub); opacity: .7; padding: 14px 0; text-align: center; }
.pv-text { font-size: 12px; color: var(--text); text-align: center; line-height: 1.6; word-break: break-word; }

/* 右侧：发布 */
.ph-side { width: 208px; flex: none; display: flex; flex-direction: column; gap: 10px; }
.ph-side-h { font-size: 13px; font-weight: 500; }
.ph-side-state {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.ph-side-state b { font-size: 13px; font-weight: 500; color: var(--sub); }
.ph-side-state em { font-style: normal; font-size: 11px; color: var(--sub); opacity: .8; line-height: 1.6; }
.ph-side-state.on { border-color: var(--accent); background: rgba(0, 200, 184, .1); }
.ph-side-state.on b { color: var(--accent); }
.ph-side-tip { font-size: 11px; color: var(--sub); opacity: .8; line-height: 1.75; }

@media (max-width: 1100px) {
  .ph-wrap { justify-content: flex-start; }
  .phone-shell { width: 340px; height: 700px; }
  .ph-body { padding: 10px; }
}

/* 侧栏项目卡片上的「已发布」小标：一眼看出这个项目手机端能不能看到 */
.pub-tag {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; line-height: 1.5; color: #04231f; background: var(--accent);
  vertical-align: middle;
}

/* ==================== 能量值 ====================
 * 三处：顶栏胶囊（随时能看）、造物右栏能量卡（加组件的地方）、弹层（余额/套餐/流水）。
 * 颜色全走主题变量：暗色下 --ipt-bg / --line 都是深底浅线，明亮模式自动反过来。
 */

/* 顶栏胶囊：⚡ 1000 能量 */
.energy-chip {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 5px 10px 5px 9px; border-radius: 999px; cursor: pointer;
  background: rgba(0, 200, 184, .12); border: 1px solid rgba(0, 200, 184, .35);
  color: var(--text); font-family: inherit; font-size: 12px; line-height: 1.4;
  transition: .15s;
}
.energy-chip:hover { border-color: var(--accent); background: rgba(0, 200, 184, .18); }
.energy-chip b { font-size: 14px; color: var(--accent); font-variant-numeric: tabular-nums; }
.energy-chip .en-bolt { font-size: 12px; line-height: 1; }
.energy-chip .en-unit { font-size: 11px; color: var(--sub); }
/* 余额很少（买不起一个最便宜的组件之外的东西）时变红，提醒先去充值 */
.energy-chip.poor { border-color: rgba(255, 90, 90, .45); background: rgba(255, 90, 90, .1); }
.energy-chip.poor b { color: var(--red); }

/* 造物右栏：贴在组件库上方（右栏本身是带边框的卡片，这里只做分隔，不再套一层框） */
.en-card {
  padding: 10px 12px 11px; display: flex; flex-direction: column; gap: 7px;
  border-bottom: 1px solid var(--line);
}
.en-card-h { display: flex; align-items: baseline; justify-content: space-between; }
.en-card-t { font-size: 12px; color: var(--sub); }
.en-card-v { font-size: 19px; font-weight: 700; color: var(--accent); line-height: 1.1; font-variant-numeric: tabular-nums; }
.en-card-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; color: var(--sub); }
.en-recharge { color: var(--accent); cursor: pointer; flex: none; }
.en-recharge:hover { text-decoration: underline; }
.en-card.poor .en-card-v { color: var(--red); }
.en-card.poor .en-bar > i { background: var(--red); }

/* 进度条：余额 / 新号赠送额（1000），充多了就是满格 */
.en-bar { height: 6px; border-radius: 999px; background: rgba(127, 127, 127, .2); overflow: hidden; }
.en-bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width .35s;
}
.en-bar.big { height: 8px; }

/* 组件库单价：右上角小标，余额不够时整格变淡 + 标红 */
.pal { position: relative; }
.pal-cost {
  position: absolute; top: 4px; right: 5px; font-style: normal;
  font-size: 10px; line-height: 1; padding: 2px 4px; border-radius: 6px;
  background: rgba(0, 200, 184, .13); color: var(--accent);
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.pal.poor { opacity: .45; }
.pal.poor .pal-cost { background: rgba(255, 90, 90, .14); color: var(--red); }

/* 发布侧栏里的费用说明 */
.ph-side-tip.en-fee { color: var(--accent); opacity: 1; }
.ph-side-tip.en-fee b { font-variant-numeric: tabular-nums; }
.ph-side-tip.en-fee.paid { color: var(--sub); opacity: .8; }

/* ---------- 能量弹层 ---------- */
/* 弹层本身也限高：窗口矮的时候让流水区自己缩，别把「关闭」顶出屏幕 */
.en-modal { width: 400px; max-height: 86vh; display: flex; flex-direction: column; }
.en-bal { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 9px; }
.en-bal-n { font-size: 30px; font-weight: 700; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.en-bal-u { font-size: 12px; color: var(--sub); }
.en-hint { margin: 10px 0 0; font-size: 12px; line-height: 1.7; color: var(--sub); }
.en-hint.warn { color: var(--orange); }
.en-tip {
  margin: 9px 0 0; font-size: 12px; line-height: 1.6;
  color: var(--text); background: rgba(0, 200, 184, .1);
  border: 1px solid rgba(0, 200, 184, .28); border-radius: 8px; padding: 8px 10px;
}
.en-pkgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.en-pkg {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 4px 8px;
  text-align: center; cursor: pointer; background: var(--ipt-bg); transition: .15s;
}
.en-pkg:hover { border-color: var(--accent); background: var(--hover-bg); transform: translateY(-1px); }
.en-pkg b { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.en-pkg span { font-size: 11px; color: var(--sub); }
.en-pkg em { display: block; margin-top: 3px; font-style: normal; font-size: 12px; color: var(--accent); }
.en-pkg.busy { opacity: .55; pointer-events: none; }
.en-pkg.empty { grid-column: 1 / -1; cursor: default; color: var(--sub); font-size: 12px; padding: 14px 0; }
.en-demo { margin: 8px 0 0; font-size: 11px; color: var(--sub); opacity: .75; }

/* 流水：一行一条，最多 30 条，超出滚动 */
.en-logs {
  margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line);
  /* 高度有上限：装得下就全显示，装不下就滚动 */
  flex: 1 1 auto; min-height: 92px; max-height: 178px;
  overflow: auto; display: flex; flex-direction: column; gap: 6px;
  /* 滚动容器底部必然会出现半行：用渐隐收一下，读起来像"下面还有"，而不是被切掉 */
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(180deg, #000 calc(100% - 14px), transparent 100%);
}
.en-log { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.el-t { width: 62px; flex: none; color: var(--sub); opacity: .8; font-variant-numeric: tabular-nums; }
.el-d { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.el-v { flex: none; color: var(--sub); font-variant-numeric: tabular-nums; }
.el-v.plus { color: var(--accent); }
.en-log.empty { justify-content: center; color: var(--sub); opacity: .8; padding: 10px 0; }

/* ============================================================
 * 在线支付：小程序码（个体户开不了 Native，给的是"扫码进小程序"）
 * ============================================================ */
.en-pay { margin-top: 12px; text-align: center; }

/* 二维码必须白底：小程序码是深色点阵，压在暗色卡片上会扫不出来 */
.en-pay-qr {
  width: 188px; height: 188px; margin: 0 auto; padding: 5px;
  background: #fff; border-radius: 10px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
/* Native 付款码是前端用 lib/qrcode.js 画的 SVG，不是 <img>；两种都兜住 */
.en-pay-qr img,
.en-pay-qr svg {
  width: 100% !important; height: 100% !important;
  display: block; border-radius: 6px;
}
.en-pay-ph { font-size: 11px; color: #888; line-height: 1.6; }

.en-pay-line {
  margin: 9px 0 0; display: flex; align-items: baseline; justify-content: center;
  gap: 6px; font-size: 12px; color: var(--sub);
}
.en-pay-line b { font-size: 18px; color: var(--accent); font-variant-numeric: tabular-nums; }
.en-pay-clock { color: var(--text); font-variant-numeric: tabular-nums; }

.en-pay-note { margin: 6px 0 0; font-size: 11px; line-height: 1.6; color: var(--sub); }

.en-pay-cancel {
  margin-top: 9px; padding: 4px 14px; font-size: 12px; cursor: pointer;
  color: var(--sub); background: transparent; border: 1px solid var(--line); border-radius: 8px;
  transition: .15s;
}
.en-pay-cancel:hover { color: var(--text); border-color: var(--accent); }

/* ============================================================
 * 报警提醒组件（alarm）：画布卡 / 运行视图卡 / 手机预览卡 / 报警弹窗
 * 卡片配色跟随用户设置的弹窗颜色（--al），报警中边框闪烁
 * ============================================================ */
.comp-alarm {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  justify-content: center; gap: 2px; padding: 0 4px; overflow: hidden;
}
.al-cond {
  font-size: 16px; color: var(--text); font-weight: 700; line-height: 1.25;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.al-cond i { font-style: normal; font-weight: 400; font-size: 12px; color: var(--sub); }
.al-state {
  margin-left: auto; font-style: normal; font-size: 11px; color: var(--sub); flex: none;
}
.al-state.dim { opacity: .7; }
/* 报警中卡片右上角的「清除」：停下来（停闪 + 停声），颜色跟组件里配的报警色走 */
.al-clear {
  margin-left: auto; flex: none; padding: 3px 10px; border-radius: 999px;
  font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1.3;
  color: #fff; cursor: pointer; border: 0; letter-spacing: .5px;
  transition: filter .12s, transform .12s;
}
.al-clear:hover { filter: brightness(1.12); }
.al-clear:active { transform: scale(.96); }

/* 运行视图：报警中的卡片 —— 边框 + 外圈光晕跟着弹窗色闪（和弹窗同一个节奏）。
   和小程序一套写法：常驻 2px 透明边框，闪烁只换 border-color（尺寸不跳）。
   以前只给 border-color 没给 border-style，等于没画框，全靠 inset 阴影顶着；
   padding 各减 2px 抵掉边框，内容可用空间和原来一模一样。 */
.run-cell .comp-alarm {
  border-radius: 14px; padding: 10px 12px; gap: 3px;
  border: 2px solid transparent;
}
.run-cell .comp-alarm.firing { animation: alBlink 0.9s steps(1) infinite; }
.run-cell .comp-alarm.off { opacity: .55; }
.comp-alarm.off { opacity: .5; }
.pv-alarm.off { opacity: .5; }
/* 报警监控字段被清空（如删掉被监控的组件）时的提示，双主题走 --warn */
.al-empty {
  margin-top: 2px; font-size: 11px; line-height: 1.4;
  color: var(--warn); font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
@keyframes alBlink {
  0%, 49%   { border-color: var(--al); box-shadow: 0 0 18px -4px var(--al); }
  50%, 100% { border-color: transparent; box-shadow: 0 0 0 transparent; }
}

/* 手机预览里的报警卡（配置摘要） */
.pv-alarm {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  padding: 8px 4px;
}
.pv-alarm b {
  display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pv-al-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--al); flex: none;
  box-shadow: 0 0 6px var(--al);
}
.pv-alarm span { font-size: 11px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-alarm em { font-style: normal; font-size: 10px; color: var(--sub); opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 报警弹窗：全屏遮罩 + 闪烁卡片 ---------- */
.alarm-mask {
  position: fixed; inset: 0; z-index: 260;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  animation: alFade .18s ease-out;
  backdrop-filter: blur(2px);
}
@keyframes alFade { from { opacity: 0; } to { opacity: 1; } }
.alarm-pop {
  --al: #ff4d6d;
  width: 380px; max-width: calc(100vw - 48px);
  padding: 30px 26px 22px; text-align: center;
  background: var(--card); color: var(--text);
  border-radius: 18px; border: 3px solid var(--al);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  animation: alPop .35s cubic-bezier(.2, 1.4, .4, 1);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .55);
}
@keyframes alPop { from { transform: scale(.82); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* 闪烁：边框和背景在"强调色 / 常规"之间半秒一切换，远看像警灯 */
.alarm-pop.alarm-flash { animation: alPop .35s cubic-bezier(.2, 1.4, .4, 1); }
.alarm-mask .alarm-pop { animation: alPop .35s cubic-bezier(.2, 1.4, .4, 1), alFlash .8s steps(1) infinite; }
@keyframes alFlash {
  0%, 49%   { box-shadow: 0 0 0 3px var(--al), 0 0 60px -8px var(--al); }
  50%, 100% { box-shadow: 0 0 0 3px transparent, 0 18px 50px -12px rgba(0, 0, 0, .55); }
}
.al-pop-bell {
  width: 52px; height: 52px; fill: none; stroke: var(--al); stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  animation: alBell .8s ease-in-out infinite;
  transform-origin: 50% 8%;
}
@keyframes alBell {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  25% { transform: rotate(-12deg); }
  40% { transform: rotate(9deg); }
  55% { transform: rotate(-7deg); }
  70% { transform: rotate(4deg); }
  85% { transform: rotate(-2deg); }
}
.al-pop-title { font-size: 15px; letter-spacing: 1px; }
.al-pop-text {
  margin: 2px 0 0; font-size: 17px; line-height: 1.5; font-weight: 600;
  word-break: break-word; max-height: 108px; overflow: auto;
}
.al-pop-cond {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  font-size: 12px; color: var(--sub); margin-top: 2px;
}
.al-pop-btn {
  margin-top: 14px; padding: 10px 38px; font-size: 15px; cursor: pointer;
  color: #fff; background: var(--al); border: 0; border-radius: 12px;
  font-weight: 600; letter-spacing: 2px;
  transition: transform .12s, filter .12s;
}
.al-pop-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.al-pop-btn:active { transform: translateY(0); }
.al-pop-auto, .al-pop-sound {
  margin: 4px 0 0; font-size: 11px; color: var(--sub);
  font-variant-numeric: tabular-nums;
}

/* 设置面板里的「试听」按钮 */
.cf-listen { flex: none; margin-left: 6px; }

/* ============================================================
 * 报警记录（alarmlog）：时间线卡片
 * 不是"卡片方框"（用户的老要求）：只有文字和行间细分隔线，
 * 报警/恢复正常用左侧色条 + 小标签区分，扫一眼就知道刚才发生过什么
 * ============================================================ */
.comp-alarmlog {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  justify-content: center; gap: 2px; padding: 0 4px; overflow: hidden;
}
.alr-head { flex: none; }
/* 标题跟历史数据卡片的标题（.rc-head b）同一套字号/字重：14px / 600。
   .tm-head 默认是 13px/400，所以这里必须显式覆盖，不然两个卡片并排像两套系统 */
.alr-head > span {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.25;
}
.alr-stat {
  margin-left: auto; font-style: normal; font-size: 11px; color: var(--sub);
  flex: none; white-space: nowrap;
}
/* 记录卡头上的「清空」：清的是历史记录（不是按掉正在响的报警，那是卡片上的「清除」）。
   平时不起眼（描边小胶囊），鼠标移上去才变红提醒"这个是删东西的" */
.alr-clr {
  flex: none; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  font-family: inherit; font-size: 10px; line-height: 1.5;
  color: var(--sub); background: transparent; border: 1px solid var(--line);
  cursor: pointer; transition: color .12s, border-color .12s, transform .1s;
}
.alr-clr:hover { color: #ff6b81; border-color: #ff6b81; }
.alr-clr:active { transform: scale(.94); }

/* 运行视图：一整块列表，行多时在卡片内部滚动（卡片高度固定，画布不跟着长） */
.run-cell .comp-alarmlog { padding: 0; gap: 6px; }
.alr-list {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  /* 滚动条细一点，别在大屏上抢眼 */
  scrollbar-width: thin;
}
.alr-list::-webkit-scrollbar { width: 6px; }
.alr-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.alr-row {
  flex: none; padding: 4px 0 4px 10px; position: relative;
  border-bottom: 1px dashed var(--line);
}
.alr-row:last-child { border-bottom: 0; }
/* 左侧色条：报警=红、恢复=青绿（跟着主题 accent，不用写死颜色） */
.alr-row::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 2px; background: var(--red);
}
.alr-row.clear::before { background: var(--accent); }
.alr-l1 {
  display: flex; align-items: baseline; gap: 7px; min-width: 0;
  font-size: 13px; line-height: 1.35;
}
.alr-t {
  font-style: normal; color: var(--sub); flex: none;
  font-variant-numeric: tabular-nums; font-size: 12px;
}
.alr-tag {
  flex: none; font-style: normal; font-size: 11px; line-height: 1; padding: 2px 6px;
  border-radius: 4px; color: #fff; background: var(--red);
}
.alr-row.clear .alr-tag { background: var(--accent); }
.alr-cond { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alr-v { color: var(--sub); flex: none; font-variant-numeric: tabular-nums; }
.alr-l2 {
  display: flex; align-items: baseline; gap: 6px; min-width: 0;
  margin-top: 3px; font-size: 12px; color: var(--sub); line-height: 1.36;
}
/* 第二行开头是"哪条报警规则"（报警组件的名字）：加粗一点、用正文色，
   后面跟一句发生了什么。名字过长先截名字（组件的条件在上面的 .alr-cond 里已经写全了） */
.alr-name {
  flex: 0 1 auto; max-width: 46%; min-width: 0; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.alr-name::after { content: '·'; margin-left: 5px; font-weight: 400; color: var(--sub); }
.alr-txt { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alr-empty { font-size: 13px; color: var(--sub); line-height: 1.6; padding: 4px 2px; }

/* ---------- 报警记录 · 整行铺满（full）：和历史数据一样撑满画布的一张宽表格 ----------
   五列 grid：时间(定宽) 类型(定宽) 报警源 / 触发条件 / 报警内容(弹性分剩余宽度)。
   列头行 + 表体行同一套模板列，改列宽只改一个地方。 */
.comp-alarmlog.full { justify-content: flex-start; padding: 6px 10px; }
.alw {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  margin-top: 4px; border-top: 1px solid var(--line);
}
.alw-cols, .alw-row {
  display: grid; align-items: center; column-gap: 12px;
  /* 前四列定宽 + 最后一列吃掉剩余宽度。
     ⚠️ 别把中间列写成 fr / minmax(…,1fr)：表头在滚动容器外面、表体在 .alw-list 里面，
     有滚动条时行宽比表头窄几像素，fr 会重新分配，"触发条件/报警内容"的表头就比下面偏右。
     定宽后每个列头的左边缘都是算得出来的死数，滚动条只影响最后一列的宽度，不影响对齐。 */
  grid-template-columns: 92px 42px 130px 200px 1fr;
}
.alw-cols {
  /* 左内边距必须和 .alw-row 一样（12px 给左侧色条留槽），否则整个表头往左偏 10px */
  flex: none; padding: 7px 2px 7px 12px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--sub); letter-spacing: .5px;
  /* 列头用的是 <em>/<i>，浏览器默认给斜体 —— 这里统一掰正（用户明确要求不要斜体），
     改用"加粗 + 正体"的标题观感 */
  font-style: normal;
}
.alw-cols em, .alw-cols i { font-style: normal; }
.alw-cols i { text-align: center; }
.alw-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.alw-row {
  padding: 6px 2px 6px 12px; border-bottom: 1px dashed var(--line);
  font-size: 12px; line-height: 1.35;
}
.alw-row:last-child { border-bottom: 0; }
/* 左侧色条和卡片样式同一个语言：报警红、恢复用主题色（不刺眼）。
   色条画在 12px 的左内边距里，不占列宽 —— 表头/表体的列起点才对得上 */
.alw-row { position: relative; }
.alw-row::before {
  content: ''; position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 14px; border-radius: 2px; background: #ff4d6d;
}
.alw-row.clear::before { background: var(--accent); }
.alw-t { font-style: normal; color: var(--sub); font-variant-numeric: tabular-nums; white-space: nowrap; }
.alw-tag {
  font-style: normal; text-align: center; font-size: 11px; line-height: 1;
  padding: 3px 0; border-radius: 4px; color: #fff; background: #ff4d6d;
}
.alw-row.clear .alw-tag { background: var(--accent); }
.alw-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alw-cond { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alw-v { font-style: normal; color: var(--sub); }
.alw-txt { color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alw-row.fire .alw-txt { color: var(--text); }

/* 手机预览里的记录卡 */
.pv-alarmlog { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 4px; }
.pv-alarmlog b {
  display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pv-alarmlog span { font-size: 11px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-alarmlog em { font-style: normal; font-size: 10px; color: var(--sub); opacity: .75; }
.pv-al-dot.log-dot { background: #3b82f6; box-shadow: 0 0 6px #3b82f6; }

/* ================= 下载中心 ================= */
/* 顶栏入口：当前正在看下载中心时高亮，风格跟其他 ghost 按钮一致 */
.top-nav-btn.active { color: var(--accent); border-color: var(--accent); background: var(--active-bg); }
.tools-sub { font-size: 12px; color: var(--sub); }
.tools-busy { padding: 40px; text-align: center; color: var(--sub); }
.tools-list { display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.tools-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card);
}
.tools-info { min-width: 0; flex: 1; }
.tools-name { font-size: 15px; font-weight: 600; color: var(--text); }
.tools-meta { margin-top: 5px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--sub); }
.tools-cat { padding: 1px 8px; border-radius: 10px; background: var(--active-bg); color: var(--accent); }
.tools-foot { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--sub); opacity: .85; }
.tools-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.tools-btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
/* 查看说明弹层：普通态保留标题和细边框；全屏态去掉所有弹窗装饰，文档直接铺满整屏 */
.tool-doc-card {
  width: 720px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
}
.tool-doc-card.max,
.tool-doc-card:fullscreen {
  width: 100vw; max-width: none; height: 100vh; max-height: none;
  margin: 0; padding: 0; border: 0; border-radius: 0; overflow: hidden;
  background: transparent; box-shadow: none;
}
.tool-doc-card.max .tool-doc-head,
.tool-doc-card.max .tool-doc-loading,
.tool-doc-card.max .dlg-btns { display: none; }
.tool-doc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tool-doc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-doc-max {
  flex: none; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line);
  border-radius: 6px; background: transparent; color: var(--sub);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.tool-doc-max:hover { color: var(--accent); border-color: var(--accent); background: var(--active-bg); }
.tool-doc-max svg { width: 16px; height: 16px; fill: currentColor; }
/* 全屏后只留一个轻量还原按钮（不形成边框），Esc 同样可退出 */
.tool-doc-restore {
  position: fixed; top: 12px; right: 12px; z-index: 3;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 7px;
  background: rgba(0, 0, 0, .42); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.tool-doc-restore:hover { background: rgba(0, 0, 0, .65); border-color: rgba(255, 255, 255, .7); }
.tool-doc-restore svg { width: 17px; height: 17px; fill: currentColor; }
.tool-doc-loading { flex: none; font-size: 13px; color: var(--sub); padding: 8px 0; }
.tool-doc-frame {
  display: block; flex: none; width: 100%; height: 60vh;
  max-height: calc(100vh - 190px); min-height: 260px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.tool-doc-card.max .tool-doc-frame,
.tool-doc-card:fullscreen .tool-doc-frame {
  flex: 1 1 auto; width: 100vw; height: 100vh; min-height: 0; max-height: none;
  border: 0; border-radius: 0;
}
