:root {
  --bg: #0a0c11;
  --panel: #11141c;
  --panel-2: #161a24;
  --panel-3: #1c2130;
  --stroke: #232936;
  --stroke-2: #2d3546;
  --text: #edf1f8;
  --muted: #8b95a7;
  --muted-2: #677184;
  --brand: #4c8dff;
  --brand-2: #2f6be0;
  --green: #33d17a;
  --red: #ff5d5d;
  --amber: #ffb020;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(76, 141, 255, .12), transparent 60%),
    radial-gradient(700px 460px at 96% 0%, rgba(51, 209, 122, .07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(10, 12, 17, .82);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 34px; height: 34px; }
.logo svg { width: 100%; height: 100%; }
.brand-text h1 { margin: 0; font-size: 18px; letter-spacing: .3px; }
.brand-text p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

/* 侧栏底部的「连接手机」入口（原顶栏 chip） */
.side-connect { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 8px; }
.server-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 46px;
  padding: 0 10px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke-2);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: .18s;
}
.server-chip:hover { border-color: var(--brand); color: var(--text); }
.server-chip .dot {
  flex: none;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(51, 209, 122, .16);
}
.server-chip .chip-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.server-chip .chip-title { font-size: 12.5px; font-weight: 600; line-height: 1.2; color: var(--text); }
.server-chip #serverText {
  display: block; max-width: 100%;
  font-size: 10.5px; line-height: 1.2; color: var(--muted-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.server-settings {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 46px; padding: 0;
  border: 1px solid var(--stroke-2); border-radius: 10px;
  background: var(--panel-2); color: var(--muted); cursor: pointer; transition: .18s;
}
.server-settings svg { width: 15px; height: 15px; }
.server-settings:hover { border-color: var(--brand); color: var(--text); }

/* ---------- 顶栏用户区 ---------- */
.user-chip { display: flex; align-items: center; gap: 10px; margin-left: 4px; }
.user-chip .user-home {
  font-size: 12px; color: var(--muted); text-decoration: none;
  padding: 6px 10px; border: 1px solid var(--stroke); border-radius: 8px; transition: .15s;
}
.user-chip .user-home:hover { color: var(--text); border-color: var(--brand); }
.user-chip .user-name {
  font-size: 13px; color: var(--text); max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip .user-logout {
  font-size: 12px; color: var(--muted); background: transparent;
  border: 1px solid var(--stroke); border-radius: 8px; padding: 6px 10px; cursor: pointer; transition: .15s;
}
.user-chip .user-logout:hover { color: var(--red); border-color: var(--red); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--panel-3);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: .16s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(180deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 20px rgba(76, 141, 255, .28); }
.btn.ghost { background: transparent; border-color: var(--stroke-2); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--brand); }
.btn.danger { background: rgba(255, 93, 93, .14); color: var(--red); border-color: rgba(255, 93, 93, .35); }
.btn.block { width: 100%; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.ic { width: 15px; height: 15px; }

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100vh - 66px);
}

.sidebar {
  border-right: 1px solid var(--stroke);
  background: rgba(17, 20, 28, .7);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .6px;
}

