/* 车辆可视化平台 —— 深色科技风看板样式 */

:root {
  --bg: #030B18;
  --panel: #071E33;
  --panel2: #06182B;
  --panel-border: #12506E;
  --cyan: #35E0EC;
  --cyan-dim: #1E93A8;
  --green: #2FE08A;
  --green-code: #3DDC97;
  --text: #C8E4F2;
  --text-dim: #7FA6C0;
  --text-mute: #527F9B;
  --nav-active: #1E7BD6;
  --orange: #F2A03C;
  --purple: #B45CD6;
  --blue: #2AA7E8;
  --danger: #E85C7A;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(900px 420px at 18% 0%, rgba(24, 96, 140, .20), transparent 70%),
    radial-gradient(760px 380px at 84% 4%, rgba(32, 74, 140, .18), transparent 70%);
  color: var(--text);
  font: 12.5px/1.5 system-ui, "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.app { display: flex; flex-direction: column; height: 100vh; min-height: 620px; }

/* ---------------- 顶部导航 ---------------- */

.nav {
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: linear-gradient(180deg, #08243C, #061627);
  border-bottom: 1px solid var(--panel-border);
}

.brand {
  display: flex;
  align-items: center;
  margin-right: 14px;
}
/* 品牌徽标：透明底 PNG，直接叠加在导航栏渐变上 */
.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}

.nav-items { display: flex; align-items: center; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 15px;
  font-size: 12.5px;
  color: #A9C6DC;
  transition: background .18s, color .18s;
}
.nav-item svg { width: 13px; height: 13px; }
.nav-item:hover { color: var(--cyan); background: rgba(53, 224, 236, .08); }
.nav-item.active {
  background: var(--nav-active);
  color: #fff;
  box-shadow: 0 0 14px rgba(30, 123, 214, .55);
}

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: #9FC2DA; }
.nav-right .nav-ico { width: 16px; height: 16px; cursor: pointer; }

.bell { position: relative; display: inline-flex; cursor: pointer; }
.bell svg { width: 16px; height: 16px; }
.bell b {
  position: absolute; top: -6px; right: -10px;
  min-width: 16px; padding: 1px 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
  text-align: center;
}

.avatar {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #2A6CA8, #1B3F63);
  border: 1px solid rgba(53, 224, 236, .5);
  color: #EAF6FF;
  font-size: 11px;
}

.badge-orange {
  padding: 3px 8px;
  border-radius: 9px;
  background: rgba(242, 160, 60, .18);
  border: 1px solid rgba(242, 160, 60, .55);
  color: var(--orange);
  font-size: 11px;
  font-weight: 600;
}

/* ---------------- 次级标题栏 ---------------- */

.subbar {
  flex: 0 0 46px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 14px;
}

.date-pill {
  padding: 6px 13px;
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  background: rgba(10, 40, 64, .65);
  color: #9FC2DA;
  font-size: 12px;
  letter-spacing: .3px;
}

.title-wrap { display: flex; align-items: center; gap: 16px; }

.title-wrap h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(53, 224, 236, .55);
}

/* 标题两侧的斜切装饰 */
.chev { position: relative; width: 70px; height: 16px; }
.chev::before, .chev::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 11px; height: 12px;
  transform: skewX(-32deg);
  background: linear-gradient(180deg, rgba(53, 224, 236, .95), rgba(53, 224, 236, .10));
}
.chev::before { left: 0; }
.chev::after { left: 17px; opacity: .55; }
.chev-l { border-top: 1px solid rgba(53, 224, 236, .35); height: 1px; margin-top: 7px; }
.chev-r { border-top: 1px solid rgba(53, 224, 236, .35); height: 1px; margin-top: 7px; }
.chev-r::before { left: 59px; }
.chev-r::after { left: 42px; }

