/* W3-2 界面骨架：左图标栏 + 二级侧栏 + 内容区（原创样式，浅色） */

:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --line: #e5e9f1;
  --line-soft: #f0f3f8;
  --ink: #1f2a3a;
  --muted: #6b7787;
  --brand: #2377e6;
  --brand-dark: #1a63c4;
  --brand-soft: #e9f2ff;
  --ok: #1f9d55;
  --ok-soft: #e8f8ee;
  --bad: #d93a3a;
  --bad-soft: #fdecec;
  --warn: #b26a00;
  --warn-soft: #fff4e5;
  --rail-bg: #232b38;
  --rail-ink: #93a0b2;
  --rail-hover: #2c3646;
  --rail-active: #31405a;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: 13px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
code { background: #f1f4f9; border-radius: 4px; padding: 1px 5px; font-size: 12px; color: #33415c; }
.spacer { flex: 1; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #eef4ff 0%, #f6f8fc 45%, #eef7f3 100%);
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 30px 28px; box-shadow: 0 18px 50px rgba(31, 42, 58, .12);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: .2px; }
.login-card h1 span { color: var(--brand); }
.login-card .sub { color: var(--muted); font-size: 12px; margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 12px; }
.field input, .field select, .field textarea {
  background: #fff; border: 1px solid #d8dfea; border-radius: 7px;
  padding: 9px 10px; color: var(--ink); outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(35, 119, 230, .12);
}
/* 单选/复选不再套一圈蓝色椭圆；选中态交给浏览器原生圆点/勾选。 */
input[type="radio"]:focus, input[type="radio"]:focus-visible,
input[type="checkbox"]:focus, input[type="checkbox"]:focus-visible,
.field input[type="radio"]:focus, .field input[type="checkbox"]:focus {
  outline: none; box-shadow: none;
}
input[type="radio"], input[type="checkbox"] { accent-color: var(--brand); }
.field input[type="radio"] { width: auto; padding: 0; margin: 0 4px 0 0; border: 0; background: transparent; vertical-align: -2px; }
.btn { border: 0; border-radius: 7px; padding: 9px 15px; cursor: pointer; font-size: 13px; }
/* W8-349：控制台 topbar「平台官网」用 <a class="btn">，去掉链接下划线并保持按钮外观 */
a.btn { display: inline-block; text-decoration: none; line-height: normal; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid #d8dfea; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.error { color: var(--bad); font-size: 12px; min-height: 18px; margin-top: 8px; white-space: pre-wrap; }

/* ---------- 外壳 ---------- */
.app { height: 100vh; min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 54px; flex: 0 0 54px; display: flex; align-items: center; gap: 14px;
  padding: 0 18px; background: #fff; border-bottom: 1px solid var(--line); z-index: 10;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: .2px; white-space: nowrap; }
.brand .mark {
  width: 22px; height: 22px; border-radius: 6px; display: inline-block;
  background: url('/brand/mark.svg') center/cover no-repeat, linear-gradient(135deg, #3d8bfd, #19b6a5);
}
.brand small { font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.crumb { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb b { color: var(--ink); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: #f1f4f9; color: #54617a; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.role { background: #eef4ff; color: #3d64a8; }
.pill.role.admin { background: var(--warn-soft); color: var(--warn); }

.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--rail-w, 56px) var(--subnav-w, 200px) minmax(0, 1fr); position: relative; transition: grid-template-columns .18s cubic-bezier(.2, 0, 0, 1); }

/* 左图标栏 */
/* 左图标栏 W8-351：一级菜单可能超出视口（17 项），rail 纵向可滚动；
   滚动容器会裁剪溢出到 rail 外的内容，故悬浮文字改为 rail 内叠加（见 .rail-label）。 */
.rail {
  background: var(--rail-bg); display: flex; flex-direction: column; align-items: stretch;
  padding: 10px 0; gap: 4px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin;
}
.rail::-webkit-scrollbar { width: 6px; }
.rail::-webkit-scrollbar-thumb { background: #3a4a63; border-radius: 3px; }
.rail::-webkit-scrollbar-track { background: transparent; }
.rail-item {
  position: relative; border: 0; background: transparent; color: var(--rail-ink);
  height: 50px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.rail-item:hover { background: var(--rail-hover); color: #dfe7f3; }
.rail-item.active { background: var(--rail-active); color: #fff; }
.rail-item.active::after { content: ""; position: absolute; right: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px 0 0 2px; background: #4f9bff; }
.rail-item svg { width: 24px; height: 24px; }
.rail-item .rail-label {
  position: absolute; inset: 2px; display: flex; align-items: center; justify-content: center;
  background: #111827; color: #fff; font-size: 10.5px; padding: 0 2px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 30;
}
.rail-item:hover .rail-label { opacity: 1; }
.rail-item:focus { outline: none; }
.rail-item:focus-visible { outline: 2px solid rgba(148,197,255,.55); outline-offset: -2px; }

/* 二级侧栏（W8-362：可滚动但隐藏滚动条，避免窄栏出现粗滚动条/双滚动条） */
.subnav {
  background: #fff; border-right: 1px solid var(--line); overflow-y: auto;
  padding-bottom: 16px; width: var(--subnav-w, 176px);
  scrollbar-width: none; -ms-overflow-style: none;
}
.subnav::-webkit-scrollbar { display: none; width: 0; height: 0; }
.subnav-title { padding: 18px 16px 10px; font-size: 15px; font-weight: 600; color: var(--ink); }
.subnav-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 9px 16px; color: #4b5563; font-size: 13px; cursor: pointer;
}
.subnav-item:hover { background: #f6f8fc; color: var(--brand); }
.subnav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }

/* 内容区 */
.content { min-width: 0; min-height: 0; overflow: auto; padding: 16px 20px 22px; }
.view { min-height: 0; }
.loading { color: var(--muted); padding: 26px 4px; }

/* ---------- 通用块 ---------- */
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card { padding: 14px 16px; margin-bottom: 14px; }
.panel { padding: 4px 14px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card h3 { margin: 0; font-size: 14px; }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.page-head h1 { margin: 0 0 3px; font-size: 18px; font-weight: 600; }
.page-head .sub { color: var(--muted); font-size: 12px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; margin-bottom: 12px; }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
input.ctl, select.ctl, textarea.ctl {
  height: 32px; background: #fff; border: 1px solid #d8dfea; border-radius: 6px;
  padding: 0 9px; color: var(--ink); outline: none;
}
textarea.ctl { height: auto; padding: 8px 9px; resize: vertical; }
input.ctl:focus, select.ctl:focus, textarea.ctl:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(35, 119, 230, .12); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.link-btn { border: 0; background: none; color: var(--brand); padding: 3px 5px; cursor: pointer; font-size: 12px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--bad); }
.link-btn + .link-btn { margin-left: 2px; }
.empty { color: var(--muted); font-size: 13px; padding: 26px 4px; text-align: center; }
.empty::before { content: ""; display: block; width: 58px; height: 46px; margin: 0 auto 8px; opacity: .45;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2052'%3E%3Cpath%20fill='none'%20stroke='%239aa7b8'%20stroke-width='2'%20d='M4%2012a4%204%200%200%201%204-4h16l6%206h26a4%204%200%200%201%204%204v26a4%204%200%200%201-4%204H8a4%204%200%200%201-4-4z'/%3E%3Cpath%20stroke='%239aa7b8'%20stroke-width='2'%20d='M4%2020h56'/%3E%3C/svg%3E"); }
.notice { display: none; font-size: 12px; padding: 8px 10px; border-radius: 6px; margin-top: 10px; }
.notice.err { display: block; background: var(--bad-soft); color: #a12626; }
.notice.ok { display: block; background: var(--ok-soft); color: #176c3b; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbfcfe;
}
table.grid td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.grid tbody tr:hover td { background: #fafcff; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; background: #f1f4f9; color: #5b6675; white-space: nowrap; }
.tag.blue { background: var(--brand-soft); color: #1d5cb5; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--bad-soft); color: var(--bad); }
.tag.line { background: transparent; border: 1px solid var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #b9c2d0; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.pager { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; padding: 10px 4px; }
.pager .spacer { flex: 1; }

/* ---------- 监控大屏 ---------- */
.monitor { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 14px; min-height: 0; }
.dev-side { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 10px; overflow: auto; max-height: calc(100vh - 130px); }
.dev-side h2 { font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 2px 8px 10px; }
.dev-main { min-width: 0; }
.device-item { padding: 9px 10px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; margin-bottom: 4px; }
.device-item:hover { background: #f6f8fc; }
.device-item.active { background: var(--brand-soft); border-color: #cfe1ff; }
.device-item .name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.device-item .meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.device-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.mobile-device-switch { display: none; }
.device-head h1 { margin: 0 0 4px; font-size: 20px; }
.device-head .meta { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.sensor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; margin-bottom: 14px; }
.sensor-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; transition: .12s; }
.sensor-card:hover { border-color: #b9d2f7; box-shadow: 0 4px 14px rgba(35, 119, 230, .07); }
.sensor-card.active { border-color: var(--brand); box-shadow: 0 0 0 1px rgba(35, 119, 230, .25) inset; }
.sensor-card .label { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.sensor-name { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.sensor-glyph { display: inline-flex; width: 17px; height: 17px; color: #1687c9; flex: none; }
.sensor-glyph svg { width: 100%; height: 100%; }
.sensor-row-name .name { display: flex; align-items: center; gap: 6px; }
.sensor-card .value { font-size: 24px; font-weight: 650; margin-top: 7px; font-variant-numeric: tabular-nums; }
.sensor-card .value small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.sensor-card .ts { color: var(--muted); font-size: 11px; margin-top: 5px; }
.chart-wrap { width: 100%; overflow: hidden; }
svg#chart { width: 100%; height: 280px; display: block; }
.chart-meta { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.chart-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
/* W4-5 设备组分组（监控中心左栏） */
.dev-group { margin-bottom: 10px; }
.dev-group-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; color: var(--muted); font-size: 11.5px; letter-spacing: .04em; }
.dev-group-head .count { margin-left: auto; font-variant-numeric: tabular-nums; }
.alarm-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.alarm-row:last-child { border-bottom: 0; }
.alarm-row .time { color: var(--muted); font-size: 12px; min-width: 132px; }
.alarm-row .msg { flex: 1; }
.status { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.status.FIRING { background: var(--bad-soft); color: var(--bad); }
.status.RESOLVED { background: var(--ok-soft); color: var(--ok); }

/* ---------- 地图 ---------- */
.map-view { display: flex; flex-direction: column; gap: 10px; height: calc(100vh - 88px); }
.map-legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; align-items: center; }
.map-legend .key { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.map-wrap { flex: 1; min-height: 260px; border: 1px solid var(--line); border-radius: var(--radius); background: #f7faff; position: relative; overflow: hidden; }
.map-wrap svg { width: 100%; height: 100%; display: block; }
.amap-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.amap-device-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--ok);
  border: 3px solid #fff; box-shadow: 0 1px 6px rgba(15,23,42,.35); }
.amap-device-dot.alarm { background: var(--bad); }
.amap-device-dot.offline { background: #9aa7b8; }
.amap-device-label { margin-top: 4px; padding: 2px 6px; border-radius: 4px; background: rgba(17,24,39,.82);
  color: #fff; font-size: 11px; white-space: nowrap; }
.amap-cluster { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 48px; height: 38px;
  padding: 0 9px; border: 2px solid #fff; border-radius: 19px; background: #2563eb; color: #fff;
  box-shadow: 0 3px 12px rgba(37,99,235,.45); font-size: 11px; white-space: nowrap; cursor: pointer; }
.amap-cluster b { font-size: 15px; line-height: 1; }
.amap-cluster-box { min-width: 230px; max-width: 320px; max-height: 260px; overflow: auto; }
.amap-cluster-head { padding: 4px 6px 8px; border-bottom: 1px solid #eef2f7; font-size: 13px; font-weight: 600; }
.amap-cluster-item { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid #f2f4f7; cursor: pointer; }
.amap-cluster-item:last-child { border-bottom: 0; }
.amap-cluster-item:hover { background: #f8fafc; }
.amap-cluster-item .amap-device-dot { display: inline-block; flex: 0 0 auto; }
.amap-cluster-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.amap-cluster-main b { font-size: 12.5px; }
.amap-cluster-main .small { font-size: 11px; }
.amap-cluster-open { color: var(--brand); font-size: 11px; flex: 0 0 auto; }
.map-grid { stroke: #dfe8f5; stroke-width: 1; }
/* W4-4 离线底图：经纬网 / 城市点 / 比例尺 / 指北针 */
.map-graticule { stroke: #dbe6f4; stroke-width: 1; }
.map-grid-label { fill: #93a3b8; font-size: 10px; }
.map-city { fill: #8fa0b6; }
.map-city-label { fill: #7f8fa5; font-size: 10px; }
.map-scale line, .map-scale path { stroke: #6b7787; stroke-width: 1.5; fill: none; }
.map-scale text { fill: #6b7787; font-size: 10px; }
.map-north line, .map-north path { stroke: #6b7787; stroke-width: 1.5; fill: none; }
.map-north text { fill: #6b7787; font-size: 10px; font-weight: 600; }
.map-dot { cursor: pointer; }
.map-dot.online { fill: var(--ok); }
.map-dot.offline { fill: #9aa7b8; }
.map-dot.alarm { fill: var(--bad); animation: mapPulse 1.2s ease-in-out infinite; }
@keyframes mapPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.map-ring { fill: none; stroke: var(--bad); stroke-width: 2; animation: mapRing 1.6s ease-out infinite; }
@keyframes mapRing { 0% { r: 10; opacity: .85; } 100% { r: 24; opacity: 0; } }
.map-label { fill: #33415c; font-size: 11px; pointer-events: none; }
.map-coord { fill: #8794a8; font-size: 10px; pointer-events: none; }
.map-axis { fill: #8794a8; font-size: 10px; }
.map-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
/* W8-112 位置变更轨迹（非 GPS 遥测）：工具栏 + 折线 + 起终点 */
.map-track { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.map-track label { margin-right: -2px; }
.map-track select { height: 28px; min-width: 180px; }
.map-track-line { fill: none; stroke: #7a5af8; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; opacity: .9; }
.map-track-end { stroke: #fff; stroke-width: 2; }
.map-track-end.start { fill: #16a34a; }
.map-track-end.end { fill: #7a5af8; }
.map-track-label { fill: #5b46c9; font-size: 10px; pointer-events: none; }
.amap-track-dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 6px rgba(15, 23, 42, .35); }
.amap-track-dot.start { background: #16a34a; }
.amap-track-dot.end { background: #7a5af8; }
.track-mini-wrap { margin-bottom: 8px; }
.track-mini { width: 100%; max-width: 620px; height: 120px; display: block; background: #f7faff;
  border: 1px solid var(--line); border-radius: 6px; }
/* W8-114 素材裁剪：原图上的框选区域 */
.crop-stage { position: relative; max-width: 520px; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: #f4f7fb; user-select: none; touch-action: none; }
.crop-stage img { display: block; width: 100%; height: auto; pointer-events: none; }
.crop-box { position: absolute; border: 2px dashed #4f46e5; background: rgba(79, 70, 229, .12);
  pointer-events: none; }
.crop-box.hidden { display: none; }
/* W8-115 地图热力/卫星开关 */
.map-toggle { display: inline-flex; align-items: center; gap: 4px; color: var(--muted);
  font-size: 12px; cursor: pointer; }
.map-toggle input { accent-color: #4f46e5; margin: 0; }
.map-toggle input:disabled + span, .map-toggle input:disabled { cursor: not-allowed; opacity: .55; }
.map-heat { pointer-events: none; }
/* W8-201 要素热力画布（叠在地图上，不拦鼠标） */
.map-heat-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* W8-113 轨迹回放：时间轴 + 已走折线 + 当前点 */
.map-replay { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12px;
  padding: 6px 10px; background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 8px; }
.map-replay input[type="range"] { flex: 1; min-width: 160px; accent-color: #7a5af8; }
.map-track-walked { fill: none; stroke: #4f46e5; stroke-width: 3.2; stroke-linejoin: round;
  stroke-linecap: round; }
.map-track-cursor { fill: #fff; stroke: #4f46e5; stroke-width: 3; }
svg.replaying .map-track-line { opacity: .28; }
.amap-track-cursor { width: 16px; height: 16px; border-radius: 50%; background: #fff;
  border: 3px solid #4f46e5; box-shadow: 0 1px 8px rgba(79, 70, 229, .45); }
/* W8-203b 电子围栏（圆形）与停留点 */
.map-legend .key-geofence { background: transparent; border: 1px dashed #2563eb; }
.map-geofence { fill: rgba(37, 99, 235, .10); stroke: #2563eb; stroke-width: 1.6;
  stroke-dasharray: 6 4; }
.map-geofence.disabled { fill: rgba(148, 163, 184, .08); stroke: #94a3b8; }
.map-stop { fill: #f59e0b; stroke: #fff; stroke-width: 2; }
.amap-stop-dot { width: 12px; height: 12px; border-radius: 50%; background: #f59e0b;
  border: 2px solid #fff; box-shadow: 0 1px 6px rgba(15, 23, 42, .35); }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .42); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.modal-card { width: 640px; max-width: 100%; max-height: 88vh; background: #fff; border-radius: 10px; display: flex; flex-direction: column; box-shadow: 0 22px 60px rgba(15, 23, 42, .28); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .close { margin-left: auto; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
#modal.modal-drawer { align-items: stretch; justify-content: flex-end; padding: 0; }
#modal.modal-drawer .modal-card { width: 920px; max-width: 100%; height: 100vh; max-height: 100vh; border-radius: 0;
  animation: qx-drawer-in .18s ease-out; }
@keyframes qx-drawer-in { from { transform: translateX(28px); opacity: .55; } to { transform: translateX(0); opacity: 1; } }
@media (max-width: 900px) { #modal.modal-drawer .modal-card { width: 100%; } }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field { margin: 0; }
.hint { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.check-row { display: flex; flex-wrap: wrap; gap: 14px; padding: 4px 0; }
.check-row label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink); }
.perm-group { border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; margin-bottom: 8px; }
.perm-group .perm-title { font-weight: 600; font-size: 12.5px; margin-bottom: 6px; }
.perm-group label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; margin-right: 14px; }

/* ---------- 云组态（W4-1 固定模板） ---------- */
svg#compChart { width: 100%; height: 280px; display: block; }
.comp-view .comp-top { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.comp-gauge-card svg { width: 100%; height: 190px; display: block; }
.comp-view.gauge .comp-gauge-card svg { height: 260px; }
.comp-view.curve .comp-gauge-card svg { height: 150px; }
.comp-view.gauge #compChart { height: 200px; }
.comp-view.curve #compChart { height: 360px; }
.comp-info-card .comp-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; padding: 6px 2px; }
.comp-info-card .comp-kpis div { display: flex; flex-direction: column; gap: 4px; }
.comp-info-card .comp-kpis b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) { .comp-view .comp-top { grid-template-columns: 1fr; } }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 56px 170px minmax(0, 1fr); }
  .monitor { grid-template-columns: 1fr; }
  .dev-side { max-height: 200px; }
}

/* ---------- W5-1b 用户前台（portal） ---------- */
body.portal-mode .workspace { grid-template-columns: var(--rail-w, 56px) minmax(0, 1fr); }
body.portal-mode .subnav { display: none; }
body.portal-mode .content { padding: 16px 20px 26px; }

.sensor-grid.sensor-list { display: flex; flex-direction: column; gap: 8px; }
.sensor-row {
  display: grid; grid-template-columns: minmax(150px, 1.1fr) 160px 150px auto;
  align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.sensor-row:hover { border-color: #b9d2f7; box-shadow: 0 3px 12px rgba(35,119,230,.06); }
.sensor-row.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px rgba(35,119,230,.22); }
.sensor-row .name { font-weight: 600; font-size: 13.5px; }
.sensor-row-status .tag { display: inline-block; margin-bottom: 3px; }
.sensor-row-value { font-size: 20px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.sensor-row-value small { font-size: 12px; color: var(--muted); margin-left: 3px; font-weight: 400; }
.sensor-row-actions { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }

@media (max-width: 900px) {
  body.portal-mode .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 56px; }
  body.portal-mode .rail { grid-row: 2; flex-direction: row; justify-content: space-around; padding: 0; gap: 0; overflow: hidden; }
  /* W7-4：前台 12 个入口时按可用宽度均分，图标略缩小，避免底部导航溢出 */
  body.portal-mode .rail-item { flex: 1 1 0; min-width: 0; height: 56px; }
  body.portal-mode .rail-item svg { width: 19px; height: 19px; }
  body.portal-mode .rail-item .rail-label { display: none; }
  body.portal-mode .rail-item.active::after {
    top: auto; bottom: 0; left: 18px; right: 18px; width: auto; height: 3px; border-radius: 2px 2px 0 0;
  }
  /* W8-439：门户顶栏原先固定 54px 且不换行，390 宽下「平台官网/费用中心」被压成竖排并盖住正文。 */
  body.portal-mode .topbar {
    height: auto; min-height: 52px; flex: 0 0 auto; flex-wrap: wrap;
    padding: 6px 10px; row-gap: 6px;
  }
  body.portal-mode .topbar .btn { white-space: nowrap; flex: 0 0 auto; }
  body.portal-mode .page-head { flex-wrap: wrap; gap: 8px; }
  body.portal-mode .page-head .actions { margin-left: 0; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  body.portal-mode .page-head .actions .btn { flex: 0 0 auto; white-space: nowrap; }
  body.portal-mode #tenantPill, body.portal-mode #refreshHint { display: none; }
  body.portal-mode .topbar .btn { padding: 6px 9px; }
  body.portal-mode .card-head { flex-wrap: wrap; gap: 6px; }
  body.portal-mode .topbar .brand small, body.portal-mode #crumb { display: none; }
  body.portal-mode .content { padding: 12px; }
  body.portal-mode .monitor { grid-template-columns: 1fr; }
  body.portal-mode .dev-side { max-height: 220px; }
  .sensor-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name value" "status actions"; row-gap: 6px; }
  .sensor-row-name { grid-area: name; }
  .sensor-row-value { grid-area: value; }
  .sensor-row-status { grid-area: status; }
  .sensor-row-actions { grid-area: actions; }
  .sensor-row-actions .link-btn { font-size: 11.5px; }
  body.portal-mode .page-head h1 { font-size: 16px; }
  body.portal-mode .chart-wrap svg#chart { height: 200px; }
}

/* ---------- W5-4 企业概览 ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--brand); color: #fff; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat-card.warn { border-color: #f0b7b7; background: #fff8f8; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 650; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 48px; align-items: center; gap: 8px; padding: 5px 0; }
.bar-name { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: #eef3f9; border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #3d8bfd, #73b1ff); border-radius: 4px; }
.bar-value { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.trend { display: flex; flex-direction: column; gap: 4px; }
.trend-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 96px; align-items: center; gap: 8px; }
.trend-date { font-size: 11px; color: var(--muted); }
.trend-bars { display: flex; flex-direction: column; gap: 2px; }
.trend-bars i { display: block; height: 4px; border-radius: 2px; min-width: 0; }
.trend-nums { font-size: 11px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.t-devices { background: #3d8bfd; }
.t-users { background: #35b37e; }
.t-active { background: #f0a020; }
i.legend { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin: 0 3px 0 8px; vertical-align: -1px; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .stat-card { padding: 10px 12px; min-width: 0; }
  .stat-value { font-size: 22px; overflow-wrap: anywhere; }
  .stat-label, .stat-sub { overflow-wrap: anywhere; }
}

/* ---------- W5-5 白标 ---------- */
.login-logo { width: 72px; height: 72px; object-fit: contain; display: block; margin: 0 auto 12px; border-radius: 14px; }
.login-card h1 #loginTitle { letter-spacing: -.3px; }
.brand .mark { background-size: cover; background-position: center; }
.brand-logo-preview {
  width: 96px; height: 96px; margin: 8px 0; border: 1px dashed var(--line);
  border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fafcff;
}
.brand-logo-preview img { max-width: 100%; max-height: 100%; }

/* ---------- W5-7 云组态素材库 ---------- */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.asset-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.asset-card img { width: 100%; height: 96px; object-fit: cover; border-radius: 6px; background: #f4f7fb; display: block; margin-bottom: 6px; }

/* ---------- W8-352 A 批：组态素材库（内置素材，22 分类 / 4 列卡片 / 分页） ---------- */
.material-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; align-items: start; }
.material-cats {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px;
  max-height: calc(100vh - 200px); overflow-y: auto; scrollbar-width: thin;
}
.material-cat {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none;
  text-align: left; padding: 7px 9px; border-radius: 6px; color: #3f4b5b; font-size: 12.5px; cursor: pointer;
}
.material-cat:hover { background: #f3f7fd; }
.material-cat.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.material-cat .material-cat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-cat .count { margin-left: auto; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.material-main { min-width: 0; }
.material-main .toolbar .spacer { flex: 1; }
.material-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.material-card {
  display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; min-width: 0;
}
.material-card:hover { border-color: #bcd5f7; box-shadow: 0 8px 22px rgba(35, 119, 230, .10); }
.material-thumb {
  height: 110px; display: flex; align-items: center; justify-content: center;
  background: #f7f9fd; border-radius: 8px; overflow: hidden;
}
.material-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.material-thumb-empty::after { content: "无预览"; color: var(--muted); font-size: 12px; }
.material-name { font-size: 12.5px; font-weight: 600; color: #1f2a3a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-meta { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-actions { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.material-page-current {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px;
  padding: 0 4px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; font-weight: 600;
}
@media (max-width: 1100px) { .material-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .material-layout { grid-template-columns: minmax(0, 1fr); }
  .material-cats { max-height: none; display: flex; flex-wrap: wrap; gap: 2px; }
  .material-cat { width: auto; }
  .material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) { .material-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- W8-353 B 批：云组态卡片列表（已发布 / 未发布） ---------- */
.comp-card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.comp-card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.comp-card:hover { border-color: #bcd5f7; box-shadow: 0 10px 26px rgba(35, 119, 230, .10); }
.comp-cover { position: relative; height: 160px; background: #f4f7fb; overflow: hidden; }
.comp-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.comp-status { position: absolute; right: 8px; top: 8px; }
.comp-check {
  position: absolute; left: 8px; top: 8px; z-index: 2; line-height: 1;
  background: rgba(255, 255, 255, .92); border-radius: 4px; padding: 2px 4px;
}
.comp-check input { margin: 0; vertical-align: middle; }
.comp-card-body { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px 12px; flex: 1; }
.comp-title { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: #1f2a3a; }
.comp-title-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-icons { margin-left: auto; display: flex; gap: 4px; }
.comp-icon-btn {
  width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 5px;
  background: #fbfcfe; color: #b6c1d0; font-size: 10px; cursor: not-allowed;
}
.comp-id { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.comp-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: 11.5px; }
.comp-meta span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.comp-actions .link-btn { padding: 2px 4px; }
.comp-actions .link-btn[disabled] { color: #b6c1d0; cursor: not-allowed; text-decoration: none; }
.comp-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 4px; color: var(--muted); font-size: 12px; }
.comp-bottom .spacer { flex: 1; }
.comp-select-all { display: inline-flex; align-items: center; gap: 6px; }
.comp-cover-preview {
  width: 160px; height: 80px; margin: 6px 0; border: 1px dashed var(--line); border-radius: 8px;
  overflow: hidden; background: #f7f9fd; display: flex; align-items: center; justify-content: center;
}
.comp-cover-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.comp-share-qr { margin: 10px 0; min-height: 20px; }
.comp-share-qr img { border: 1px solid var(--line); border-radius: 8px; background: #fff; display: block; }

/* ---------- W8-354 C-a：画布参数 / 多画布 / 导航 / 轮播切页动画 ---------- */
.comp-page-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 10px;
}
.comp-page-tabs { display: flex; align-items: center; gap: 8px; overflow-x: auto; flex: 1; min-width: 0; padding-bottom: 2px; }
.comp-page-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px; border: 1px solid var(--line);
  background: #fbfcfe; border-radius: 8px; padding: 5px 6px; cursor: pointer; flex: 0 0 auto;
}
.comp-page-tab.active { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(35, 119, 230, .10); }
.comp-page-tab.hidden-page { opacity: .55; }
.comp-page-thumb {
  position: relative; display: block; overflow: hidden; background: #fff;
  border: 1px solid var(--line); border-radius: 4px;
}
.comp-page-thumb i { position: absolute; display: block; background: #cbd9ec; border-radius: 1px; }
.comp-page-name { font-size: 10.5px; color: #475467; max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-page-tab.active .comp-page-name { color: var(--brand-dark); font-weight: 600; }
.comp-page-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.comp-runtime-wrap { position: relative; background: #f4f7fb; border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto; }
.comp-runtime-stage { position: relative; }
.comp-runtime-canvas { margin: 0 auto; box-shadow: 0 8px 26px rgba(31, 42, 58, .10); overflow: hidden; }
.comp-canvas-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #9aa7b8; font-size: 13px;
}
.comp-view-hscreen .page-head .sub::after { content: " · 运行页将强制横屏"; color: var(--warn); }
.comp-page-nav {
  position: absolute; z-index: 5; display: flex; gap: 4px; padding: 6px;
  border-radius: 8px; box-shadow: 0 6px 18px rgba(15, 23, 42, .18);
}
.comp-page-nav.comp-nav-top { left: 50%; top: 10px; transform: translateX(-50%); }
.comp-page-nav.comp-nav-bottom { left: 50%; bottom: 10px; transform: translateX(-50%); }
.comp-page-nav.comp-nav-left { left: 10px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.comp-page-nav.comp-nav-right { right: 10px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.comp-page-nav.floating { position: fixed; }
.comp-nav-btn {
  border: 0; background: rgba(255, 255, 255, .10); color: inherit; padding: 5px 10px;
  border-radius: 6px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.comp-nav-btn:hover { background: rgba(255, 255, 255, .20); }
.comp-nav-btn.active { background: var(--comp-nav-active, #38bdf8); color: #0b1220; font-weight: 600; }
@keyframes compFade1 { from { opacity: .15; } to { opacity: 1; } }
@keyframes compFade2 { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: blur(0); } }
@keyframes compBounce1 { 0% { transform: scale(.96); } 60% { transform: scale(1.015); } 100% { transform: scale(1); } }
@keyframes compBounce2 { 0% { transform: translateY(14px); } 60% { transform: translateY(-4px); } 100% { transform: translateY(0); } }
@keyframes compFlipX { from { transform: perspective(1200px) rotateX(18deg); opacity: .3; } to { transform: perspective(1200px) rotateX(0); opacity: 1; } }
@keyframes compFlipY { from { transform: perspective(1200px) rotateY(18deg); opacity: .3; } to { transform: perspective(1200px) rotateY(0); opacity: 1; } }
@keyframes compSlide { from { transform: translateX(40px); opacity: .2; } to { transform: translateX(0); opacity: 1; } }
.comp-runtime-canvas.comp-anim-none { animation: none; }
.comp-runtime-canvas.comp-anim-fade1 { animation: compFade1 .5s ease; }
.comp-runtime-canvas.comp-anim-fade2 { animation: compFade2 .6s ease; }
.comp-runtime-canvas.comp-anim-bounce1 { animation: compBounce1 .45s ease; }
.comp-runtime-canvas.comp-anim-bounce2 { animation: compBounce2 .5s ease; }
.comp-runtime-canvas.comp-anim-flipX { animation: compFlipX .55s ease; }
.comp-runtime-canvas.comp-anim-flipY { animation: compFlipY .55s ease; }
.comp-runtime-canvas.comp-anim-slide { animation: compSlide .45s ease; }
@media (max-width: 900px) {
  .comp-page-actions { justify-content: flex-start; }
  .comp-runtime-wrap { padding: 8px; }
}
@media (max-width: 1100px) { .comp-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .comp-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .comp-card-grid { grid-template-columns: minmax(0, 1fr); }
  .comp-cover { height: 140px; }
}

/* ---------- W8-3 云组态拖拽编辑器 ---------- */
.comp-editor-layout { display: grid; grid-template-columns: 218px minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.comp-editor-canvas-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.comp-stage { position: relative; margin: 12px auto; }
.comp-canvas { position: relative; width: 1000px; height: 600px; background: #fff; }
.comp-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(15, 23, 42, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .06) 1px, transparent 1px);
  background-size: 20px 20px;
}
.comp-widget {
  position: absolute; box-sizing: border-box; border: 1px dashed transparent; border-radius: 6px;
  overflow: hidden; cursor: move; user-select: none;
}
.comp-widget.selected { border-color: #4f9bff; box-shadow: 0 0 0 2px rgba(79, 155, 255, .18); z-index: 3; }
.comp-widget.text { display: flex; align-items: center; padding: 2px 6px; font-weight: 600; }
.comp-widget.value {
  display: flex; flex-direction: column; justify-content: center; padding: 6px 10px;
  background: rgba(255, 255, 255, .78); border: 1px solid #e5eaf2;
}
.comp-widget .cw-label { font-size: 12px; color: #6b7280; }
.comp-widget .cw-value { font-size: 26px; font-weight: 600; color: #111827; }
.comp-widget.curve {
  display: flex; flex-direction: column; padding: 6px 8px;
  background: rgba(255, 255, 255, .82); border: 1px solid #e5eaf2;
}
.comp-widget.curve svg { flex: 1; width: 100%; min-height: 0; }
.comp-widget.image { display: flex; align-items: center; justify-content: center; background: transparent; }
.comp-widget.image img { width: 100%; height: 100%; object-fit: contain; }
.comp-widget .cw-empty { color: #9aa7b8; font-size: 12px; }
.comp-props {
  position: sticky; top: 12px; padding: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
}
.comp-props-title { margin-bottom: 10px; font-weight: 600; }
.comp-props .field { margin-bottom: 8px; }
@media (max-width: 1100px) {
  .comp-editor-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .comp-props { grid-column: 1 / -1; position: static; }
}
@media (max-width: 760px) {
  .comp-editor-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- W8-355 C-b：组件库第一波（调色板/12 类组件渲染） ---------- */
.comp-palette {
  position: sticky; top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; max-height: calc(100vh - 180px); overflow: auto;
}
.comp-palette-head { margin-bottom: 8px; }
.comp-palette-search { position: relative; }
.comp-palette-section { border-top: 1px dashed var(--line); padding: 6px 0; }
.comp-palette-section:first-child { border-top: 0; }
.comp-palette-section > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: #334155;
  list-style: none; padding: 4px 2px; user-select: none;
}
.comp-palette-section > summary::before { content: "▸ "; color: #94a3b8; }
.comp-palette-section[open] > summary::before { content: "▾ "; }
.comp-palette-body { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 2px; }
.comp-palette-item {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: #fbfcfe; border-radius: 8px; padding: 6px 9px; font-size: 12px; color: #334155;
  cursor: grab; user-select: none;
}
.comp-palette-item:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.comp-palette-item:active { cursor: grabbing; }
.comp-palette-dot { width: 7px; height: 7px; border-radius: 50%; background: #93c5fd; display: inline-block; }
.comp-shape-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
.comp-shape-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid var(--line);
  background: #fbfcfe; border-radius: 8px; padding: 5px 3px; cursor: grab; font-size: 10px; color: #64748b;
}
.comp-shape-item svg { width: 100%; height: 34px; }
.comp-shape-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.comp-gallery-cats { display: flex; flex-wrap: wrap; gap: 4px; max-height: 96px; overflow: auto; margin-bottom: 6px; }
.comp-gallery-cat {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 8px;
  font-size: 11px; color: #475467; cursor: pointer;
}
.comp-gallery-cat .count { color: #94a3b8; margin-left: 3px; font-size: 10px; }
.comp-gallery-cat.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.comp-gallery-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-height: 220px; overflow: auto; }
.comp-gallery-item {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 2px;
  cursor: grab; height: 52px; display: flex; align-items: center; justify-content: center;
}
.comp-gallery-item img { max-width: 100%; max-height: 100%; object-fit: contain; }
.comp-gallery-item.weather { background: #0b1f33; border-color: #1b5a86; }
.comp-gallery-item.weather img { filter: none; }
.comp-gallery-item:hover { border-color: var(--brand); }
.comp-upload input[type=file] { width: 100%; font-size: 11px; }
.comp-upload .hint { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.comp-shortcut-list div { line-height: 1.7; }
.comp-combo-frame {
  width: 100%; height: 100%; border: 1px dashed #94a3b8; border-radius: 8px;
  display: flex; align-items: flex-start; justify-content: flex-start; padding: 4px 8px;
  color: #64748b; font-size: 12px; background: rgba(148, 163, 184, .06);
}
.comp-switch {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: #e2e8f0; color: #475467; font-size: 13px; font-weight: 600; user-select: none;
}
.comp-switch[data-switch-state="on"] { background: #22c55e; color: #fff; }
.comp-switch .comp-switch-on, .comp-switch .comp-switch-off { display: none; }
.comp-switch[data-switch-state="on"] .comp-switch-on { display: inline; }
.comp-switch[data-switch-state="off"] .comp-switch-off { display: inline; }
.comp-pageswitch {
  width: 100%; height: 100%; border: 1px solid currentColor; border-radius: 8px; background: #fff;
  cursor: pointer; font-weight: 600;
}
.comp-pipe { width: 100%; height: 100%; display: flex; align-items: center; }
.comp-pipe-track { position: relative; flex: 1; height: 60%; border-radius: 999px; background: #cbd5e1; overflow: hidden; }
.comp-pipe[data-pipe-state="on"] .comp-pipe-track { background: #bae6fd; }
.comp-pipe-flow {
  position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(14, 165, 233, .85) 0 12px, transparent 12px 24px);
  opacity: 0;
}
.comp-pipe[data-pipe-state="on"] .comp-pipe-flow { opacity: 1; animation: compPipeFlow 1s linear infinite; }
@keyframes compPipeFlow { from { transform: translateX(0); } to { transform: translateX(24px); } }
.comp-tank {
  position: relative; width: 100%; height: 100%; border: 2px solid #94a3b8; border-radius: 8px;
  overflow: hidden; background: #f8fafc;
}
.comp-tank.no-border { border-color: transparent; }
.comp-tank-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0%; transition: height .35s ease;
  background: #38bdf8; opacity: .85;
}
.comp-tank-percent {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #0f172a;
}
.comp-command {
  width: 100%; height: 100%; border-radius: 10px; border: 1px solid var(--line);
  background: #f8fafc; color: #334155; font-size: 12px; cursor: pointer; display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.comp-command:disabled { cursor: not-allowed; opacity: .65; }
.comp-command span { display: none; }
.comp-history {
  width: 100%; height: 100%; display: flex; flex-direction: column; gap: 2px;
  border: 1px solid #e5eaf2; border-radius: 8px; background: #fff; padding: 6px 8px;
}
.comp-history-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.comp-history-title { font-size: 12px; color: #475467; font-weight: 600; }
.comp-history-svg { flex: 1; width: 100%; min-height: 0; }
.comp-alarm {
  width: 100%; height: 100%; display: flex; flex-direction: column; gap: 4px;
  border: 1px solid #e5eaf2; border-radius: 8px; background: #fff; padding: 8px;
}
.comp-alarm-body {
  flex: 1; display: flex; align-items: center; justify-content: center; border-radius: 6px;
  background: #f1f5f9; color: #fff; font-size: 14px; font-weight: 600;
}
.comp-alarm-gear { text-align: right; }
.comp-alarm-image {
  position: relative; background: #f8fafc; border: 1px solid #e5eaf2; border-radius: 8px;
  overflow: hidden; padding: 0;
}
.comp-alarm-gear-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.comp-alarm-image .comp-alarm-label {
  position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(255, 255, 255, .85);
}

/* ---------- W8-357 C-c 元素能力 + C1 控件级绑定 ---------- */
.comp-binding-box {
  margin: 8px 0; padding: 8px; border: 1px solid #dbeafe; border-radius: 8px; background: #f8fbff;
}
.comp-binding-title { font-size: 12px; font-weight: 600; color: #1d4ed8; margin-bottom: 6px; }
.comp-bind-badge {
  position: absolute; right: 2px; bottom: 2px; z-index: 2; padding: 0 4px; border-radius: 4px;
  font-size: 9px; line-height: 14px; background: rgba(148, 163, 184, .85); color: #fff; pointer-events: none;
  max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.comp-bind-badge.inherit { background: rgba(59, 130, 246, .82); }
.comp-bind-badge.bound { background: rgba(16, 185, 129, .85); }
.comp-widget.locked { outline: 1px dashed #f59e0b; }
.comp-widget.locked::after {
  content: "锁"; position: absolute; left: 2px; top: 2px; z-index: 2;
  font-size: 9px; padding: 0 3px; border-radius: 3px; background: #f59e0b; color: #fff; pointer-events: none;
}
.comp-handle {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand); z-index: 20;
}
.comp-handle-rotate { transform: translate(-50%, -50%); cursor: grab; }
.comp-handle-opacity { transform: translate(-50%, -50%); cursor: ns-resize; border-color: #f59e0b; }
.comp-context-menu {
  position: fixed; z-index: 1200; min-width: 160px; padding: 4px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
  font-size: 12px;
}
.comp-context-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 6px 10px; border-radius: 6px; cursor: pointer; color: #334155;
}
.comp-context-menu button:hover { background: var(--brand-soft); color: var(--brand-dark); }
.comp-context-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* ---------- W8-358 气象要素：风向玫瑰 + 气象卡片预设 ---------- */
.comp-weather-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: 100%; }
.comp-weather-item {
  display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fbfcfe;
  border-radius: 8px; padding: 5px 7px; cursor: grab; font-size: 11.5px; color: #334155;
}
.comp-weather-item img {
  width: 26px; height: 26px; object-fit: contain; flex: 0 0 auto;
  background: #0b1f33; border: 1px solid #1b5a86; border-radius: 6px; padding: 2px;
}
.comp-weather-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.comp-windrose {
  position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
}
.comp-windrose-svg { width: 100%; height: 100%; display: block; }
.comp-windrose-pointer { transform-box: view-box; }
.comp-windrose-value {
  position: absolute; left: 0; right: 0; bottom: 2px; text-align: center;
  font-size: 28px; font-weight: 700; color: #bde6ff; line-height: 1.1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55); pointer-events: none;
}
.comp-windrose.minimal .comp-windrose-value { position: absolute; bottom: 6px; font-size: 24px; }
.comp-widget .cw-value-line { display: flex; align-items: baseline; gap: 6px; }
.comp-widget.value .cw-label { margin: 0; }
.comp-widget.value .cw-unit { opacity: .9; }

/* ---------- W8-356 C-b 第二波：框选/组合、switch 自定义图、history 多序列、alarm table/scroll、47 图形 ---------- */
.comp-marquee {
  position: absolute; border: 1px dashed var(--brand); background: rgba(14, 165, 233, .08);
  pointer-events: none; z-index: 9;
}
.comp-widget.selected { border-color: #4f9bff; box-shadow: 0 0 0 2px rgba(79, 155, 255, .18); z-index: 3; }
.comp-check-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin: 2px 8px 2px 0; }
.comp-series-picker {
  max-height: 120px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px;
}
.comp-switch-custom { position: relative; background: transparent; border: 0; }
.comp-switch-custom img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none;
}
.comp-switch-custom[data-switch-state="on"] .comp-switch-img-on { display: block; }
.comp-switch-custom[data-switch-state="off"] .comp-switch-img-off { display: block; }
.comp-shape-img { pointer-events: none; }
.comp-history-export {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 2px 8px;
  font-size: 11px; color: #0369a1; cursor: pointer;
}
.comp-history-legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: #64748b; }
.comp-history-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.comp-history-legend-item i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.comp-history-legend-item em { font-style: normal; font-size: 10px; color: #9aa7b8; }
.comp-history-legend-item.right-axis em { color: #f2994a; }
.comp-alarm-table {
  width: 100%; height: 100%; display: flex; flex-direction: column; gap: 4px;
  border: 1px solid #e5eaf2; border-radius: 8px; background: #fff; padding: 6px; font-size: 11px;
}
.comp-alarm-table-head, .comp-alarm-row {
  display: grid; gap: 4px; align-items: center;
}
.comp-alarm-table-head { font-weight: 600; color: #475467; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.comp-alarm-table-head span, .comp-alarm-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-alarm-table-body { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.comp-alarm-row { padding: 2px 0; border-bottom: 1px dashed #eef2f7; color: #334155; }
.comp-alarm-table-pager { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.comp-alarm-filter { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.comp-alarm-range {
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 11px;
  background: #fff; color: #475467;
}
.comp-alarm-page {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 2px 8px; font-size: 11px; cursor: pointer;
}
.comp-alarm-page:disabled { opacity: .5; cursor: not-allowed; }
.comp-alarm-scroll {
  width: 100%; height: 100%; overflow: hidden; border: 1px solid #e5eaf2; border-radius: 8px;
  background: #fff; padding: 6px; font-size: 12px;
}
.comp-alarm-scroll-track { animation: compAlarmScroll linear infinite; }
@keyframes compAlarmScroll { from { transform: translateY(0); } to { transform: translateY(-50%); } }
.comp-alarm-scroll-row { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px dashed #eef2f7; color: #334155; }
.comp-md-device { border: 1px solid #e5eaf2; border-radius: 8px; padding: 6px; margin-bottom: 6px; background: #fbfdff; }
.comp-md-device-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.comp-md-remove {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 1px 8px;
  font-size: 11px; color: #b42318; cursor: pointer;
}
.comp-alarm-scroll-time { color: #94a3b8; flex: 0 0 auto; }
.comp-shape-item img { width: 100%; height: 34px; object-fit: contain; }

/* ---------- W8-5 固件升级 ---------- */
.check-list {
  display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.check-list .check-row { display: flex; padding: 3px 0; }
/* ---------- W8-6 计算规则 ---------- */
.check-item { display: flex; gap: 6px; align-items: flex-start; padding: 3px 0; font-size: 13px; }
.check-item input[type="checkbox"] { width: auto; flex: 0 0 auto; margin-top: 2px; }
.check-item > span { flex: 1; }
.field input[type="checkbox"] { width: auto; flex: 0 0 auto; }
/* ---------- W8-7 边缘运行时 ---------- */
.token-box {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: #f7f9fc; word-break: break-all; user-select: all;
}
.code-block {
  margin: 0; padding: 10px; border-radius: 6px; background: #0f172a; color: #dbeafe;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px;
  line-height: 1.55; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
/* ---------- W8-8 实时计算流程画布 ---------- */
.flow-canvas {
  position: relative; height: 430px; margin-top: 12px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 8px;
  background-color: #fbfcfe;
  background-image: radial-gradient(#d7e0ea 1px, transparent 1px);
  background-size: 18px 18px;
}
.flow-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.flow-node {
  position: absolute; width: 250px; background: #fff; border: 1px solid #cfd9e5;
  border-radius: 8px; box-shadow: 0 6px 18px rgba(20, 40, 70, .08);
}
.flow-node.flow-function { width: 300px; }
.flow-node.flow-output { width: 230px; }
.flow-node-head {
  padding: 8px 10px; font-size: 12.5px; font-weight: 650; color: #24425f;
  background: #f0f5fb; border-bottom: 1px solid #dce6f0; border-radius: 8px 8px 0 0;
  cursor: move; user-select: none;
}
.flow-node-body { padding: 10px; }
.flow-node .field { margin-bottom: 8px; }
.flow-node .field input, .flow-node .field select { width: 100%; }
.flow-node .field input[type="checkbox"] { width: auto; flex: 0 0 auto; }
.flow-stage { border: 1px solid #e2e9f3; border-radius: 7px; padding: 7px; margin-bottom: 7px; background: #f8faff; }
.flow-stage-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #5b6b83; margin-bottom: 5px; }
.flow-stage .flow-stage-expr { width: 100%; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.flow-function .flow-node-body { max-height: 470px; overflow-y: auto; }
.dag-palette { display: flex; align-items: center; gap: 6px; margin: 10px 0 8px; }
.dag-toolbar { display: flex; align-items: center; gap: 6px; margin: 0 0 8px;
  padding: 5px 8px; background: #f4f8ff; border: 1px solid #e2eaf6; border-radius: 8px; }
.dag-toolbar .btn { padding: 3px 8px; }
.dag-sep { width: 1px; height: 18px; background: #d8e2f0; margin: 0 3px; }
.dag-marquee { position: absolute; z-index: 4; border: 1px dashed #4f7fc4;
  background: rgba(79, 127, 196, .10); pointer-events: none; }
.dag-node.selected { border-color: #2f6fd0; box-shadow: 0 0 0 2px rgba(47, 111, 208, .25), 0 2px 8px rgba(30, 55, 90, .08); }
.brand-logo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 12px; }
.dag-canvas { position: relative; height: 470px; border: 1px solid #dbe4f0; border-radius: 10px;
  background: #f7faff radial-gradient(#dfe8f5 1px, transparent 1px); background-size: 18px 18px; overflow: hidden; }
.dag-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  transform-origin: 0 0; }
#dagNodes { position: absolute; inset: 0; transform-origin: 0 0; }
.dag-node { position: absolute; width: 176px; background: #fff; border: 1px solid #d8e2f0;
  border-radius: 8px; box-shadow: 0 2px 8px rgba(30, 55, 90, .08); z-index: 2; }
.dag-node-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 7px;
  font-size: 12px; color: #40526b; background: #f2f6fc; border-bottom: 1px solid #e5ecf6;
  cursor: move; border-radius: 8px 8px 0 0; }
.dag-node-body { padding: 6px; }
.dag-node-body .ctl { width: 100%; font-size: 12px; }
.dag-node.dag-condition { border-color: #f0c98c; }
.dag-node.dag-output { border-color: #9fd6b4; }
.dag-port { position: absolute; width: 11px; height: 11px; border-radius: 50%;
  background: #fff; border: 2px solid #4f7fc4; cursor: crosshair; z-index: 3; }
.dag-in { left: -6px; top: 34px; }
.dag-out { right: -6px; top: 34px; background: #4f7fc4; }
.dag-out.dag-true { top: 24px; background: #2f9e63; border-color: #2f9e63; }
.dag-out.dag-false { top: 48px; background: #d8822a; border-color: #d8822a; }
.dag-edge-hit { fill: none; stroke: transparent; stroke-width: 12; pointer-events: stroke; cursor: pointer; }
.dag-edge-line { fill: none; stroke: #6b86a8; stroke-width: 1.8; }
.dag-edge-line.true { stroke: #2f9e63; }
.dag-edge-line.false { stroke: #d8822a; }
.dag-edge-label { font-size: 10px; fill: #6b7c94; }
/* ---------- W8-9 远程连接视图 ---------- */
.remote-tabs {
  display: flex; gap: 2px; margin: 4px 0 12px; border-bottom: 1px solid var(--line);
}
.remote-tab {
  border: 0; background: transparent; padding: 8px 14px; font-size: 13px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
}
.remote-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }
.remote-tab:hover { color: var(--ink); }
.inline-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.remote-screen-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.remote-screen-grid.layout-1 { grid-template-columns: minmax(0, 1fr); }
.remote-screen-grid.layout-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.remote-screen-card { border: 1px solid #22344d; border-radius: 8px; overflow: hidden; background: #0f172a; }
.remote-screen-head {
  display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px;
  background: #17233a; color: #dbeafe; font-size: 12px;
}
.remote-screen-body {
  height: 150px; display: flex; align-items: center; justify-content: center;
  color: #7f93ad; font-size: 12.5px; letter-spacing: .3px;
  background: repeating-linear-gradient(45deg, #0f172a, #0f172a 9px, #121c30 9px, #121c30 18px);
}
.remote-screen-frame { width: 100%; height: 252px; border: 0; display: block; background: #000; }
.remote-screen-grid.layout-1 .remote-screen-frame { height: 420px; }
.remote-screen-grid.layout-2 .remote-screen-frame { height: 252px; }
.remote-screen-grid.layout-4 .remote-screen-frame { height: 190px; }
.rule-expr {
  display: inline-block; font-size: 12px; padding: 1px 5px; border-radius: 4px;
  background: #f3f6f9; color: #1f4f7a; word-break: break-all;
}
/* W8-47 站内消息 */
.notify-btn { position: relative; }
.notify-badge { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 9px; background: #e05a4f; color: #fff; font-size: 11px;
  line-height: 16px; text-align: center; font-weight: 600; }
.notify-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.notify-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.notify-item.unread { border-left: 3px solid #4f9bff; background: #f7fbff; }
.notify-item .n-title { font-weight: 600; }
.notify-item .n-body { color: #52637a; font-size: 13px; margin-top: 3px; }
.notify-item .n-time { color: #8a9bb2; font-size: 12px; margin-top: 4px; }
/* W8-55c 产品行内「更多」与连接参数表单 */
.more { display: inline-block; position: relative; }
.more > summary { list-style: none; display: inline-block; cursor: pointer; color: var(--brand);
  font-size: 12px; padding: 3px 5px; }
.more > summary::-webkit-details-marker { display: none; }
.more[open] > summary { text-decoration: underline; }
.more-menu { display: flex; flex-direction: column; align-items: flex-start; padding: 2px 0 2px 10px; }
.more-menu button { font-size: 12px; }
.conn-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.conn-sample { background: #0f172a; color: #d7e3f4; border-radius: 8px; padding: 10px 12px;
  font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; white-space: pre-wrap;
  word-break: break-all; margin-top: 6px; }
.mapping-cell { color: var(--brand); cursor: pointer; font-size: 12px; }
.mapping-cell.empty { color: #9aa7b8; }
.icon-input { width: 46px; text-align: center; }

/* W8-53 监控中心左栏：搜索 / 状态页签 / 分页 / 设备组管理 */
.dev-side-head { display: flex; align-items: center; gap: 8px; margin: 0 8px 8px; }
.dev-side-head h2 { margin: 0; }
.dev-side-head .link-btn { margin-left: auto; font-size: 11.5px; }
.dev-search { width: 100%; height: 30px; margin-bottom: 8px; }
.dev-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.dev-tab { flex: 1; border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 7px; padding: 6px 4px; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.dev-tab .cnt { display: inline-block; min-width: 16px; margin-left: 2px; padding: 0 4px;
  border-radius: 8px; background: #eef2f8; color: #5b6675; font-size: 11px; font-variant-numeric: tabular-nums; }
.dev-tab.active { background: var(--brand-soft); border-color: #cfe1ff; color: var(--brand); font-weight: 600; }
.dev-tab.active .cnt { background: #dbe8ff; color: var(--brand); }
.dev-pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 4px 2px;
  border-top: 1px solid var(--line); margin-top: 6px; }
.dev-pager .link-btn[disabled] { color: #b6c1d0; cursor: not-allowed; text-decoration: none; }
.dev-pager select { height: 24px; font-size: 11.5px; padding: 0 4px; margin-left: auto; }
.device-item .alarm-tag { background: var(--bad-soft); color: var(--bad); border-radius: 999px;
  padding: 0 6px; font-size: 10.5px; font-weight: 600; }
.device-item .tag-stack { margin-top: 3px; display: flex; gap: 6px; align-items: center; }

/* W8-53：左栏内部滚动，分页条固定在底部（不被设备列表挤出去） */
.dev-side { display: flex; flex-direction: column; overflow: hidden; }
.dev-side-head, .dev-search, .dev-tabs, .dev-pager { flex: 0 0 auto; }
.dev-side #deviceList { flex: 1 1 auto; min-height: 0; overflow: auto; }
.dev-tab { font-size: 11px; padding: 6px 3px; }

/* W8-54 企业概览：推送分析 / 周期指标 / 省份与使用时长 */
.t-devices-active { background: #8a63d2; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.metric { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: #fbfcfe; }
.metric .m-label { font-size: 11.5px; color: var(--muted); }
.metric .m-value { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.metric .m-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.metric.alarm { border-color: #f0b7b7; background: #fff8f8; }
.metric.alarm .m-value { color: var(--bad); }
@media (max-width: 1100px) { .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

@media (max-width: 900px) {
  body:not(.portal-mode) .topbar {
    height: auto; min-height: 52px; flex: 0 0 auto; padding: 6px 10px; gap: 6px; flex-wrap: wrap;
  }
  body:not(.portal-mode) .brand { font-size: 14px; }
  body:not(.portal-mode) .brand small,
  body:not(.portal-mode) #crumb,
  body:not(.portal-mode) #tenantPill,
  body:not(.portal-mode) #refreshHint { display: none; }
  body:not(.portal-mode) .topbar .pill { font-size: 10.5px; padding: 2px 7px; }
  body:not(.portal-mode) .topbar .btn { padding: 5px 8px; font-size: 11.5px; }

  body:not(.portal-mode) .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    padding-bottom: 60px;
  }

  /* 一级菜单：底部横向导航（W8-368：恢复固定宽可左右滑动，不做 flex 均分挤压） */
  body:not(.portal-mode) .rail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    height: 58px; flex-direction: row; align-items: stretch;
    justify-content: flex-start; padding: 0; gap: 0;
    overflow-x: auto; overflow-y: hidden;
    border-top: 1px solid #24344d;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  body:not(.portal-mode) .rail::-webkit-scrollbar { display: none; width: 0; height: 0; }
  body:not(.portal-mode) .rail-item { flex: 0 0 54px; width: 54px; height: 58px; }
  body:not(.portal-mode) .rail-item svg { width: 19px; height: 19px; }
  body:not(.portal-mode) .rail-item .rail-label { display: none; }
  body:not(.portal-mode) .rail-item.active::after {
    top: auto; bottom: 0; left: 8px; right: 8px; width: auto; height: 3px;
    border-radius: 2px 2px 0 0;
  }

  /* W8-364：二级菜单恢复单行横滑（与底部一级图标栏对称；高度紧凑、不换行） */
  body:not(.portal-mode) .subnav {
    position: relative; display: block; width: 100%; max-width: none;
    overflow: hidden; white-space: nowrap;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 7px 10px; background: #fff;
  }
  body:not(.portal-mode) #subnavItems {
    display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;
    gap: 4px; width: 100%; height: 44px;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    /* W8-362：可滚动但隐藏滚动条 */
    scrollbar-width: none; -ms-overflow-style: none;
  }
  body:not(.portal-mode) #subnavItems::-webkit-scrollbar { display: none; width: 0; height: 0; }
  /* W8-364：左右边缘渐变提示可继续滑动（到端点自动隐藏） */
  body:not(.portal-mode) .subnav::before,
  body:not(.portal-mode) .subnav::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 26px; z-index: 2;
    pointer-events: none; opacity: 0; transition: opacity .15s ease;
  }
  body:not(.portal-mode) .subnav::before {
    left: 0; background: linear-gradient(to right, rgba(255,255,255,.98), rgba(255,255,255,0));
  }
  body:not(.portal-mode) .subnav::after {
    right: 0; background: linear-gradient(to left, rgba(255,255,255,.98), rgba(255,255,255,0));
  }
  body:not(.portal-mode) .subnav.subnav-scrollable:not(.subnav-at-left)::before { opacity: 1; }
  body:not(.portal-mode) .subnav.subnav-scrollable:not(.subnav-at-right)::after { opacity: 1; }
  body:not(.portal-mode) .subnav-title { display: none; }
  body:not(.portal-mode) .subnav-item {
    width: auto; flex: 0 0 auto; padding: 6px 11px; border-radius: 14px;
    font-size: 12px; line-height: 1.25; white-space: nowrap; box-shadow: none; background: #f4f6fa;
    scroll-snap-align: center;
  }
  body:not(.portal-mode) .subnav-item.active {
    background: var(--brand); color: #fff; box-shadow: none;
  }

  body:not(.portal-mode) .content { padding: 10px 10px 20px; }
  body:not(.portal-mode) .page-head { flex-wrap: wrap; gap: 8px; }
  body:not(.portal-mode) .page-head h1 { font-size: 17px; }
  body:not(.portal-mode) .page-head .actions {
    margin-left: 0; width: 100%; overflow-x: auto; padding-bottom: 2px;
  }
  body:not(.portal-mode) .page-head .actions .btn { flex: 0 0 auto; }

  body:not(.portal-mode) .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  body:not(.portal-mode) .stat-grid,
  body:not(.portal-mode) .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  body:not(.portal-mode) .stat-card { padding: 10px 12px; min-width: 0; }
  body:not(.portal-mode) .stat-value { font-size: 22px; overflow-wrap: anywhere; }
  body:not(.portal-mode) .stat-label, body:not(.portal-mode) .stat-sub { overflow-wrap: anywhere; }
  body:not(.portal-mode) .grid-2 { grid-template-columns: minmax(0, 1fr) !important; }
  body:not(.portal-mode) .sensor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  /* W8-439：门户与后台一致——宽表在 .panel 内横滑，不把整个内容区顶宽（门户此前会整页横滑）。
     min-width:0 防止 .panel 作为 grid 子项时被表格的 min-content 撑破。 */
  .panel { overflow-x: auto; min-width: 0; }
  body:not(.portal-mode) table.grid { min-width: 680px; }
  body:not(.portal-mode) .modal { padding: 8px; }
  body:not(.portal-mode) .modal-card { width: calc(100vw - 16px) !important; max-height: 92vh; }
  body:not(.portal-mode) .card-head { flex-wrap: wrap; gap: 6px; }
  body:not(.portal-mode) .toolbar { padding: 8px; gap: 6px; }
  body:not(.portal-mode) .toolbar .ctl { max-width: 100%; }

  /* 手机端监控大屏：设备列表不再被 200px 侧栏压到只剩一行；给明确的设备切换下拉。 */
  body:not(.portal-mode) .dev-side, body.portal-mode .dev-side { max-height: none; }
  body:not(.portal-mode) #deviceList, body.portal-mode #deviceList { max-height: 240px; }
  .device-head { flex-wrap: wrap; }
  .mobile-device-switch { display: block; width: 100%; height: 36px; margin: 0 0 8px; }

  /* 底部一级菜单补文字，避免只有图标、用户不知道点哪个；W8-368：固定 54px 宽、可横滑 */
  body:not(.portal-mode) .rail-item {
    flex: 0 0 54px; width: 54px; height: 58px; flex-direction: column; justify-content: center;
    gap: 1px; padding-top: 4px;
  }
  body:not(.portal-mode) .rail-item .rail-label {
    position: static; transform: none; opacity: 1; pointer-events: none; display: block;
    background: none; color: inherit; padding: 0; border-radius: 0;
    font-size: 9px; line-height: 1.1; max-width: 60px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
}

/* ---------- W8-441（S9 补强）：窄屏触控尺寸 ----------
   范围：只在这里的 ≤900px 媒体查询内抬高内容区可点元素，>900px（桌面/平板横屏）零改动。
   目标：可点高度/宽度 ≥24px（统一 28px），只加 padding/min-height/min-width，不压缩字号。
   为什么不用 (pointer:coarse)：桌面窗口缩到 <900px 时同样需要可点（且触摸仿真下媒体查询
   行为随浏览器实现而异），用现有移动断点与 W8-368/W8-364/W8-439 的窄屏规则保持一致。 */
@media (max-width: 900px) {
  .content .btn,
  .content .link-btn,
  .content summary.link-btn,
  .content .dev-tab {
    min-height: 28px;
    min-width: 28px;
  }
  /* 行内文字按钮（表格操作列 / 页签 / 分页 / 图表工具）：原 3px 5px 只有 ~20px 高，
     上下补到 5px + line-height 即可达 28px；左右 8px 让相邻按钮不粘连。
     nowrap：表格列被挤窄时按钮文字不得折行——折行会把行高撑到几百像素（产品列表 9 列时
     操作列只剩 ~50px 宽，6 个按钮各折 2–3 行），横滑由 .panel 负责。 */
  .content .link-btn,
  .content summary.link-btn { padding: 5px 8px; white-space: nowrap; }
  .content .dev-tab { padding-top: 6px; padding-bottom: 6px; }
  /* 表格仍在 .panel 内横滑（W8-439），这里只给行内按钮之间留 2px 间距 */
  .content .link-btn + .link-btn { margin-left: 2px; }
}

@media (max-width: 360px) {
  body:not(.portal-mode) .stat-grid,
  body:not(.portal-mode) .metric-grid,
  body:not(.portal-mode) .sensor-grid { grid-template-columns: minmax(0, 1fr) !important; }
}


/* W8-57 账号设置：账户安全摘要行 */
.kv-list { display: flex; flex-direction: column; }
.kv-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv-row:last-child { border-bottom: 0; }
.kv-label { color: var(--muted); font-size: 12px; }
.kv-value { color: var(--text); }

/* W8-81 图标素材库 */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.icon-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.icon-thumb { height: 96px; display: flex; align-items: center; justify-content: center; background: #f7f9fc; border-radius: 8px; }
.icon-thumb img { max-width: 88px; max-height: 88px; object-fit: contain; }
.icon-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-meta { font-size: 11.5px; color: var(--muted); }
.icon-actions { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.icon-pick { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.icon-pick img { width: 44px; height: 44px; object-fit: contain; }
.icon-pick span { font-size: 11px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* W8-84 连接设置弹窗重排 */
.conn-hero { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: linear-gradient(135deg, #f5f9ff, #eef4ff); border: 1px solid #dbe7fa; border-radius: 12px; margin-bottom: 14px; }
.conn-hero-icon { width: 44px; height: 44px; border-radius: 12px; background: #2377e6; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; letter-spacing: .5px; flex: none; }
.conn-hero-main { flex: 1; min-width: 0; }
.conn-hero-name { font-weight: 600; font-size: 15px; }
.conn-hero-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 12px; color: var(--muted); }
.conn-hero-hint { font-size: 12px; color: var(--muted); max-width: 220px; text-align: right; }
.conn-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.conn-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.conn-section { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.conn-section-title { font-weight: 600; font-size: 13.5px; margin-bottom: 10px; }
.conn-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.conn-section-head .conn-section-title { margin: 0; }
.conn-section-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.conn-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.conn-grid-2 .full { grid-column: 1 / -1; }
.conn-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 12px; }
.conn-side-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fbfcff; }
.conn-side-head { display: flex; align-items: center; justify-content: space-between; }
.conn-side-title { font-weight: 600; font-size: 13px; }
.conn-summary { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.conn-summary-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.conn-summary-row span { color: var(--muted); flex: none; }
.conn-summary-row b { font-weight: 500; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-json { background: #0f172a; color: #dbeafe; border-radius: 8px; padding: 10px; font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; max-height: 180px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
@media (max-width: 900px) {
  .conn-layout { grid-template-columns: 1fr; }
  .conn-side { position: static; }
  .conn-grid-2 { grid-template-columns: 1fr; }
  .conn-hero-hint { display: none; }
}
.field label .req{color:#d92d20;margin-right:2px}

/* W8-439：窄屏提示浮层（顶栏 #refreshHint 在 ≤900px 被隐藏，notify 文案要有可见出口）。
   桌面端 #refreshHint 可见且本浮层 display:none，行为与样式均不变。 */
.app-toast {
  position: fixed; left: 12px; right: 12px; bottom: 70px; z-index: 95;
  padding: 10px 12px; border-radius: 10px; background: rgba(17, 24, 39, .94); color: #fff;
  font-size: 13px; line-height: 1.45; box-shadow: 0 8px 22px rgba(15, 23, 42, .28);
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.app-toast.show { opacity: 1; transform: none; }
.app-toast.err { background: rgba(153, 27, 27, .95); }
@media (min-width: 901px) { .app-toast { display: none; } }

/* W8-275F：点位表单按协议分区（Modbus 采集参数 / 协议地址互斥） */
.form-section { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fbfcff; margin-top: 12px; }
.form-section-title { font-weight: 600; font-size: 13.5px; margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.form-section-title .small { font-weight: 400; }
.form-section .form-grid { margin-bottom: 0; }

/* W8-275F：设备详情信息条 / 分区折叠 / 接收指令浮动面板 */
.device-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 16px; background: #eff6ff; border: 1px solid #dbeafe; border-radius: 10px; margin-bottom: 12px; }
.device-hero .kv { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--muted); }
.device-hero .kv b { color: var(--ink); font-weight: 600; font-size: 13px; }
.device-hero .spacer { flex: 1; }
.detail-fold > summary { list-style: none; cursor: pointer; padding: 10px 0; margin: 0; display: flex; align-items: baseline; gap: 8px; }
.detail-fold > summary::-webkit-details-marker { display: none; }
.detail-fold > summary::before { content: '▸'; color: var(--muted); display: inline-block; transition: transform .15s; }
.detail-fold[open] > summary::before { transform: rotate(90deg); }
.detail-fold-body { padding-bottom: 8px; }
.receive-float { position: fixed; right: 16px; bottom: 16px; width: 540px; max-height: 680px; z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .16); display: flex; flex-direction: column; }
.receive-float:not(.open) { width: 250px; }
.receive-float:not(.open) .receive-float-body { display: none; }
.receive-float-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.receive-float:not(.open) .receive-float-head { border-bottom: 0; }
.receive-float-title { font-weight: 600; font-size: 13px; white-space: nowrap; flex: none; }
.receive-float-head .btn { white-space: nowrap; flex: none; }
.receive-float:not(.open) .receive-float-sub { display: none; }
.receive-float-body { overflow: auto; padding: 10px 12px 12px; }
.receive-float-open { position: fixed; right: 16px; bottom: 16px; z-index: 40; }
.receive-float[hidden] { display: none !important; }
.receive-block + .receive-block { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.receive-block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.receive-block-title { font-size: 13px; font-weight: 600; color: var(--text, #1f2937); }
.receive-radio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted, #667085); white-space: nowrap; }
.receive-console { background: #0b0f14; color: #e6edf3; border: 1px solid #1f2937; border-radius: 6px; min-height: 144px; max-height: 210px; overflow: auto; padding: 8px 10px; font-size: 12px; line-height: 1.6; }
.receive-empty { color: #8b949e; padding: 8px 2px; }
.receive-line { display: flex; align-items: baseline; gap: 8px; padding: 2px 0; border-bottom: 1px dotted #1f2937; }
.receive-line:last-child { border-bottom: 0; }
.receive-line-time { color: #8b949e; flex: none; white-space: nowrap; }
.receive-line-dir { color: #58a6ff; flex: none; }
.receive-line-text { word-break: break-all; white-space: pre-wrap; }
.receive-line-vals { margin-left: auto; color: #7ee787; flex: none; font-size: 11px; }
.receive-send-input { width: 100%; min-height: 90px; max-height: 160px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.receive-options { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted, #667085); }
.receive-options label { display: inline-flex; align-items: center; gap: 4px; }
.receive-footer { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.label-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; padding: 8px; border: 1px dashed var(--line); border-radius: 8px; background: var(--bg-soft, #f8fafc); }
.label-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.label-chip-text { font-size: 12px; }
.label-chip-btn { border: 0; background: transparent; color: var(--muted, #667085); cursor: pointer; font-size: 12px; padding: 1px 3px; border-radius: 4px; }
.label-chip-btn:hover { background: var(--bg-soft, #eef2f6); color: var(--text, #1f2937); }
.label-chip-btn.danger:hover { color: #d92d20; }
.label-palette { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.label-group + .label-group { margin-top: 8px; }
.label-group-title { font-size: 12px; color: var(--muted, #667085); margin-bottom: 4px; }
.label-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.label-tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.label-tag-header { background: #1890ff !important; border-color: #1890ff !important; color: #fff !important; }
.label-tag-trailer { background: #ff4d4f !important; border-color: #ff4d4f !important; color: #fff !important; }
.label-tag-delimiter, .label-tag-data { background: #fff; border-color: #d9d9d9; color: #252b3a; }
.label-chip-header { background: #108ee9; border-color: #108ee9; color: #fff; }
.label-chip-trailer { background: #cd201f; border-color: #cd201f; color: #fff; }
.label-chip-delimiter, .label-chip-data { background: #fafafa; border-color: #d9d9d9; color: #252b3a; }
.label-chip-header .label-chip-btn, .label-chip-trailer .label-chip-btn { color: rgba(255, 255, 255, .85); }
.label-chip-header .label-chip-btn:hover, .label-chip-trailer .label-chip-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.label-tag-unsupported { opacity: .6; border-style: dashed; }
.label-param { margin-top: 8px; padding: 8px; border: 1px solid var(--accent, #2563eb); border-radius: 8px; background: var(--bg-soft, #f8fafc); }
.label-param-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.label-param-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.label-rules { margin-top: 8px; }
.label-rules pre { max-height: 320px; overflow: auto; background: var(--bg-soft, #f8fafc); padding: 10px; border-radius: 8px; }
.product-sensor-table { table-layout: fixed; width: 100%; }
.product-sensor-table th, .product-sensor-table td { padding: 5px 4px; vertical-align: middle; }
.product-sensor-table .ctl { width: 100%; min-width: 0; box-sizing: border-box; }
.product-sensor-table th { white-space: nowrap; }
.form-section-divider { grid-column: 1 / -1; margin: 8px 0 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); font-size: 13px; font-weight: 600; color: #344054; }
.form-grid input:disabled, .form-grid select:disabled { background: #f2f4f7; color: #98a2b3; cursor: not-allowed; }
.coord-overlay { position: fixed; inset: 0; z-index: 1200; background: rgba(15, 23, 42, .35); display: flex; align-items: center; justify-content: center; padding: 24px; }
.coord-panel { width: min(860px, 96vw); background: #fff; border-radius: 12px; box-shadow: 0 18px 48px rgba(15, 23, 42, .28); overflow: hidden; }
.coord-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.coord-search-box { padding: 10px 14px 8px; border-bottom: 1px solid var(--line-soft); background: #f8fafc; }
.coord-search-row { display: flex; align-items: center; gap: 8px; }
.coord-search-row .ctl { flex: 1; min-width: 0; }
.coord-search-hint { margin-top: 6px; min-height: 16px; font-size: 12px; color: var(--muted, #667085); }
.coord-map { height: 460px; width: 100%; }
.coord-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted, #667085); }
@media (max-width: 720px) { .coord-overlay { padding: 10px; } .coord-map { height: 60vh; } .coord-search-row { flex-wrap: wrap; } .coord-search-row .ctl { flex-basis: 100%; } .coord-search-row .btn { flex: 1; } }
@media (max-width: 720px) {
  .receive-float { position: static; width: auto !important; max-height: none; margin-top: 12px; box-shadow: none; }
  .receive-float-open { position: static; margin-top: 8px; }
}

/* ---------- W8-360 二级菜单折叠 + 折叠态浮层（窄屏自动折叠） ---------- */
:root { --rail-w: 56px; --subnav-w: 200px; }
.nav-toggle {
  position: absolute; left: var(--rail-w, 56px); top: 10px; z-index: 25; width: 18px; height: 46px; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0;
  background: #fff; color: #5b6b84; font-size: 12px; line-height: 1; opacity: .85;
  transition: opacity .18s cubic-bezier(.2, 0, 0, 1), color .18s cubic-bezier(.2, 0, 0, 1);
}
.nav-toggle:hover { opacity: 1; color: var(--brand); background: #f6f9ff; }
.nav-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
body:not(.portal-mode).nav-collapsed .workspace { grid-template-columns: var(--rail-w, 56px) 0 minmax(0, 1fr); }
/* 折叠时 subnav 移出栅格流：必须把 content 固定在第 3 列，否则浏览器自动放置会把内容塞进 0px 的第 2 列（空白+横向滚动）。 */
body:not(.portal-mode).nav-collapsed .subnav { display: none; width: 0; overflow: hidden; padding: 0; border: 0; }
body:not(.portal-mode).nav-collapsed .content { grid-column: 3; }
body.portal-mode .nav-toggle { display: none; }

.subnav-float {
  position: fixed; z-index: 40; min-width: 172px; max-width: 220px; max-height: 72vh; overflow: auto;
  padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .18);
  opacity: 0; transform: translateX(-6px); pointer-events: none;
  transition: opacity .18s cubic-bezier(.2, 0, 0, 1), transform .18s cubic-bezier(.2, 0, 0, 1);
  /* W8-362：可滚动但隐藏滚动条 */
  scrollbar-width: none; -ms-overflow-style: none;
}
.subnav-float::-webkit-scrollbar { display: none; width: 0; height: 0; }
.subnav-float.open {
  opacity: 1; transform: none; pointer-events: auto;
  transition-duration: .12s;
}
/* W8-362：pin 住时阴影加重，提示浮层已固定 */
.subnav-float.pinned {
  border-color: var(--brand);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .26), 0 0 0 2px var(--brand-soft);
}
/* W8-362：rail 与浮层之间 8px 透明桥（配合 document mousemove 安全区） */
.subnav-float::before {
  content: ""; position: absolute; left: -8px; top: -12px; bottom: -12px; width: 8px;
  background: transparent; pointer-events: auto;
}
/* W8-362：浮层打开/固定的 rail 图标高亮 */
.rail-item.float-open { background: var(--brand-soft); color: var(--brand-dark); }
.subnav-float-title { padding: 4px 10px 8px; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.subnav-float .subnav-item { border-radius: 8px; padding: 8px 10px; }
.subnav-float .subnav-item.active { box-shadow: inset 3px 0 0 var(--brand); }

@media (prefers-reduced-motion: reduce) {
  .workspace, .nav-toggle, .subnav-float, .subnav-float.open { transition: none !important; }
}

@media (max-width: 900px) {
  body:not(.portal-mode) .workspace,
  body:not(.portal-mode).nav-collapsed .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  body:not(.portal-mode).nav-collapsed .subnav { display: block; }
  body:not(.portal-mode).nav-collapsed .content { grid-column: auto; }
  body.nav-collapsed .workspace { transition: none; }
  .nav-toggle { display: none; }
  .subnav-float { display: none; }
}

/* ---------- W8-361 组态运行页全屏 ---------- */
.comp-runtime-wrap:fullscreen,
.comp-runtime-wrap:-webkit-full-screen {
  background: #020c16; width: 100vw; height: 100vh; padding: 24px;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.comp-runtime-wrap:fullscreen .comp-runtime-stage,
.comp-runtime-wrap:-webkit-full-screen .comp-runtime-stage { margin: auto; }
.comp-runtime-wrap:fullscreen .comp-page-nav,
.comp-runtime-wrap:-webkit-full-screen .comp-page-nav { position: fixed; }
/* ---------- W8-412（S5）白标字段：轮播编辑 + 大屏 LOGO ---------- */
.brand-carousel-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.brand-carousel-item {
  position: relative; width: 168px; height: 96px; border: 1px dashed var(--line);
  border-radius: 8px; overflow: hidden; background: #fafcff;
  display: flex; align-items: center; justify-content: center;
}
.brand-carousel-item img { max-width: 100%; max-height: 100%; }
.brand-carousel-item .link-btn {
  position: absolute; top: 2px; right: 2px; background: rgba(255, 255, 255, .92);
  border-radius: 4px; font-size: 14px; line-height: 1;
}
#monitorView { position: relative; }
.screen-brand-logo {
  position: absolute; right: 18px; bottom: 14px; z-index: 6; pointer-events: none; opacity: .9;
}
.screen-brand-logo img { max-width: 180px; max-height: 46px; display: block; }
@media (max-width: 720px) {
  .screen-brand-logo { right: 10px; bottom: 8px; }
  .screen-brand-logo img { max-width: 120px; max-height: 34px; }
}