.pill {
  min-width: 22px;
  height: 19px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flow-list { flex: 1; overflow-y: auto; padding: 4px 10px 6px; }

/* TAB 内列表下方的专属操作区（流程设计→新建流程；连接的手机→连接手机） */
.side-pane-action { flex: none; padding: 6px 12px 12px; display: grid; gap: 8px; }
.side-pane-action .btn { width: 100%; }
/* 「手机录制 / 素材库」是流程设计页内的内容切换，选中态不等同于顶部 TAB */
.side-pane-action .btn.pane-active {
  color: var(--text);
  background: rgba(76, 141, 255, .16);
  border-color: rgba(76, 141, 255, .55);
  font-weight: 600;
}
.side-pane-action .btn.pane-active:hover { border-color: var(--brand); }

/* 流程部署状态徽标 */
.deploy-badge {
  display: inline-block; font-size: 10.5px; line-height: 1.6;
  color: var(--muted-2); background: var(--panel-3);
  border: 1px solid var(--stroke); border-radius: 6px; padding: 0 6px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.deploy-badge.on {
  color: #9dc0ff; background: rgba(76, 141, 255, .12);
  border-color: rgba(76, 141, 255, .25);
}

/* 侧栏分栏：流程设计 / 连接的手机（hidden 属性必须强制生效） */
[hidden] { display: none !important; }
.side-tabs {
  display: flex; gap: 4px; padding: 12px 10px 8px;
  border-bottom: 1px solid var(--stroke);
}
.side-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 32px; padding: 0 6px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 11.5px; cursor: pointer;
  transition: .15s; white-space: nowrap;
}
.side-tab:hover { color: var(--text); background: var(--panel-2); }
.side-tab.active {
  color: var(--text); background: var(--panel-2);
  border-color: var(--stroke-2); font-weight: 600;
}
.side-tab .pill { height: 17px; min-width: 18px; font-size: 10px; padding: 0 5px; }

/* 设备面板 */
.device-panel { flex: 1; overflow-y: auto; padding: 10px 10px 6px; display: grid; gap: 10px; align-content: start; }
.device-card {
  border: 1px solid var(--stroke-2); border-radius: 12px;
  background: var(--panel-2); padding: 12px;
}
.device-top { display: flex; align-items: center; gap: 8px; }
.device-name { font-size: 13px; font-weight: 600; color: var(--text); }
.device-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: none; }
.device-dot.on { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .16); }
.device-state { margin-left: auto; font-size: 10.5px; color: var(--muted-2); }
.device-spec { margin-top: 6px; font-size: 11.5px; line-height: 1.7; color: var(--muted); }
.device-spec b { color: var(--text); font-weight: 600; }
.device-flows { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.flow-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 3px 6px 3px 8px; border-radius: 7px; font-size: 11px;
  background: rgba(76, 141, 255, .12); color: #9dc0ff; border: 1px solid rgba(76, 141, 255, .25);
}
.flow-chip button {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  font-size: 12px; line-height: 1; padding: 0 2px; opacity: .7;
}
.flow-chip button:hover { opacity: 1; color: #fff; }
.device-actions { margin-top: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.device-actions select {
  flex: 1 1 110px; min-width: 0; height: 28px; font-size: 11.5px;
  background: var(--panel-3); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 8px; padding: 0 6px;
}
.device-actions .btn.sm { height: 28px; padding: 0 10px; font-size: 11.5px; }
.device-empty-hint { padding: 16px 8px; font-size: 11.5px; line-height: 1.9; color: var(--muted-2); text-align: center; }

/* 左侧手机列表：只留基本信息（名字 + 在线状态），详情都在右侧主视图 */
.device-item-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 10px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 12.5px;
  text-align: left; cursor: pointer; transition: .15s;
}
.device-item-btn:hover { background: var(--panel-2); color: var(--text); }
.device-item-btn.active {
  background: var(--panel-2); border-color: var(--stroke-2);
  color: var(--text); font-weight: 600;
}
.device-item-btn .device-item-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.device-item-btn .device-state { flex: none; margin-left: 0; }

/* ---------- 右侧「连接的手机」主视图 ---------- */
.work-area { display: grid; min-width: 0; min-height: 0; }
.work-area > section { grid-area: 1 / 1; min-width: 0; min-height: 0; }
.device-view { overflow-y: auto; padding: 22px 26px 46px; }
.dv-empty {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--muted); text-align: center;
}
.dv-empty h2 { margin: 0; font-size: 16px; color: var(--text); }
.dv-empty p { margin: 0; font-size: 12.5px; line-height: 1.9; }
.dv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dv-head .device-dot { width: 10px; height: 10px; }
.dv-head-text { min-width: 0; }
.dv-title { margin: 0; font-size: 17px; line-height: 1.3; }
.dv-sub { margin-top: 2px; font-size: 12px; color: var(--muted); }
.dv-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
/* 设备主视图子菜单：设备信息 / 实时画面 / 运行日志 */
.dv-tabs {
  display: flex; gap: 4px; margin-top: 14px; padding: 4px;
  border: 1px solid var(--stroke-2); border-radius: 11px;
  background: var(--panel); width: fit-content; max-width: 100%;
}
.dv-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 15px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 12.5px;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.dv-tab:hover { color: var(--text); background: var(--panel-2); }
.dv-tab.active {
  color: var(--text); background: var(--panel-2);
  border-color: var(--stroke-2); font-weight: 600;
}
.dv-pane { margin-top: 14px; }
.dv-pane[data-dv-pane-box="screen"] .dv-screen-card { max-width: 460px; }
.dv-pane[data-dv-pane-box="info"] .dv-card { max-width: 560px; }
.dv-card {
  border: 1px solid var(--stroke-2); border-radius: 14px;
  background: var(--panel-2); padding: 14px 16px;
}
.dv-runs-sub { font-size: 11px; color: var(--muted-2); }
.dv-block-title {
  font-size: 12px; font-weight: 600; color: var(--text);
  margin: 0 0 8px; letter-spacing: .3px;
}
.dv-card .dv-block-title + .dv-block-title { margin-top: 16px; }
.dv-meta { font-size: 11.5px; line-height: 1.8; color: var(--muted); }
.dv-meta b { color: var(--text); font-weight: 600; }
.dv-screen-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.dv-screen-title { font-size: 13px; font-weight: 600; color: var(--text); }
.dv-live-flow {
  font-size: 11.5px; color: #6ee7b7; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dv-screen-ops { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.dv-check { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.dv-check input { accent-color: var(--brand); }
.dv-phone {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 300px; overflow: hidden;
  background: #080b10; border: 1px solid var(--stroke-2); border-radius: 14px;
}
.dv-phone img { width: 100%; height: auto; display: block; }
.dv-phone-empty { padding: 30px 20px; font-size: 12px; line-height: 2; color: var(--muted-2); text-align: center; }
.dv-status { margin-top: 8px; min-height: 18px; }
.dv-screen-hint { margin: 8px 0 0; font-size: 11px; line-height: 1.7; color: var(--muted-2); }

/* 设备卡片里的「实时运行」行 */
.device-live-row {
  margin-top: 8px; display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border-radius: 9px;
  background: rgba(52, 211, 153, .08); border: 1px solid rgba(52, 211, 153, .28);
}
.device-live-row .device-live-flow {
  flex: 1; min-width: 0; font-size: 11.5px; color: #6ee7b7;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.device-live-row .btn.sm { height: 24px; padding: 0 8px; font-size: 11px; flex: none; }

/* ---------- 运行画面（「看画面」弹窗实时帧） ---------- */
.live-hint { font-size: 10.5px; color: var(--muted-2); }

/* 呼吸灯：表示画面在实时更新 */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #34d399; flex: none;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .6);
  animation: livePulse 1.8s ease-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
  70% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* 放大查看弹窗 */
.modal:has(.live-full) { width: min(460px, 100%); }
.live-full-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-size: 12px; color: var(--text);
}
.live-full-meta b { font-weight: 600; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-full-meta .live-hint { margin-left: auto; }
.live-full {
  border-radius: 14px; overflow: hidden; background: #06080c;
  border: 1px solid var(--stroke); display: flex; align-items: center; justify-content: center;
  aspect-ratio: 9 / 16; max-height: 68vh;
}
.live-full img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* APP列表（设备主视图子页） */
.apps-list { max-height: 560px; overflow-y: auto; display: grid; gap: 4px; align-content: start; }
.app-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--stroke); border-radius: 9px; background: var(--panel-2);
  cursor: pointer; transition: .15s;
}
.app-row:hover { border-color: var(--stroke-2); color: var(--text); }
.app-row.active { border-color: var(--brand); background: var(--panel-3); }
.app-row .app-label { font-size: 12.5px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-row .app-pkg { font-size: 11px; color: var(--muted-2); font-family: ui-monospace, Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-row .app-ver { margin-left: auto; font-size: 10.5px; color: var(--muted); flex: none; }
.apps-search { width: 210px; }
.apps-layout {
  display: grid; grid-template-columns: minmax(250px, 330px) minmax(260px, 1fr);
  gap: 14px; min-height: 320px; margin-top: 4px; align-items: start;
}
@media (max-width: 1080px) { .apps-layout { grid-template-columns: 1fr; } }
.apps-detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; min-height: 30px; }
.app-detail-name { font-size: 14px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-detail-tag {
  flex: none; padding: 1px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700;
  background: rgba(76, 141, 255, .13); color: var(--brand); border: 1px solid rgba(76, 141, 255, .3);
}
.app-detail-tag.sys { background: rgba(139, 149, 167, .13); color: var(--muted); border-color: var(--stroke-2); }
.apps-detail-body { display: grid; gap: 8px; }
.app-dl {
  display: grid; grid-template-columns: 96px 1fr; gap: 10px;
  padding: 8px 12px; border: 1px solid var(--stroke); border-radius: 9px; background: var(--panel-2);
}
.app-dl dt { margin: 0; font-size: 11.5px; color: var(--muted-2); }
.app-dl dd { margin: 0; font-size: 12.5px; color: var(--text); word-break: break-all; }
.app-dl dd.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.app-detail-hint { margin: 10px 0 0; font-size: 11px; color: var(--muted-2); }

.flow-item {
  position: relative;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: .15s;
  margin-bottom: 6px;
}
.flow-item:hover { background: var(--panel-2); }
.flow-item.active { background: var(--panel-2); border-color: rgba(76, 141, 255, .45); }
.flow-item .name {
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-item .meta { margin-top: 5px; font-size: 11px; color: var(--muted-2); display: flex; gap: 8px; }
.flow-item .tag { font-size: 10px; padding: 1px 6px; border-radius: 999px; }
.flow-item .tag.off { background: rgba(255, 176, 32, .14); color: var(--amber); }
.flow-item .tag.on { background: rgba(51, 209, 122, .12); color: var(--green); }

.flow-actions {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: .15s;
}
.flow-item:hover .flow-actions { opacity: 1; }
.icon-btn {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid var(--stroke-2);
  background: var(--panel-3);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--brand); }
.icon-btn svg { width: 13px; height: 13px; }
.icon-btn.danger:hover { color: var(--red); border-color: rgba(255, 93, 93, .5); }

/* ---------- 编辑器 ---------- */
.editor { min-width: 0; overflow-y: auto; padding: 20px 22px 40px; }

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}
.empty-state .art {
  width: 92px; height: 92px;
  border-radius: 26px;
  border: 1px dashed var(--stroke-2);
  display: flex; align-items: center; justify-content: center;
  background: var(--panel);
}
.empty-state h2 { margin: 0; font-size: 17px; color: var(--text); }
.empty-state p { margin: 0; font-size: 13px; line-height: 1.7; }

.editor-head {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.title-row { display: flex; align-items: center; gap: 12px; }
.title-row .title-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  font-size: 17px;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text);
  padding: 0 10px;
}
.title-row .title-input:hover { border-color: var(--stroke-2); }
.title-row .title-input:focus { outline: none; border-color: var(--brand); background: var(--panel-2); }