.clock { text-align: right; }
.clock .time {
  font: 700 19px/1.1 Consolas, monospace;
  color: var(--cyan);
  letter-spacing: .6px;
}
.clock .date { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

/* ---------------- 主体三栏 ---------------- */

.grid {
  flex: 1;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 10px;
  padding: 8px 10px 10px;
}

.col { display: grid; gap: 10px; min-height: 0; }
.col-left { grid-template-rows: 1.15fr 1.25fr 1fr; }
.col-center { grid-template-rows: auto 1fr; }
.col-right { grid-template-rows: 1fr 1fr; }

/* ---------------- 面板 ---------------- */

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: linear-gradient(180deg, #08233A, #061729);
  overflow: hidden;
}

/* 四角科技感切角 */
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px;
  border: 1px solid var(--cyan);
  pointer-events: none;
  opacity: .85;
}
.panel::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; }
.panel::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }

.panel > header {
  flex: 0 0 26px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  position: relative;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cyan);
  background: linear-gradient(90deg, rgba(21, 93, 130, .5), rgba(21, 93, 130, 0));
  border-bottom: 1px solid rgba(53, 224, 236, .16);
}
.panel > header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(53, 224, 236, .75), transparent);
}
.panel > header .ico {
  width: 8px; height: 8px;
  background: var(--cyan);
  transform: rotate(45deg);
  box-shadow: 0 0 9px rgba(53, 224, 236, .8);
}
.panel > header em {
  font-style: normal;
  font-weight: 600;
  color: var(--green-code);
  font-family: Consolas, monospace;
  font-size: 11.5px;
}

.panel .body { flex: 1; min-height: 0; position: relative; padding: 6px; }

.panel .foot {
  flex: 0 0 auto;
  padding: 4px 9px 6px;
  font-size: 10.5px;
  color: var(--text-mute);
  border-top: 1px solid rgba(18, 80, 110, .5);
}

canvas { display: block; width: 100%; height: 100%; }

/* ---------------- 全国设备分布地图 ---------------- */

.panel .body.map-body { padding: 0; }

