*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #050a11;
  --cyan: #4fe0ff;
  --cyan-dim: #2a8fae;
  --amber: #ffb547;
  --green: #41e0a3;
  --line: rgba(74, 158, 224, 0.18);
  --line-soft: rgba(74, 158, 224, 0.09);
  --text: #d7e6f2;
  --dim: #7e94a8;
  --panel: linear-gradient(180deg, rgba(11, 27, 44, 0.88), rgba(6, 14, 24, 0.78));
}

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 700px at 50% 30%, #0a1826 0%, #050a11 60%, #03070c 100%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app {
  height: 100%;
  display: grid;
  grid-template-rows: 76px 1fr;
  gap: 8px;
  padding: 10px 12px 12px;
}

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(12, 32, 52, 0.9), rgba(6, 16, 26, 0.55));
  box-shadow: inset 0 -1px 0 rgba(79, 224, 255, 0.16);
  position: relative;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79, 224, 255, 0.55), transparent);
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.logo {
  width: 30px; height: 30px;
  border: 1px solid var(--cyan);
  border-radius: 3px;
  transform: rotate(45deg);
  position: relative;
  box-shadow: 0 0 14px rgba(79, 224, 255, 0.35);
  flex: none;
}
.logo::after {
  content: "";
  position: absolute; inset: 6px;
  background: var(--cyan);
  opacity: 0.65;
}

.brand-txt h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 3px;
  font-weight: 600;
  background: linear-gradient(180deg, #eaf8ff, #8ecdf0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-txt { min-width: 0; }
.brand-txt p { margin: 3px 0 0; font-size: 11px; color: var(--dim); letter-spacing: 1.6px; }
/* 后台可自定义标题，太长就省略，不去挤右边的统计和时钟 */
.brand-txt h1, .brand-txt p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 700px; }

.top-stats { display: flex; gap: 34px; }
.ts { display: flex; align-items: baseline; gap: 6px; font-size: 11px; color: var(--dim); }
.ts b { font-size: 21px; font-family: "DIN Alternate", "Bahnschrift", monospace; font-weight: 600; letter-spacing: 0.5px; }
.ts em { font-style: normal; color: var(--dim); }

.clock { justify-self: end; text-align: right; }
.clock b {
  display: block;
  font-size: 22px;
  font-family: "DIN Alternate", "Bahnschrift", monospace;
  letter-spacing: 1px;
  color: #dff4ff;
}
.clock span { font-size: 11px; color: var(--dim); letter-spacing: 1px; }

.c-cyan { color: var(--cyan); text-shadow: 0 0 12px rgba(79, 224, 255, 0.35); }
.c-amber { color: var(--amber); }
.c-green { color: var(--green); }

/* ---------------------------------------------------------------- 主体 */
.main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 0;
}

.col {
  width: 368px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.col:not(:has(> .card, > .mslot:not(:empty))) { display: none; }

/* ---------------------------------------------------------------- 卡片 */
.card {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.card::before,
.card::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  border: 1px solid rgba(79, 224, 255, 0.55);
  pointer-events: none;
}
.card::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; }
.card::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }

.card-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 8px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(90deg, rgba(79, 224, 255, 0.1), transparent 62%);
}

.card-hd h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 1.6px;
  color: #d5ecfa;
  position: relative;
  padding-left: 10px;
}
.card-hd h2::before {
  content: "";
  position: absolute;
  left: 0; top: 3px; bottom: 3px;
  width: 2px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.tag {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1px 6px;
  letter-spacing: 0.6px;
}
.tag.live { color: var(--green); border-color: rgba(65, 224, 163, 0.35); }
.tag.warn { color: var(--amber); border-color: rgba(255, 181, 71, 0.35); }

.card-bd { padding: 10px 12px 12px; overflow: hidden; }

/* ---------------------------------------------------------------- 数字块 */
.kpi-row { display: flex; gap: 10px; }
.kpi {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(20, 46, 72, 0.55), rgba(10, 22, 34, 0.35));
}
/* 4 格并排时收窄，数字用小一号，保证 300px 侧栏放得下 */
.kpi-row.tight { gap: 6px; }
.kpi-row.tight .kpi { padding: 6px 7px; }
.kpi-row.tight .kpi label { font-size: 10px; letter-spacing: 0.4px; }
.kpi-row.tight .kpi b.num { font-size: 17px; letter-spacing: 0; }
.kpi-row.tight .kpi b.num em { font-size: 10px; font-style: normal; color: var(--dim); margin-left: 1px; }