.version-badge {
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-3);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.meta-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.meta-row .desc-input { flex: 1; min-width: 220px; }

.res-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.input, .select, .textarea {
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--stroke-2);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
  transition: .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: #37415a; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(76, 141, 255, .12); }
.input.num { width: 74px; text-align: center; }

/* 数字输入：隐藏浏览器原生上下箭头，改用 .num-wrap 自绘步进器 */
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-wrap { position: relative; display: inline-flex; align-items: stretch; }
.num-wrap .input.num { width: 86px; padding-right: 26px; }
.num-steps {
  position: absolute; top: 2px; bottom: 2px; right: 3px;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
}
.num-steps .num-step {
  flex: 0 0 auto; width: 20px; height: 14px; padding: 0;
  border: 0; border-radius: 4px; background: transparent;
  color: var(--muted); cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.num-steps .num-step:hover { color: var(--brand); background: rgba(76, 141, 255, .16); }
.num-steps .num-step:active { color: var(--text); }
.textarea { height: auto; min-height: 62px; padding: 8px 10px; resize: vertical; width: 100%; }

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--stroke);
}
.head-actions .spacer { flex: 1; }

/* ---------- 编辑区主体 ---------- */
.editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .5px;
}
.section-title .hint { font-size: 11px; color: var(--muted-2); letter-spacing: 0; }