.map-legend {
  position: absolute;
  left: 8px; bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 9px;
  border: 1px solid rgba(18, 80, 110, .8);
  border-radius: 4px;
  background: rgba(5, 20, 35, .78);
  font-size: 10.5px;
  color: var(--text-dim);
}
.map-legend span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.map-legend b { color: var(--text); font-family: Consolas, monospace; }
.ld-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.ld-dot.on { background: #7BCFA0; box-shadow: 0 0 7px rgba(123, 207, 160, .8); }
.ld-dot.off { background: #A7B8C6; }
.map-legend .ld-scale { color: var(--text-mute); font-size: 10px; }

/* ---------------- 各省设备数量 ---------------- */

.region-body { display: flex; flex-direction: column; }

.region-head {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 52px 52px 52px;
  padding: 2px 9px 6px;
  border-bottom: 1px solid rgba(18, 80, 110, .6);
  font-size: 10.5px;
  color: var(--text-mute);
  text-align: right;
}
.region-head span:first-child { text-align: left; }

.region-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
}
.region-list::-webkit-scrollbar { width: 6px; }
.region-list::-webkit-scrollbar-thumb { background: rgba(18, 80, 110, .9); border-radius: 3px; }

.region-row {
  display: grid;
  grid-template-columns: 1fr 52px 52px 52px;
  align-items: center;
  padding: 4px 9px;
  font-size: 11.5px;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(18, 80, 110, .22);
}
.region-row:hover { background: rgba(30, 123, 214, .16); }
.region-name { text-align: left; color: var(--text); }
.region-on, .region-off, .region-sum { text-align: right; font-family: Consolas, monospace; }
.region-on { color: #7BCFA0; }
.region-off { color: var(--text-dim); }
.region-sum { color: var(--cyan); font-weight: 600; }

/* ---------------- KPI 卡 ---------------- */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 74px;
  padding: 8px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: linear-gradient(135deg, #0A2B46, #061A2C);
  overflow: hidden;
}

.kpi-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #A9C6DC; }

/* 设备卡：点击后在下方浮空展开设备编号列表（不改变页面布局尺寸） */
.kpi-block { position: relative; display: flex; flex-direction: column; min-height: 0; }
.kpi.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kpi.clickable::after {
  content: "点击展开编号 ▾";
  position: absolute;
  right: 9px; bottom: 7px;
  font-size: 9.5px;
  color: var(--text-mute);
}
.kpi.clickable:hover {
  border-color: rgba(53, 224, 236, .7);
  box-shadow: 0 0 0 1px rgba(53, 224, 236, .28) inset, 0 0 16px rgba(53, 224, 236, .16);
}
.kpi.clickable:hover::after { color: var(--cyan); }
/* 展开中的卡片 */
.kpi.clickable.is-open {
  border-color: rgba(53, 224, 236, .85);
  box-shadow: 0 0 0 1px rgba(53, 224, 236, .4) inset, 0 0 18px rgba(53, 224, 236, .2);
}
.kpi.clickable.is-open::after { content: "点击收起 ▴"; color: var(--cyan); }
.kpi-ico { width: 17px; height: 17px; stroke-width: 1.5; }
.kpi-ico.cyan { color: var(--cyan); }
.kpi-ico.orange { color: var(--orange); }
.kpi-ico.green { color: var(--green); }
.kpi-ico.purple { color: var(--purple); }

.kpi-val {
  font: 700 24px/1 Consolas, monospace;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(53, 224, 236, .45);
}
.kpi-val span { font-size: 12px; margin-left: 4px; color: var(--text-dim); }

.kpi .corner {
  position: absolute;
  right: 6px; bottom: 6px;
  width: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(53, 224, 236, .7));
}

/* ---------------- 设备编号下拉（浮空展开，不影响布局尺寸） ---------------- */

.dev-drop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  z-index: 12;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: linear-gradient(180deg, #0B2136, #082032);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .62);
  overflow: hidden;
}
.dev-drop[hidden] { display: none; }

.dev-drop-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid rgba(18, 80, 110, .7);
}
.dev-drop-title { flex: 1; font-size: 12px; font-weight: 700; color: #fff; }
.dev-drop-count { font: 600 11.5px Consolas, monospace; color: var(--cyan); }
.dev-drop-close {
  width: 18px; height: 18px;
  border: 0; border-radius: 3px;
  background: transparent;
  color: var(--text-mute);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.dev-drop-close:hover { background: rgba(53, 224, 236, .12); color: var(--cyan); }

.dev-drop-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px 8px;
  max-height: 158px;
  overflow-y: auto;
  padding: 6px 10px 8px;
}
.dev-drop-list::-webkit-scrollbar { width: 6px; }
.dev-drop-list::-webkit-scrollbar-thumb { background: rgba(18, 80, 110, .9); border-radius: 3px; }

.dev-drop-list li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(9, 33, 52, .55);
  font: 11px Consolas, monospace;
  color: var(--text);
  white-space: nowrap;
}
.dev-drop-list li:hover { background: rgba(30, 123, 214, .22); }
.dev-drop-list .dev-region {
  flex: 0 0 46px;
  font-size: 10px;
  color: var(--text-mute);
  font-family: system-ui, "Microsoft YaHei", sans-serif;
}

/* ---------------- 底部状态栏 ---------------- */