.pop-note {
  margin-top: 8px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--amber);
  background: rgba(255, 181, 71, 0.08);
  border-left: 2px solid rgba(255, 181, 71, 0.55);
}
.kpi label { display: block; font-size: 10.5px; color: var(--dim); letter-spacing: 0.8px; }
.kpi b {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  font-family: "DIN Alternate", "Bahnschrift", monospace;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* 性别条 */
.meter-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.mlabel { font-size: 10.5px; color: var(--dim); letter-spacing: 0.4px; white-space: nowrap; }
.gender {
  flex: 1;
  height: 7px;
  background: linear-gradient(90deg, rgba(255, 122, 176, 0.5), rgba(255, 122, 176, 0.5));
  position: relative;
  border-radius: 1px;
  overflow: hidden;
}
.gender.zero { background: rgba(255, 255, 255, 0.06); }
.gender .m {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #2f8dff, #57c8ff);
  box-shadow: 0 0 10px rgba(87, 200, 255, 0.5);
}

.sub-title {
  margin: 12px 0 6px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 1.2px;
  border-left: 2px solid var(--cyan-dim);
  padding-left: 7px;
}

/* 年龄条 */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bars li { display: grid; grid-template-columns: 62px 1fr 46px; align-items: center; gap: 8px; font-size: 11px; color: var(--dim); }
.bars .bar { height: 6px; background: rgba(255, 255, 255, 0.06); border-radius: 1px; overflow: hidden; }
.bars .bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, rgba(79, 224, 255, 0.35), var(--cyan));
  box-shadow: 0 0 8px rgba(79, 224, 255, 0.45);
}
.bars em { font-style: normal; text-align: right; color: #b9d4e6; font-family: "DIN Alternate", monospace; }

/* 入住率环 */
.house { display: flex; align-items: center; gap: 16px; }
.donut-wrap { position: relative; width: 104px; height: 104px; flex: none; }
.donut { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .d-bg { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 9; }
.donut .d-val {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 289;
  stroke-dashoffset: 36;
  filter: drop-shadow(0 0 6px rgba(79, 224, 255, 0.6));
  transition: stroke-dashoffset 1.2s ease;
}
.donut-txt {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-txt b { font-size: 20px; font-family: "DIN Alternate", monospace; color: #e8f8ff; }
.donut-txt span { font-size: 10px; color: var(--dim); }

.house-nums { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.house-nums div { border-left: 1px solid var(--line-soft); padding-left: 9px; }
.house-nums label { display: block; font-size: 10.5px; color: var(--dim); }
.house-nums b { font-size: 18px; font-family: "DIN Alternate", monospace; }

/* 进出折线 */
.flow { width: 100%; height: 112px; display: block; margin-top: 8px; }
.axis { display: flex; justify-content: space-between; font-size: 10px; color: #5f7386; margin-top: 2px; }

/* ---------------------------------------------------------------- 中间舞台 */
.stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: #070d14;
  min-height: 0;
}
.stage canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

.stage-top {
  position: absolute;
  z-index: 12;              /* canvas 是后插入的，没 z-index 会被盖住 */
  left: 16px; top: 12px;
  display: flex; align-items: center; gap: 9px;
  font-size: 11.5px;
  color: #b8d3e6;
  letter-spacing: 1px;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
.stage-top .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 1.8s infinite;
}
.stage-top .sep { width: 1px; height: 11px; background: var(--line); }
.stage-top .dim { color: var(--dim); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.stage-kpis {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: 50px;                 /* 让开左下角那排按钮 */
  transform: translateX(-50%);
  display: flex;
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.sk {
  padding: 8px 22px;
  background: rgba(8, 20, 32, 0.72);
  text-align: center;
  min-width: 118px;
}
.sk label { display: block; font-size: 10.5px; color: var(--dim); letter-spacing: 0.8px; }
.sk b { font-size: 20px; font-family: "DIN Alternate", monospace; color: #dff4ff; white-space: nowrap; }
.sk b em { font-style: normal; font-size: 11px; color: var(--dim); margin-left: 2px; }

.stage-hint {
  position: absolute;
  z-index: 12;
  right: 14px; bottom: 18px;
  font-size: 10.5px;
  color: #5c7387;
  letter-spacing: 1px;
  pointer-events: none;
}

/* ---------------------------------------------------------------- 监控 */
.cams { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cam { margin: 0; position: relative; }
.cam .feed {
  height: 72px;
  border: 1px solid rgba(79, 224, 255, 0.2);
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 30% 20%, #2c4356, #101c26 70%);
  position: relative;
  overflow: hidden;
}
.cam .feed::after {
  content: "";
  position: absolute;
  left: 0; right: 0; height: 40%;
  background: linear-gradient(180deg, transparent, rgba(79, 224, 255, 0.16), transparent);
  animation: scan 3.4s linear infinite;
}
.cam .feed.f2 { background: repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 3px), radial-gradient(120% 90% at 70% 30%, #33404f, #0f1a22 70%); }
.cam .feed.f3 { background: repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 3px), radial-gradient(120% 90% at 40% 60%, #1d3a34, #0c1618 70%); }
.cam .feed.f4 { background: repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 3px), radial-gradient(120% 90% at 60% 20%, #3a3550, #12101c 70%); }
@keyframes scan { from { top: -40%; } to { top: 100%; } }

.cam .cam-no {
  position: absolute;
  left: 5px; top: 3px;
  font-size: 8.5px;
  letter-spacing: 0.5px;
  font-style: normal;
  color: rgba(159, 220, 255, 0.5);
}
.cam figcaption {
  font-size: 10px;
  color: #8fa9bd;
  margin-top: 3px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cam-tip { margin-top: 8px; font-size: 10.5px; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.cam-tip i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 7px var(--amber); }

/* ---------------------------------------------------------------- 停车 */
.park-meter { display: flex; gap: 14px; }
.pm { flex: 1; }
.pm label { display: block; font-size: 10.5px; color: var(--dim); }
.pm b { font-size: 19px; font-family: "DIN Alternate", monospace; }
.pm b em { font-style: normal; font-size: 11px; color: var(--dim); }

.occ { height: 6px; background: rgba(255, 255, 255, 0.07); margin: 8px 0 10px; overflow: hidden; }
.occ i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #ffb547, #ff8a3d);
  box-shadow: 0 0 10px rgba(255, 181, 71, 0.5);
  transition: width 0.6s;
}

.tbl { width: 100%; border-collapse: collapse; font-size: 11px; }
.tbl th {
  text-align: left;
  font-weight: 400;
  color: #6b8296;
  font-size: 10.5px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line-soft);
  letter-spacing: 0.6px;
}
.tbl td { padding: 5px 0; border-bottom: 1px dashed rgba(74, 158, 224, 0.08); color: #b9d2e3; }
.tbl td:first-child { font-family: "DIN Alternate", monospace; color: #e2f4ff; letter-spacing: 0.6px; }
.tbl td:last-child { color: var(--dim); text-align: right; }

/* ---------------------------------------------------------------- 告警 */
.alarms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; max-height: 100%; overflow: hidden; }
.alarms li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  font-size: 11px;
  color: #b6cddd;
  padding-bottom: 7px;
  border-bottom: 1px dashed rgba(74, 158, 224, 0.08);
  animation: fadeIn 0.5s ease;
}
.alarms time { color: #647d92; font-family: "DIN Alternate", monospace; font-size: 10.5px; }
.alarms b { color: var(--amber); font-weight: 500; margin-right: 6px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 小屏兜底 */
@media (max-width: 1500px) {
  .col { width: 320px; }
  .brand-txt h1 { font-size: 18px; }
  .top-stats { gap: 20px; }
}

/* 加载提示 */
.loading {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 2px;
  color: #7fa6c0;
  background: rgba(6, 12, 18, 0.55);
  backdrop-filter: blur(2px);
  transition: opacity 0.5s;
  pointer-events: none;
}
.loading i {
  width: 12px; height: 12px;
  border: 1px solid rgba(79, 224, 255, 0.35);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loading.done { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.flow-foot {
  display: flex;
  gap: 1px;
  margin-top: 10px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
.flow-foot div { flex: 1; padding: 6px 8px; background: rgba(10, 24, 38, 0.5); }
.flow-foot label { display: block; font-size: 10px; color: var(--dim); letter-spacing: .6px; }
.flow-foot b { font-size: 14px; font-family: "DIN Alternate", monospace; color: #cfe9f8; }
.flow-foot b em { font-style: normal; font-size: 10px; color: var(--dim); }

/* ---------------------------------------------------------------- 住户查询 / 楼栋信息 */
.card-hd { position: relative; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  margin-left: 0; margin-right: 0;
  padding: 0;
  color: var(--cyan);
  background: rgba(15, 42, 64, 0.7);
  border: 1px solid rgba(79, 224, 255, 0.3);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.16s;
}
.icon-btn:hover { background: rgba(34, 90, 132, 0.75); border-color: var(--cyan); box-shadow: 0 0 10px rgba(79, 224, 255, 0.25); }

/* 查询浮层 */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 8, 14, 0.6);
  backdrop-filter: blur(3px);
}
.search-modal[hidden] { display: none; }
.sm-box {
  width: 380px;
  padding: 16px 18px 14px;
  border: 1px solid rgba(79, 224, 255, 0.35);
  background: linear-gradient(180deg, rgba(10, 26, 42, 0.98), rgba(5, 13, 22, 0.98));
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(79, 224, 255, 0.06);
}
.sm-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sm-hd b { font-size: 14px; letter-spacing: 1px; color: #cfeaff; font-weight: 600; }
.sm-close {
  width: 22px; height: 22px; padding: 0; line-height: 1;
  font-size: 18px; color: var(--dim); background: none; border: 0; cursor: pointer;
}
.sm-close:hover { color: #fff; }
.sm-input { display: flex; gap: 8px; }
.sm-input input {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
  background: rgba(4, 12, 20, 0.9);
  border: 1px solid var(--line);
  outline: none;
}
.sm-input input:focus { border-color: var(--cyan-dim); box-shadow: 0 0 0 2px rgba(79, 224, 255, 0.1); }
.sm-input button {
  width: 62px; height: 32px;
  font-size: 12px; letter-spacing: 1px;
  color: #04121c;
  background: linear-gradient(180deg, #59e6ff, #2fa8c8);
  border: 0; cursor: pointer;
  font-weight: 600;
}
.sm-input button:hover { filter: brightness(1.12); }
.sm-list { list-style: none; margin: 12px 0 0; padding: 0; max-height: 220px; overflow-y: auto; }
.sm-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  font-size: 12px;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 0.14s;
}
.sm-list li:hover { background: rgba(79, 224, 255, 0.08); border-left-color: var(--cyan); }
.sm-list li b { font-size: 13px; color: #d8f2ff; font-weight: 600; min-width: 52px; }
.sm-list li span { color: var(--dim); }
.sm-list li em { margin-left: auto; font-style: normal; color: var(--cyan); font-size: 11px; }
.sm-empty { padding: 14px 0; text-align: center; font-size: 12px; color: var(--dim); }
.sm-tip { margin: 10px 0 0; font-size: 11px; color: #5c7288; line-height: 1.6; }

/* 3D 上的定位标记 */
.pin {
  position: absolute;
  z-index: 12;
  transform: translate(-50%, -100%);
  pointer-events: none;
  transition: opacity 0.2s;
}
.pin[hidden] { display: none; }
.pin-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 12px;
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(10, 40, 62, 0.96), rgba(6, 20, 32, 0.96));
  border: 1px solid rgba(79, 224, 255, 0.55);
  box-shadow: 0 0 22px rgba(79, 224, 255, 0.3), 0 6px 18px rgba(0, 0, 0, 0.5);
}
.pin-card b { font-size: 14px; color: #eaf9ff; letter-spacing: 0.5px; }
.pin-card span { font-size: 11.5px; color: #7fd6f0; letter-spacing: 0.4px; }
.pin-tail {
  display: block;
  width: 1px; height: 26px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(79, 224, 255, 0.85), rgba(79, 224, 255, 0));
}

/* 楼栋信息 popup */
/* ================================================ dagushi 追加样式 */
.dim { color: var(--dim); }

/* 管理范围行 */
.range-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 11.5px;
  border-bottom: 1px dashed var(--line-soft);
}
.range-row span { flex: 0 0 52px; color: var(--dim); }
.range-row b { font-weight: 500; color: #cfe9f8; line-height: 1.5; }
.range-row b.dim { color: var(--dim); font-size: 11px; }

/* 空态 */
.empty-tip {
  padding: 26px 8px;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  border: 1px dashed var(--line-soft);
}
.empty-tip.sm { padding: 14px 8px; font-size: 11.5px; }

/* 舞台操作按钮 */
.stage-ctrl {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  gap: 6px;
  z-index: 12;
}
.cbtn {
  height: 26px;
  padding: 0 11px;
  font-size: 11.5px;
  letter-spacing: .5px;
  color: #9fc6dd;
  background: rgba(8, 22, 36, 0.78);
  border: 1px solid rgba(79, 224, 255, 0.28);
  cursor: pointer;
  transition: .15s;
}
.cbtn:hover { color: #e6f8ff; border-color: rgba(79, 224, 255, 0.6); }
.cbtn.on { color: #06202c; background: rgba(79, 224, 255, 0.85); border-color: transparent; }

/* 户册网格 */
.book-bd { display: flex; flex-direction: column; min-height: 0; flex: 1; padding-bottom: 10px; overflow-y: auto; }
.hg-head {
  display: grid;
  grid-template-columns: 24px repeat(3, 1fr);
  gap: 3px;
  font-size: 10px;
  color: var(--dim);
  letter-spacing: .5px;
  padding-bottom: 4px;
  text-align: center;
}
.hg-head span:first-child { text-align: left; }
.hg {
  display: grid;
  grid-template-columns: 24px repeat(3, 1fr);
  gap: 3px;
  flex: 1 1 auto;
  min-height: 0;
  grid-auto-rows: minmax(38px, 1fr);
}
.hg .fl {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 10px;
  color: var(--dim);
  font-family: "DIN Alternate", monospace;
}
.hcell {
  border: 1px solid var(--line-soft);
  background: rgba(20, 46, 72, 0.28);
  padding: 2px 4px;
  cursor: pointer;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  transition: .14s;
  overflow: hidden;
}
.hcell:hover { border-color: rgba(79, 224, 255, 0.7); background: rgba(30, 72, 108, 0.5); }
.hcell.sel { border-color: var(--cyan); background: rgba(40, 96, 140, 0.65); box-shadow: 0 0 0 1px rgba(79, 224, 255, .5) inset; }
.hcell.off { background: transparent; border-style: dashed; border-color: rgba(74, 158, 224, 0.16); }
.hcell .u {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 15px;
  font-size: 11px;
  line-height: 15px;
  white-space: nowrap;
  overflow: hidden;
}
.hcell .u i { font-style: normal; color: var(--dim); font-family: "DIN Alternate", monospace; flex: 0 0 auto; }
.hcell .u b { font-weight: 400; color: #d8eefb; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hcell .u b.na { color: #4c6a80; font-weight: 400; }
.hcell.off .u b.na { color: #3e5768; }

.hg-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 7px 0 6px;
  font-size: 10.5px;
  color: var(--dim);
  border-bottom: 1px dashed var(--line-soft);
}
.hg-legend i {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 4px;
  vertical-align: -1px;
}
.hg-legend .lg-on { background: rgba(40, 96, 140, 0.75); border: 1px solid rgba(79, 224, 255, .5); }
.hg-legend .lg-off { border: 1px dashed rgba(74, 158, 224, .35); }
.hg-legend .dim { margin-left: auto; }

/* 户详情 */
.hh-detail { padding-top: 8px; flex: 0 0 auto; }
.hh-detail .hd-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: #d9f3ff; margin-bottom: 6px;
}
.hh-detail .hd-h em { font-style: normal; font-size: 10px; color: var(--dim); }
.hd-kv { display: grid; grid-template-columns: 46px 1fr; gap: 3px 8px; font-size: 11.5px; }
.hd-kv .k { color: var(--dim); }
.hd-kv .v { color: #d3e8f6; word-break: break-all; }
.hd-kv .v.na { color: #4c6a80; }
.hd-fam {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line-soft);
  display: flex; flex-wrap: wrap; gap: 4px;
}
.hd-fam span {
  font-size: 10.5px; color: #a8cee2; padding: 1px 6px;
  background: rgba(79, 224, 255, 0.07); border: 1px solid var(--line-soft);
}
.hd-fam span em { font-style: normal; color: var(--dim); margin-left: 3px; }
.hd-fam .na { color: #4c6a80; background: none; border-style: dashed; }

/* 提示条 */
.tip-line {
  margin-top: 8px;
  padding: 6px 8px;
  font-size: 10.5px;
  line-height: 1.6;
  color: #b8a878;
  background: rgba(80, 62, 20, 0.22);
  border: 1px solid rgba(255, 181, 71, 0.22);
}

/* 楼栋常驻标签（每栋楼一个，贴楼顶） */
.bld-label {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 1px 7px 2px;
  background: linear-gradient(180deg, rgba(10, 40, 58, 0.94), rgba(4, 16, 26, 0.94));
  border: 1px solid rgba(79, 224, 255, 0.6);
  box-shadow: 0 0 18px rgba(30, 160, 210, 0.45);
  color: #d8f6ff;
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  z-index: 13;
  transition: opacity .2s, border-color .15s;
}
.bld-label:hover { border-color: #7ff0ff; }
.bld-label b { display: block; font-size: 11px; letter-spacing: .5px; font-weight: 500; }
/* 选中的那栋：标签提亮，替代原来的弹卡做视觉焦点 */
.bld-label.sel {
  color: #fff;
  border-color: rgba(255, 181, 71, 0.95);
  background: linear-gradient(180deg, rgba(72, 46, 10, 0.95), rgba(30, 20, 4, 0.95));
  box-shadow: 0 0 20px rgba(255, 181, 71, 0.45);
}
.bld-label::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -5px;
  width: 1px; height: 5px;
  background: rgba(79, 224, 255, 0.8);
  transform: translateX(-50%);
}

/* 紧凑户详情 */
.hd-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
  padding: 2px 0;
}
.hd-line b { color: #d9f3ff; font-family: "DIN Alternate", monospace; font-weight: 600; }
.hd-line span { color: #cfe9f8; }
.hd-line span.na { color: #4c6a80; }
.hd-line em { font-style: normal; color: var(--dim); font-size: 10.5px; }
.hd-line em:last-child { margin-left: auto; }
.hd-sub {
  font-size: 10.5px;
  color: #8fb2c6;
  padding: 0 0 5px 0;
  line-height: 1.5;
}
.hd-sub.na { color: #4c6a80; }

/* ---------------------------------------------------------------- 侧栏模块卡（测试占位） */
.mslot { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; }
.mslot:empty { display: none; }
.mslot > .card { flex: 1 1 0; min-height: 0; }
/* 槽位里的卡片内容按高度撑开：监控画面、表格、告警列表都跟着长 */
.mslot .card-bd { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.mslot .cams { flex: 1; grid-auto-rows: 1fr; }
.mslot[data-mod="monitor"] { flex: 1.6 1 0; }
/* 卡片不跟着伙伴增减拉伸：各自有高度上限，空出来的地方留白 */
.mslot[data-mod="access"],
.mslot[data-mod="parking"],
.mslot[data-mod="alarm"] { max-height: 36vh; }
.mslot[data-mod="monitor"] { max-height: 58vh; }
.mslot .cam { display: flex; flex-direction: column; }
.mslot .cam .feed { flex: 1; min-height: 72px; }
.mslot .alarms { flex: 1; }
.mslot .tbl { flex: 0 0 auto; }

/* 进出信息：24 小时曲线（照 demo 的样子） */
.flow { width: 100%; height: 112px; display: block; margin-top: 8px; }
.mslot .flow { flex: 1; height: auto; min-height: 88px; }
.axis { display: flex; justify-content: space-between; font-size: 10px; color: #5f7386; margin-top: 2px; }
.flow-foot {
  display: flex;
  gap: 1px;
  margin-top: 10px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
.flow-foot div { flex: 1; padding: 6px 8px; background: rgba(10, 24, 38, 0.5); }
.flow-foot label { display: block; font-size: 10px; color: var(--dim); letter-spacing: 0.6px; }
.flow-foot b { font-size: 14px; font-family: "DIN Alternate", monospace; color: #cfe9f8; }
.flow-foot b em { font-style: normal; font-size: 10px; color: var(--dim); }

/* ---------------------------------------------------------------- 点楼弹出的人口卡 */
.bpop {
  position: absolute;
  z-index: 16;
  top: 56px;
  right: 14px;
  width: 302px;
  border: 1px solid rgba(79, 224, 255, 0.42);
  background: linear-gradient(180deg, rgba(11, 30, 46, 0.97), rgba(7, 18, 28, 0.97));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6), 0 0 22px rgba(79, 224, 255, 0.1);
  backdrop-filter: blur(3px);
  animation: popIn 0.18s ease-out;
}
.bpop[hidden] { display: none; }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
.bpop-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 7px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(90deg, rgba(79, 224, 255, 0.14), transparent 70%);
}
.bpop-hd b { font-size: 13px; color: #dff4ff; letter-spacing: 1.2px; white-space: nowrap; }
.bpop-hd .tag { margin-left: auto; }
.bpop-close {
  flex: none;
  width: 18px; height: 18px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: #8fa9bd;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.bpop-close:hover { color: #eaf8ff; border-color: rgba(79, 224, 255, 0.55); }
.bpop-bd { padding: 9px 11px 11px; }