.step-list { display: flex; flex-direction: column; gap: 10px; }

.step {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.step.selected { border-color: rgba(76, 141, 255, .55); box-shadow: 0 0 0 3px rgba(76, 141, 255, .08); }
.step.drag-over { border-color: var(--brand); border-style: dashed; }
.step.disabled { opacity: .55; }

.step-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  cursor: grab;
  user-select: none;
}
.step-head:active { cursor: grabbing; }

.grip {
  color: var(--muted-2);
  font-size: 13px;
  letter-spacing: -2px;
  width: 10px;
  flex: 0 0 auto;
}
.idx {
  width: 22px; height: 22px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.type-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: rgba(76, 141, 255, .12);
  border: 1px solid rgba(76, 141, 255, .22);
  border-radius: 7px;
  padding: 3px 8px;
  flex: 0 0 auto;
}
.type-badge.sys { background: rgba(51, 209, 122, .1); border-color: rgba(51, 209, 122, .22); }
.type-badge.flow { background: rgba(255, 176, 32, .1); border-color: rgba(255, 176, 32, .24); }
.wait-chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand, #4c8dff);
  background: rgba(76, 141, 255, .08);
  border: 1px solid rgba(76, 141, 255, .2);
  border-radius: 7px;
  padding: 3px 7px;
  flex: 0 0 auto;
}
.range-sep {
  color: var(--muted);
  padding: 0 8px;
  font-weight: 600;
}
.step-note {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-tools { display: flex; align-items: center; gap: 4px; opacity: 0; transition: .15s; }
.step:hover .step-tools, .step.selected .step-tools { opacity: 1; }

.step-chevron {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 16px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform .15s, color .15s;
}
.step.open > .step-head .step-chevron { transform: rotate(90deg); color: var(--brand); }
.step:not(.open) > .step-head:hover { background: rgba(255, 255, 255, .02); }

.step-body { padding: 2px 12px 14px 43px; display: grid; gap: 10px; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 11px; color: var(--muted); }
.field .inline { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.check input { accent-color: var(--brand); width: 14px; height: 14px; }

.switch { position: relative; display: inline-flex; width: 34px; height: 19px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: #2a3140;
  border-radius: 999px;
  transition: .18s;
  cursor: pointer;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 13px; height: 13px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: #cfd6e4;
  transition: .18s;
}
.switch input:checked + span { background: rgba(76, 141, 255, .8); }
.switch input:checked + span::after { transform: translateX(15px); background: #fff; }
.switch.sm { width: 30px; height: 17px; }
.switch.sm span::after { width: 11px; height: 11px; }
.switch.sm input:checked + span::after { transform: translateX(13px); }

.step-children {
  margin: 0 12px 12px 26px;
  padding: 10px 10px 4px;
  border-left: 2px solid rgba(76, 141, 255, .25);
  border-radius: 0 10px 10px 0;
  background: rgba(255, 255, 255, .015);
}
.step-children .step { background: var(--panel-2); }
.branch-title { font-size: 11px; color: var(--muted-2); margin: 2px 0 8px; }
.add-sub {
  width: 100%;
  height: 32px;
  border-radius: 9px;
  border: 1px dashed var(--stroke-2);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 8px;
}
.add-sub:hover { color: var(--brand); border-color: var(--brand); }

.threshold-val { font-size: 11px; color: var(--brand); min-width: 32px; text-align: right; }
input[type="range"] { width: 100%; accent-color: var(--brand); }

.asset-pick { display: flex; align-items: center; gap: 8px; }
.asset-thumb {
  width: 40px; height: 40px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--stroke-2);
  background: var(--panel-3);
  flex: 0 0 auto;
}
.asset-thumb.empty { display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--muted-2); }

.add-step-btn {
  width: 100%;
  height: 46px;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px dashed var(--stroke-2);
  background: rgba(255, 255, 255, .015);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
}
.add-step-btn:hover { color: var(--brand); border-color: var(--brand); background: rgba(76, 141, 255, .05); }

/* ---------- 画布 ---------- */
.canvas-col { position: sticky; top: 0; }
.canvas-card {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 14px;
}
.canvas-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.canvas-head span { font-size: 12px; color: var(--muted); }

.phone {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 20px;
  border: 1px solid var(--stroke-2);
  background:
    linear-gradient(rgba(76, 141, 255, .06) 1px, transparent 1px) 0 0 / 100% 8.333%,
    linear-gradient(90deg, rgba(76, 141, 255, .06) 1px, transparent 1px) 0 0 / 12.5% 100%,
    radial-gradient(120% 80% at 50% 0%, #182033, #0c0f16);
  overflow: hidden;
  cursor: crosshair;
}
.phone::after {
  content: "";
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 34px; height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
}
.marker {
  position: absolute;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid rgba(76, 141, 255, .8);
  background: rgba(76, 141, 255, .25);
  font-size: 9px;
  color: #dbe7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 6;
}
.marker.active { border-color: #fff; background: var(--brand); box-shadow: 0 0 0 4px rgba(76, 141, 255, .25); }
.marker-label {
  position: absolute;
  font-size: 9px;
  color: #9fc0ff;
  background: rgba(9, 12, 18, .8);
  border-radius: 4px;
  padding: 1px 4px;
  pointer-events: none;
  white-space: nowrap;
}
.swipe-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.canvas-hint { margin: 10px 0 0; font-size: 11px; line-height: 1.7; color: var(--muted-2); }
.canvas-coord {
  margin-top: 8px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 6px 8px;
  min-height: 30px;
}

/* ---------- 设计画布：拉取手机屏幕 ---------- */
.shot-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.shot-bar select {
  flex: 1; min-width: 0; height: 28px; padding: 0 6px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 8px;
  font-size: 11.5px; outline: none;
}
.shot-bar select:focus { border-color: var(--brand); }
.shot-bar .btn.sm { height: 28px; padding: 0 10px; font-size: 11px; flex: none; }
.shot-bar .btn[disabled] { opacity: .55; cursor: default; }
.shot-status {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 8px; min-height: 15px;
  font-size: 10.5px; line-height: 1.5; color: var(--muted-2);
}
.shot-meta { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.shot-meta .shot-dev {
  color: var(--text); font-size: 11px; font-weight: 600;
  max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shot-meta.stale { color: var(--amber); }
.shot-sync {
  border: 1px solid var(--stroke-2); background: var(--panel-2);
  color: var(--brand); border-radius: 6px;
  font-size: 10px; padding: 1px 7px; cursor: pointer; transition: .15s;
}
.shot-sync:hover { border-color: var(--brand); background: rgba(76, 141, 255, .08); }
.shot-wait { color: var(--brand); }
.shot-err { color: var(--red); }
.phone.has-shot { background: #000; cursor: crosshair; }
.phone.has-shot::after { display: none; }
.phone-shot {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: fill; display: block;
  -webkit-user-drag: none; user-select: none;
}

/* ---------- 画布缩放 ---------- */
.zoom-group { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.zoom-group > .btn.sm { height: 26px; padding: 0 9px; font-size: 11px; }
.zoom-ctrl { display: inline-flex; align-items: center; gap: 4px; }
.zoom-ctrl #zoomVal { font-size: 11px; color: var(--muted); min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.zoom-ctrl .btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.zoom-wrap { overflow: auto; }
.zoom-wrap.zoomed { max-height: 74vh; }
.zoom-wrap .phone { margin: 0 auto; flex: none; }

/* ---------- 画布点位信息 ---------- */
.point-pin {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border: 2px solid #ffd24a; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 210, 74, .25);
  pointer-events: none; z-index: 6;
}
.point-card {
  margin-top: 10px; padding: 10px 12px;
  border: 1px solid rgba(255, 210, 74, .35); border-radius: 12px;
  background: rgba(255, 210, 74, .05);
}
.point-card .pc-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.point-card .pc-close { border: 0; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; line-height: 1; padding: 2px 4px; }
.point-card .pc-close:hover { color: var(--text); }
.point-card .pc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 14px; }
.point-card .pc-item { font-size: 11px; color: var(--muted-2); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.point-card .pc-item b { color: var(--text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.point-card .pc-item i { font-style: normal; font-size: 10px; color: var(--muted-2); }
.point-card .pc-color { display: inline-flex; align-items: center; gap: 6px; }
.point-card .pc-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--stroke-2); background: var(--panel-3); vertical-align: -2px; }
.point-card .pc-near { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--muted-2); }
.point-card .pc-near-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border: 1px solid var(--stroke-2); border-radius: 999px;
  background: var(--panel-2); color: var(--text); font-size: 11px; cursor: pointer;
}
.point-card .pc-near-tag:hover { border-color: var(--brand); }
.point-card .pc-near-tag i { font-style: normal; color: var(--muted-2); font-size: 10px; }
.point-card .pc-ops { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.point-card .pc-hint { font-size: 10.5px; color: var(--muted-2); }

/* ---------- 设计画布：全屏放大 ---------- */
.canvas-stage { display: flex; flex-direction: column; min-width: 0; }
.canvas-stage > .zoom-wrap { min-width: 0; }
/* 元素面板打开后整列变高，取消 sticky 才能随编辑器滚动看全详情 */
.canvas-col:has(.canvas-card.with-tree) { position: static; }
.canvas-card.is-full {
  position: fixed; inset: 0; z-index: 120;
  display: flex; flex-direction: column;
  padding: 14px 20px 16px;
  border: 0; border-radius: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(76, 141, 255, .1), transparent 60%),
    var(--bg);
  overflow: hidden;
}
.canvas-card.is-full .canvas-head { margin-bottom: 8px; }
.canvas-card.is-full .canvas-head,
.canvas-card.is-full .shot-bar,
.canvas-card.is-full .shot-status,
.canvas-card.is-full .canvas-coord,
.canvas-card.is-full .canvas-hint,
.canvas-card.is-full .point-card { flex: none; }
.canvas-card.is-full .canvas-stage { flex: 1; min-height: 0; flex-direction: row; gap: 16px; }
.canvas-card.is-full .zoom-wrap {
  flex: 1; min-width: 0; height: 100%; max-height: none;
  display: flex; align-items: center; justify-content: center;
}
.canvas-card.is-full .phone {
  width: auto !important; max-width: none;
  height: var(--phone-full-h, 100%);
  border-radius: 14px;
}
.canvas-card.is-full .canvas-coord { margin-top: 6px; }
.canvas-card.is-full .canvas-hint { margin-top: 6px; }
.canvas-card.is-full .point-card { max-height: 170px; margin-top: 8px; overflow: auto; }

/* ---------- 界面元素构成：画布叠加框 ---------- */
.ui-tree-overlay { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.ui-node {
  position: absolute; pointer-events: auto; cursor: pointer;
  border: 1px solid rgba(139, 149, 167, .5);
  background: rgba(139, 149, 167, .05);
  border-radius: 2px;
  transition: background .12s, border-color .12s, opacity .12s;
}
.ui-node.clickable { border-color: rgba(76, 141, 255, .8); background: rgba(76, 141, 255, .08); }
.ui-node.text { border-color: rgba(51, 209, 122, .6); background: rgba(51, 209, 122, .05); }
.ui-node.selected {
  border: 2px solid #ffd24a; background: rgba(255, 210, 74, .17);
  box-shadow: 0 0 0 2px rgba(255, 210, 74, .25); z-index: 2;
}
.ui-node.dim { opacity: .12; }
.ui-node:hover { border-color: #8fb6ff; background: rgba(76, 141, 255, .24); }

/* ---------- 界面元素构成：面板 ---------- */
.ui-tree-panel {
  margin-top: 10px; flex: none;
  display: flex; flex-direction: column;
  max-height: 340px; overflow: hidden;
  border: 1px solid var(--stroke); border-radius: 12px;
  background: var(--panel-2);
}
.ui-tree-panel .ui-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid var(--stroke);
  font-size: 12px; font-weight: 600; color: var(--text);
}
.ui-tree-panel .ui-close {
  border: 0; background: transparent; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.ui-tree-panel .ui-close:hover { color: var(--text); }
.ui-tools { padding: 8px 10px 7px; border-bottom: 1px solid var(--stroke); }
.ui-tools .input { width: 100%; height: 28px; font-size: 11.5px; }
.ui-filters { display: flex; gap: 6px; margin-top: 7px; }
.ui-filters button {
  flex: 1; height: 24px; font-size: 11px; cursor: pointer;
  border: 1px solid var(--stroke-2); border-radius: 6px;
  background: var(--panel-3); color: var(--muted);
}
.ui-filters button.active { color: var(--brand); border-color: var(--brand); background: rgba(76, 141, 255, .1); }
.ui-status {
  padding: 5px 10px; min-height: 24px; font-size: 10.5px;
  color: var(--muted-2); border-bottom: 1px solid var(--stroke);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ui-status b { color: var(--text); font-weight: 600; }
.ui-wait { color: var(--brand); }
.ui-err { color: var(--amber); }
.ui-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ui-list { flex: 1; min-height: 96px; overflow: auto; padding: 4px 0; }
.ui-detail {
  flex: none; max-height: 44%; overflow: auto; padding: 8px 10px;
  border-top: 1px solid var(--stroke);
}
.ui-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 8px; font-size: 11px; color: var(--text); cursor: pointer;
  border-left: 2px solid transparent;
}
.ui-row:hover { background: rgba(76, 141, 255, .08); }
.ui-row.active { background: rgba(255, 210, 74, .1); border-left-color: #ffd24a; }
.ui-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--muted-2); }
.ui-dot.clickable { background: var(--brand); }
.ui-dot.text { background: var(--green); }
.ui-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-kind { flex: none; font-size: 10px; color: var(--muted-2); }
.ui-empty { padding: 14px 10px; font-size: 11px; color: var(--muted-2); text-align: center; }
.ui-detail-card { font-size: 11px; }
.ui-detail-title { font-weight: 600; color: var(--text); margin-bottom: 6px; }
.ui-kv { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; color: var(--muted-2); }
.ui-kv span { min-width: 48px; }
.ui-kv b { color: var(--text); font-weight: 500; word-break: break-all; }
.ui-kv i { font-style: normal; font-size: 10px; color: var(--muted-2); }
.ui-tags { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.ui-tags span { font-size: 10px; padding: 1px 6px; border: 1px solid var(--stroke-2); border-radius: 999px; color: var(--muted); }
.ui-detail-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.ui-detail-actions .btn.sm { height: 24px; padding: 0 8px; font-size: 10.5px; }
.ui-foot { padding: 5px 10px; font-size: 10px; color: var(--muted-2); border-top: 1px solid var(--stroke); }
.canvas-card.is-full .ui-tree-panel {
  width: 330px; max-width: 40%; height: 100%;
  max-height: none; margin: 0;
}
.canvas-card.is-full .ui-tree-panel .ui-detail { max-height: 46%; }

/* ---------- 截图存素材（框选） ---------- */
.snip-layer { position: absolute; inset: 0; z-index: 7; cursor: crosshair; background: rgba(9, 12, 18, .25); }
.snip-layer .snip-rect {
  position: absolute; margin: 0;
  border: 1.5px dashed #ffd24a; background: rgba(255, 210, 74, .12);
  box-shadow: 0 0 0 9999px rgba(9, 12, 18, .45);
}
.snip-layer .snip-tip {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 999px; font-size: 11px; color: #ffe9b0;
  background: rgba(9, 12, 18, .78); border: 1px solid rgba(255, 210, 74, .4);
  pointer-events: none; white-space: nowrap;
}
.snip-preview { display: flex; justify-content: center; padding: 10px; border: 1px solid var(--stroke); border-radius: 10px; background: #0b0e14; margin-bottom: 10px; }
.snip-preview img { max-width: 100%; max-height: 260px; object-fit: contain; display: block; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---------- 素材归属 ---------- */
.asset-upload-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.asset-upload-row .select { width: 200px; }
.asset-upload-row .hint { font-size: 11px; color: var(--muted-2); }
.asset-flow-chip {
  display: inline-flex; align-items: center; padding: 0 6px; margin-left: 5px;
  border-radius: 5px; font-size: 10px; font-weight: 600; vertical-align: 1px;
  background: rgba(76, 141, 255, .13); color: var(--brand); border: 1px solid rgba(76, 141, 255, .3);
}
.asset-flow-chip.gen { background: var(--panel-3); color: var(--muted); border-color: var(--stroke-2); }
.asset-flow-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 10.5px; color: var(--muted-2); }
.asset-flow-row .select { flex: 1; min-width: 0; height: 26px; font-size: 11px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, .66);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200; /* 高于画布全屏层，全屏时弹窗仍可见 */
  padding: 24px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--stroke-2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } }
.modal.wide { width: min(760px, 100%); }
.modal:has(.runs-layout) { width: min(960px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--stroke);
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 0 18px 18px; display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- 运行日志监测 ---------- */
.runs-layout { display: grid; grid-template-columns: 250px 1fr; gap: 14px; min-height: 380px; }
.runs-list { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow: auto; padding-right: 2px; }
.empty-hint { color: var(--muted); font-size: 12px; text-align: center; padding: 30px 10px; line-height: 1.9; }
.run-item {
  border: 1px solid var(--stroke); border-radius: 10px; padding: 10px 12px;
  cursor: pointer; transition: .15s; background: var(--panel-2);
}
.run-item:hover { border-color: var(--brand); }
.run-item.active { border-color: var(--brand); background: rgba(76, 141, 255, .08); }
.run-item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.run-item-top .icon-btn { width: 24px; height: 24px; opacity: 0; }
.run-item:hover .run-item-top .icon-btn { opacity: 1; }
.run-name { font-size: 13px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.run-device { font-size: 10px; color: var(--muted-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-status { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--panel-3); color: var(--muted); }
.run-status.running { color: var(--green); background: rgba(51, 209, 122, .12); animation: runPulse 1.6s infinite; }
.run-status.success { color: var(--green); background: rgba(51, 209, 122, .12); }
.run-status.error { color: var(--red); background: rgba(255, 93, 93, .12); }
@keyframes runPulse { 50% { opacity: .45; } }
.runs-detail { display: flex; flex-direction: column; min-width: 0; }
.runs-detail-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px solid var(--stroke); margin-bottom: 10px;
}
.run-detail-name { font-size: 14px; font-weight: 600; }
.run-detail-meta { font-size: 11px; color: var(--muted); }
.runs-log {
  flex: 1; margin: 0; padding: 12px; min-height: 320px; max-height: 400px; overflow: auto;
  background: #0B0D11; border: 1px solid var(--stroke); border-radius: 10px;
  font-family: Consolas, monospace; font-size: 12px; line-height: 1.8; color: #B8C4D8;
  white-space: pre-wrap; word-break: break-all;
}
@media (max-width: 720px) {
  .runs-layout { grid-template-columns: 1fr; }
  .runs-list { max-height: 200px; }
}

/* ---------- 手机录制 ---------- */
.record-view { overflow-y: auto; padding: 22px 26px 46px; }
.record-view .record-addr { margin-bottom: 14px; }
.record-view .dv-head { margin-bottom: 6px; }
.modal:has(.record-layout) { width: min(1080px, 100%); }
.record-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; min-height: 440px; }
.record-sessions { display: flex; flex-direction: column; gap: 8px; max-height: 500px; overflow: auto; }
.record-help { padding: 10px; border: 1px dashed var(--stroke-2); border-radius: 10px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.record-detail { display: grid; grid-template-columns: minmax(210px, .85fr) minmax(260px, 1.15fr); gap: 12px; min-width: 0; }
.record-detail-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; min-height: 30px; }
.record-stale-hint { flex-basis: 100%; color: var(--red); font-size: 11.5px; line-height: 1.7; }
.record-stale-hint .link-btn { margin-left: 6px; font-size: 11.5px; }
.record-device-name { font-size: 14px; font-weight: 600; }
.record-detail-meta { color: var(--muted); font-size: 11px; }
.record-screen {
  position: relative; height: 400px; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: #080b10; border: 1px solid var(--stroke); border-radius: 12px;
}
.record-screen img { display: none; width: 100%; height: 100%; object-fit: contain; }
.record-placeholder { padding: 22px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.9; }
.record-steps-panel { min-width: 0; display: flex; flex-direction: column; }
.record-steps-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.record-steps { display: flex; flex-direction: column; gap: 7px; height: 378px; overflow: auto; padding-right: 2px; }
.record-step { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--stroke); border-radius: 9px; background: var(--panel-2); }
.record-step-index { flex: 0 0 22px; color: var(--muted-2); font: 11px ui-monospace, Consolas, monospace; }
.record-step-summary { min-width: 0; color: var(--text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-footer-hint { margin-right: auto; align-self: center; color: var(--muted); font-size: 11px; }
@media (max-width: 900px) {
  .record-layout { grid-template-columns: 180px minmax(0, 1fr); }
  .record-detail { grid-template-columns: 1fr; }
  .record-screen { height: 300px; }
  .record-steps { height: 260px; }
}
@media (max-width: 680px) {
  .record-layout { grid-template-columns: 1fr; }
  .record-sessions { max-height: 180px; }
}

.type-groups { display: grid; gap: 16px; }
.type-group-title { font-size: 11px; color: var(--muted); margin-bottom: 8px; letter-spacing: .5px; }
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-btn {
  border: 1px solid var(--stroke-2);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 10px;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: .15s;
}
.type-btn:hover { border-color: var(--brand); background: rgba(76, 141, 255, .08); }
.type-btn small { display: block; margin-top: 3px; color: var(--muted-2); font-size: 10.5px; }

.qr-box { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.qr-box img { width: 240px; height: 240px; background: #fff; border-radius: 12px; padding: 8px; }
.qr-box .url {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  text-align: center;
  background: var(--panel-2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
.qr-addr { font-size: 11px; color: var(--muted-2); text-align: center; }
.connect-help {
  font-size: 12px; line-height: 2; color: var(--muted);
  background: var(--panel-2); border: 1px dashed var(--stroke-2);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 16px;
}
.connect-help b { color: var(--text); font-weight: 600; }
.connect-warn {
  margin-top: 12px; font-size: 11px; line-height: 1.7;
  color: var(--muted-2); text-align: center;
}

/* ---------- 手机端服务地址设置 ---------- */
.server-help {
  font-size: 11.5px; line-height: 1.8; color: var(--muted);
  background: var(--panel-2); border: 1px dashed var(--stroke-2);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 12px;
}
.server-opts { display: flex; flex-direction: column; gap: 8px; }
.server-opt {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  border: 1px solid var(--stroke); border-radius: 10px;
  background: var(--panel-2); padding: 10px 12px; transition: .15s;
}
.server-opt:hover { border-color: var(--brand); }
.server-opt:has(input:checked) { border-color: var(--brand); background: rgba(76, 141, 255, .08); }
.server-opt input { margin: 3px 0 0; accent-color: var(--brand); flex: 0 0 auto; }
.server-opt-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.server-opt-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.server-opt-line code { font: 12px ui-monospace, Consolas, monospace; color: var(--text); word-break: break-all; }
.server-opt-tag {
  font-size: 10px; color: var(--brand); border: 1px solid rgba(76, 141, 255, .35);
  border-radius: 999px; padding: 1px 7px; white-space: nowrap;
}
.server-opt-hint { font-size: 10.5px; color: var(--muted-2); }
.server-custom { margin-top: 14px; }
.server-custom input {
  width: 100%; box-sizing: border-box; padding: 9px 11px; font-size: 12.5px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--text); background: #0B0D11;
  border: 1px solid var(--stroke); border-radius: 9px; outline: none;
}
.server-custom input:focus { border-color: var(--brand); }
.link-btn {
  border: 0; background: transparent; padding: 0 2px; cursor: pointer;
  color: var(--brand); font-size: 11px; text-decoration: underline;
}
.link-btn:hover { color: var(--text); }
.record-addr { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.record-addr code { font: 11.5px ui-monospace, Consolas, monospace; color: var(--text); word-break: break-all; }

.json-view {
  width: 100%;
  min-height: 320px;
  max-height: 56vh;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: #cfe0ff;
  background: #0b0e14;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 12px;
  resize: vertical;
}

/* ---------- 素材库（右侧主视图） ---------- */
.assets-view { overflow-y: auto; padding: 22px 26px 46px; }
.assets-view .dv-head { margin-bottom: 14px; }
.assets-view .upload-zone { margin-bottom: 2px; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.asset-card { background: var(--panel-2); border: 1px solid var(--stroke); border-radius: 12px; overflow: hidden; }
.asset-card img { width: 100%; height: 96px; object-fit: cover; display: block; background: #0b0e14; }
.asset-card .info { padding: 8px 10px; font-size: 11px; color: var(--muted); }
.asset-card .info .nm { color: var(--text); font-size: 12px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card .ops { display: flex; gap: 6px; margin-top: 7px; }

.upload-zone {
  border: 1px dashed var(--stroke-2);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 16px;
}
.upload-zone:hover { border-color: var(--brand); color: var(--text); }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 210; align-items: center; }
.toast {
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--panel-3);
  border: 1px solid var(--stroke-2);
  color: var(--text);
  font-size: 12.5px;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease;
}
.toast.ok { border-color: rgba(51, 209, 122, .4); }
.toast.err { border-color: rgba(255, 93, 93, .45); color: #ffd7d7; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #242b3a; border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #303a4d; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .editor-body { grid-template-columns: minmax(0, 1fr); }
  .canvas-col { position: static; }
  .phone { max-width: 260px; }
}

/* 窄屏全屏：元素面板改到画布下方，保证画面有足够高度 */
@media (max-width: 820px) {
  .canvas-card.is-full { padding: 12px; }
  .canvas-card.is-full .canvas-stage { flex-direction: column; gap: 10px; }
  .canvas-card.is-full .zoom-wrap { height: auto; min-height: 0; }
  .canvas-card.is-full .ui-tree-panel { width: auto; max-width: none; height: 38%; }
}