.status {
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 14px;
  background: #04121F;
  border-top: 1px solid rgba(30, 93, 120, .6);
  font-size: 11.5px;
  color: var(--text-mute);
}
.brand-sm { font-weight: 700; letter-spacing: 1.2px; color: #6E93AE; }

.status-items { display: flex; align-items: center; gap: 18px; margin-left: auto; margin-right: auto; }
.status-items b { color: var(--text-dim); font-weight: 600; font-family: Consolas, monospace; }
.chip {
  padding: 2px 9px;
  border-radius: 9px;
  background: rgba(53, 224, 236, .14);
  border: 1px solid rgba(53, 224, 236, .35);
}
.chip b { color: var(--cyan); }

/* ---------------- 实时视频（摄像头） ---------------- */

.page { flex: 1; min-height: 0; }
.page[hidden] { display: none; }

.camera {
  display: grid;
  grid-template-columns: 300px 1fr 1fr;
  gap: 12px;
  padding: 8px 10px 10px;
}

/* 左侧摄像头列表 */
.cam-list-panel { min-height: 0; }

.cam-list-body { display: flex; flex-direction: column; gap: 8px; padding: 8px; }

.cam-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}
.cam-search > svg {
  position: absolute;
  left: 9px;
  width: 13px; height: 13px;
  color: var(--text-mute);
  pointer-events: none;
}
.cam-search input {
  width: 100%;
  height: 30px;
  padding: 0 26px 0 27px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: #061627;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.cam-search input::placeholder { color: var(--text-mute); }
.cam-search input:focus { border-color: var(--cyan-dim); }
.cam-search-clear {
  position: absolute;
  right: 5px;
  width: 18px; height: 18px;
  border: 0; border-radius: 3px;
  background: transparent;
  color: var(--text-mute);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.cam-search-clear:hover { background: rgba(53, 224, 236, .12); color: var(--cyan); }

/* 按状态 / 省份筛选设备 */
.cam-filter { display: flex; flex: 0 0 auto; gap: 6px; padding-top: 6px; }
.cam-filter .loc-select { flex: 1; height: 30px; min-width: 0; }

.cam-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cam-list::-webkit-scrollbar { width: 6px; }
.cam-list::-webkit-scrollbar-thumb { background: rgba(18, 80, 110, .9); border-radius: 3px; }

.cam-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: rgba(9, 33, 52, .8);
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.cam-row:hover { background: rgba(21, 93, 130, .38); color: var(--text); }
.cam-row.on {
  border-color: rgba(53, 224, 236, .6);
  background: rgba(30, 123, 214, .22);
  color: #fff;
}
.cam-dot {
  flex: 0 0 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 7px rgba(47, 224, 138, .7);
}
.cam-dot.off { background: #55606E; box-shadow: none; }
.cam-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-row-id { font: 10.5px Consolas, monospace; color: var(--text-mute); }
.cam-row-state { font-size: 10.5px; color: var(--green-code); }
.cam-row-state.off { color: #7A8798; }
.cam-empty { padding: 14px 9px; font-size: 11.5px; color: var(--text-mute); text-align: center; }

/* 设备行：加粗 + 右侧展开箭头；展开时箭头翻转 */
.cam-row.dev { font-weight: 600; color: var(--text); }
.cam-row-arrow {
  flex: 0 0 8px;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--text-mute);
  border-bottom: 1.5px solid var(--text-mute);
  transform: rotate(45deg);
  transition: transform .18s, border-color .18s;
}
.cam-row.dev.open { border-color: rgba(53, 224, 236, .45); background: rgba(21, 93, 130, .30); }
.cam-row.dev.open .cam-row-arrow { transform: rotate(-135deg); border-color: var(--cyan); }

/* 设备下展开的摄像头子行：缩进一层，弱化底色 */
.cam-row.sub {
  margin-left: 16px;
  padding: 5px 9px;
  background: rgba(6, 22, 38, .55);
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-dim);
}

.btn {
  height: 28px;
  padding: 0 14px;
  border: 1px solid rgba(53, 224, 236, .45);
  border-radius: 5px;
  background: rgba(30, 123, 214, .85);
  color: #fff;
  font: 600 12px system-ui, "Microsoft YaHei", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost {
  background: rgba(10, 40, 64, .9);
  border-color: var(--panel-border);
  color: var(--text);
}

.cam-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: linear-gradient(180deg, #08233A, #061729);
  overflow: hidden;
}

.cam-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #0B2136;
  border-bottom: 1px solid rgba(18, 80, 110, .7);
}
.cam-title { font-size: 12.5px; font-weight: 700; color: var(--text-dim); }

.cam-slot {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(53, 224, 236, .14);
  border: 1px solid rgba(53, 224, 236, .3);
  color: var(--cyan);
  font: 600 10.5px Consolas, monospace;
  white-space: nowrap;
}

.cam-card { cursor: pointer; }
.cam-card.is-active {
  border-color: rgba(53, 224, 236, .75);
  box-shadow: 0 0 0 1px rgba(53, 224, 236, .35), 0 0 18px rgba(53, 224, 236, .16);
}
.cam-card.is-active .cam-slot { background: rgba(53, 224, 236, .3); color: #EAFBFF; }

.cam-input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: #061627;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.cam-input::placeholder { color: var(--text-mute); }
.cam-input:focus { border-color: var(--cyan-dim); }

.cam-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
}

.cam-video {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #161D2D, #05080E 82%);
}
.cam-hint { font-size: 11px; color: #39445A; }

.cam-tagstack {
  position: absolute;
  top: 10px; left: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cam-pill {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 5px;
  background: rgba(20, 27, 44, .82);
  color: var(--text);
  font-size: 11px;
}
.cam-stamp { font-size: 11px; color: #C3CBD8; }
.cam-id {
  position: absolute;
  right: 12px; bottom: 10px;
  font: 11px Consolas, monospace;
  color: var(--text-mute);
}

.cam-actions { display: flex; gap: 8px; margin-top: 10px; }

.cam-msg {
  min-height: 16px;
  margin-top: 8px;
  font: 11px Consolas, monospace;
  color: var(--green-code);
}

/* ---------------- 实时定位 ---------------- */

.locate {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 12px;
  padding: 8px 10px 10px;
}

.loc-panel { min-height: 0; }

.loc-stat { display: flex; align-items: center; gap: 8px; padding: 12px 12px 0; font-size: 12px; color: var(--text-dim); }
.loc-stat-title { color: var(--text-mute); }
.loc-stat-val b { color: var(--green-code); font: 700 14px Consolas, monospace; }
.loc-stat-val em { color: var(--text-mute); font-style: normal; }

.loc-search { display: flex; gap: 6px; padding: 8px 12px 0; }
.loc-search input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: #061627;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.loc-search input::placeholder { color: var(--text-mute); }
.loc-search input:focus { border-color: var(--cyan-dim); }

.loc-filter { display: flex; gap: 6px; padding: 8px 12px 0; }
.loc-select {
  flex: 1;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: #061627;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.loc-reset {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: rgba(10, 40, 64, .9);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}
.loc-reset:hover { color: var(--cyan); border-color: var(--cyan-dim); }

.loc-group {
  padding: 10px 12px 6px;
  font-size: 11.5px;
  color: var(--text-mute);
}

.loc-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 8px 10px;
}
.loc-list::-webkit-scrollbar { width: 6px; }
.loc-list::-webkit-scrollbar-thumb { background: rgba(18, 80, 110, .9); border-radius: 3px; }

.loc-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: rgba(9, 33, 52, .8);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.loc-row:hover { background: rgba(21, 93, 130, .38); }
.loc-row.on { border-color: rgba(53, 224, 236, .6); background: rgba(30, 123, 214, .22); }

.loc-thumb-sm {
  flex: 0 0 46px;
  width: 46px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: linear-gradient(160deg, #16324E, #0A1D31);
  color: #7FA6C0;
}
.loc-thumb-sm svg { width: 22px; height: 22px; }

.loc-row-main { flex: 1; min-width: 0; }
.loc-row-name {
  font: 600 12.5px Consolas, monospace;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loc-row-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loc-row-state {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10.5px;
  white-space: nowrap;
}
.loc-row-state.run { background: rgba(47, 224, 138, .16); color: var(--green-code); border: 1px solid rgba(47, 224, 138, .4); }
.loc-row-state.stop { background: rgba(242, 160, 60, .14); color: var(--orange); border: 1px solid rgba(242, 160, 60, .4); }
.loc-row-state.off { background: rgba(122, 135, 152, .16); color: #8C99A8; border: 1px solid rgba(122, 135, 152, .35); }

.loc-empty { padding: 20px 8px; text-align: center; font-size: 11.5px; color: var(--text-mute); }

/* 地图区 */
.loc-map {
  position: relative;
  min-height: 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow: hidden;
  background: #E7ECE4;
}

.loc-tools {
  position: absolute;
  top: 12px; right: 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
.loc-tool {
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  background: rgba(11, 33, 54, .92);
  color: #A9C6DC;
  cursor: pointer;
}
.loc-tool svg { width: 15px; height: 15px; }
.loc-tool:hover { background: #1E7BD6; color: #fff; }

.loc-detail {
  position: absolute;
  left: 12px; bottom: 12px;
  width: 232px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(11, 33, 54, .96), rgba(6, 22, 39, .96));
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
}
.loc-detail[hidden] { display: none; }
.loc-detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(18, 80, 110, .7);
}
.loc-detail-title { flex: 1; font: 700 13px Consolas, monospace; color: #fff; letter-spacing: .4px; }
.loc-close {
  width: 18px; height: 18px;
  border: 0; border-radius: 3px;
  background: transparent;
  color: var(--text-mute);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.loc-close:hover { background: rgba(53, 224, 236, .12); color: var(--cyan); }

.loc-detail-rows { list-style: none; padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; }
.loc-detail-rows li { display: flex; gap: 10px; font-size: 11.5px; }
.loc-detail-rows span { flex: 0 0 56px; color: var(--text-mute); }
.loc-detail-rows b { font-weight: 600; color: var(--text); }
.loc-detail-rows b.ok { color: var(--green-code); }

.loc-detail-foot { display: flex; gap: 6px; padding: 0 10px 10px; }
.loc-detail-foot .btn { flex: 1; height: 26px; padding: 0; font-size: 11.5px; }
.btn.warn {
  background: rgba(242, 160, 60, .9);
  border-color: rgba(242, 160, 60, .6);
  color: #17222E;
}

.loc-safe {
  position: absolute;
  right: 12px; bottom: 12px;
  display: flex;
  gap: 10px;
  width: 286px;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(11, 33, 54, .96), rgba(6, 22, 39, .96));
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
}
.loc-safe-info { flex: 1; min-width: 0; }
.loc-safe-title { font-size: 13px; font-weight: 700; color: #fff; }
.loc-safe-title span { display: block; margin-top: 3px; font-size: 11px; font-weight: 400; color: var(--text-dim); }
.loc-safe-bar {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  padding: 5px 8px;
  border-radius: 3px;
  background: rgba(4, 16, 28, .8);
}
.loc-safe-bar div { display: flex; align-items: baseline; gap: 4px; font-size: 10.5px; color: var(--text-mute); }
.loc-safe-bar b { font: 600 12px Consolas, monospace; color: var(--green-code); }

.loc-safe-thumbs { display: flex; flex-direction: column; gap: 6px; }
.loc-thumb {
  width: 74px; height: 52px;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(160deg, #2B3A47, #101820);
  color: #9FB6C6;
}
.loc-thumb svg { width: 26px; height: 26px; }
.loc-thumb figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1px 0;
  background: rgba(4, 16, 28, .78);
  font-size: 9px;
  color: #A9C6DC;
  text-align: center;
}

/* ---------------- 录像回放 ---------------- */

.playback {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 12px;
  padding: 8px 10px 10px;
}

.pb-side { min-height: 0; }
.pb-side-body { display: flex; flex-direction: column; gap: 8px; padding: 10px; overflow: hidden; }

.pb-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-mute); }
.pb-field input[type="date"] { color-scheme: dark; }

.pb-query { flex: 0 0 auto; }
.pb-sub { margin-top: 4px; font-size: 11.5px; color: var(--text-mute); }

.pb-files {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pb-files::-webkit-scrollbar { width: 6px; }
.pb-files::-webkit-scrollbar-thumb { background: rgba(18, 80, 110, .9); border-radius: 3px; }
.pb-file {
  padding: 7px 9px;
  border: 1px solid rgba(18, 80, 110, .55);
  border-radius: 5px;
  background: rgba(10, 40, 64, .55);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pb-file:hover { border-color: var(--cyan-dim); background: rgba(30, 123, 214, .18); }
.pb-file.active { border-color: rgba(53, 224, 236, .8); background: rgba(30, 123, 214, .3); }
.pb-file b { display: block; font: 600 11.5px Consolas, monospace; color: var(--text); }
.pb-file span { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-mute); }
.pb-file span i { font-style: normal; color: var(--green-code); }

.pb-player { min-height: 0; }
.pb-video { flex: 1; min-height: 0; }

.pb-rec { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font: 700 11px Consolas, monospace; color: var(--danger); }
.pb-rec i { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: pbBlink 1.2s infinite; }
@keyframes pbBlink { 50% { opacity: .15; } }

.pb-bar { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 0; }
.pb-track {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: rgba(6, 22, 39, .95);
  border: 1px solid rgba(18, 80, 110, .7);
  cursor: pointer;
}
.pb-played {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: 5px 0 0 5px;
  background: linear-gradient(90deg, rgba(53, 224, 236, .45), rgba(53, 224, 236, .85));
}
.pb-cursor {
  position: absolute;
  top: -4px;
  left: 0;
  width: 3px; height: 17px;
  border-radius: 2px;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(53, 224, 236, .8);
}
.pb-ticks { display: flex; justify-content: space-between; font: 10px Consolas, monospace; color: var(--text-mute); }

.pb-ctrls { display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px; }
.pb-speed { flex: 0 0 64px; height: 28px; }
.pb-msg { flex: 1; text-align: right; }

.pb-right { display: grid; grid-template-rows: 1fr 1fr; gap: 0; min-height: 0; }
.pb-segwrap { display: flex; flex-direction: column; gap: 6px; justify-content: center; padding: 10px; }
.pb-seg { position: relative; height: 22px; border-radius: 4px; background: rgba(6, 22, 39, .9); border: 1px solid rgba(18, 80, 110, .6); overflow: hidden; }
.pb-seg i {
  position: absolute;
  top: 2px; bottom: 2px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(61, 220, 151, .85), rgba(61, 220, 151, .5));
  cursor: pointer;
}
.pb-seg i:hover { background: #3DDC97; }
.pb-seg-axis { display: flex; justify-content: space-between; font: 10px Consolas, monospace; color: var(--text-mute); }

.pb-store { display: flex; flex-direction: column; gap: 9px; padding: 12px; overflow-y: auto; }
.pb-store-row { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-dim); }
.pb-store-row .bar { height: 7px; border-radius: 4px; background: rgba(6, 22, 39, .95); border: 1px solid rgba(18, 80, 110, .6); overflow: hidden; }
.pb-store-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan-dim), var(--cyan)); }
.pb-store-row b { color: var(--text); font-family: Consolas, monospace; }

/* ---------------- 轨迹查询 ---------------- */

/* 详情卡抬到底部回放条上方，避免重叠 */
#tkDetail { bottom: 64px; }

.tk-controls {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(11, 33, 54, .96), rgba(6, 22, 39, .96));
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
}
.tk-speed { flex: 0 0 66px; height: 28px; }
.tk-progress {
  position: relative;
  flex: 1;
  height: 9px;
  border-radius: 5px;
  background: rgba(6, 22, 39, .95);
  border: 1px solid rgba(18, 80, 110, .7);
  cursor: pointer;
}
.tk-progress i {
  position: absolute;
  top: -4px;
  left: 0;
  width: 3px; height: 16px;
  border-radius: 2px;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(53, 224, 236, .8);
}
.tk-time { font: 600 12px Consolas, monospace; color: var(--cyan); }

/* ---------------- 报表查询 ---------------- */

.report {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 10px 10px;
  min-height: 0;
}

.rp-toolbar { flex: 0 0 auto; }
.rp-tools { display: flex; align-items: center; gap: 8px; padding: 9px 12px; }
.rp-type { flex: 0 0 150px; height: 28px; }
.rp-region { flex: 0 0 104px; height: 28px; }
.rp-sep { color: var(--text-mute); }
.rp-search {
  flex: 1;
  min-width: 0;
  height: 28px;
  margin-left: 4px;
  padding: 0 10px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: #061627;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.rp-search::placeholder { color: var(--text-mute); }
.rp-search:focus { border-color: var(--cyan-dim); }

.rp-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 10px;
}
.rp-table-panel { min-height: 0; }
.rp-table-body { overflow: auto; padding: 0; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.rp-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-mute);
  background: #0A2438;
  border-bottom: 1px solid rgba(18, 80, 110, .8);
  white-space: nowrap;
}
.rp-table td {
  padding: 6px 10px;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(18, 80, 110, .22);
  white-space: nowrap;
}
.rp-table tbody tr:hover { background: rgba(30, 123, 214, .14); }
.rp-table td.mono { font-family: Consolas, monospace; color: var(--text); }
.rp-table td.num { text-align: right; font-family: Consolas, monospace; }
.rp-table th.num { text-align: right; }

.rp-side { display: grid; grid-template-rows: 1fr 1fr; min-height: 0; }

/* ---------------- 后台管理 ---------------- */

.admin {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  padding: 8px 10px 10px;
}

.ad-side { min-height: 0; }
.ad-menu { list-style: none; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.ad-menu li {
  padding: 9px 12px;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ad-menu li:hover { background: rgba(53, 224, 236, .08); color: var(--cyan); }
.ad-menu li.active { background: var(--nav-active); color: #fff; box-shadow: 0 0 12px rgba(30, 123, 214, .45); }

.ad-main-panel { min-height: 0; }
.ad-body { display: flex; flex-direction: column; gap: 8px; padding: 10px; overflow: hidden; }

.ad-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.ad-tools .loc-select { flex: 0 0 110px; height: 28px; }

.ad-table-body { flex: 1; min-height: 0; overflow: auto; }
.ad-table { flex: 1; min-height: 0; display: block; overflow: auto; }
.ad-table th { white-space: nowrap; }
.ad-table td .row-act { color: var(--cyan); cursor: pointer; margin-right: 8px; }
.ad-table td .row-act:hover { text-decoration: underline; }
.ad-table td .row-act.del { color: var(--danger); }

.ad-on { color: var(--green-code); }
.ad-off2 { color: var(--text-mute); }
.ad-msg { flex: 0 0 auto; min-height: 16px; font-size: 11.5px; color: var(--green-code); }
.ad-note { font-size: 11px; color: var(--text-mute); }

.ad-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; overflow-y: auto; }
.ad-card {
  padding: 10px 12px;
  border: 1px solid rgba(18, 80, 110, .6);
  border-radius: 5px;
  background: rgba(10, 40, 64, .5);
}
.ad-card b { display: block; font-size: 13px; color: var(--text); }
.ad-card span { font-size: 11px; color: var(--text-mute); }
.ad-card em { float: right; font-style: normal; font: 600 13px Consolas, monospace; color: var(--cyan); }

.ad-form { display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.ad-form .btn { align-self: flex-start; }

.ad-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  font: 11.5px/1.9 Consolas, monospace;
}
.ad-log li { display: flex; gap: 12px; border-bottom: 1px solid rgba(18, 80, 110, .18); padding: 2px 4px; }
.ad-log .t { color: var(--text-mute); flex: 0 0 128px; }
.ad-log .lv-warn { color: var(--orange); }
.ad-log .lv-err { color: var(--danger); }
.ad-log .lv-info { color: var(--green-code); }

/* ---------------- 窄屏降级 ---------------- */

@media (max-width: 1100px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .grid { grid-template-columns: 1fr; }
  .col { grid-template-rows: none; grid-auto-rows: 260px; }
  .col-center { grid-auto-rows: auto 320px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .subbar { grid-template-columns: 1fr; gap: 6px; height: auto; padding: 10px 14px; }
  .clock, .range { justify-self: center; }
  .kpis .kpi { min-height: 68px; }
  .dev-drop-list { grid-template-columns: 1fr; }
  .camera { grid-template-columns: 1fr; grid-auto-rows: 320px; }
  .locate { grid-template-columns: 1fr; grid-template-rows: auto 420px; }
  .loc-detail { left: 8px; bottom: 8px; }
  .loc-safe { right: 8px; bottom: 8px; width: 250px; }
  .playback { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .pb-player { min-height: 380px; }
  .pb-right { grid-auto-rows: 220px; }
  .rp-main { grid-template-columns: 1fr; }
  .rp-side { grid-auto-rows: 240px; }
  .admin { grid-template-columns: 1fr; }
}
