:root {
  --ink: #15211e;
  --ink-2: #34443d;
  --muted: #6f7c74;
  --faint: #96a198;
  --paper: #f7f8f4;
  --panel: #ffffff;
  --line: #e3e8df;
  --line-strong: #d2dbcf;
  --accent: #0f6b5c;
  --accent-deep: #0b3f36;
  --accent-soft: #e8f2ec;
  --amber: #b7791f;
  --danger: #b63c32;
  --shadow: 0 1px 2px rgba(19, 38, 31, .05);
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
  --sans: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: #e9ede6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }

#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ---------------------------------------------------------------- 侧栏 */

.sidebar {
  width: 396px;
  flex: 0 0 396px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--line);
  z-index: 620;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 19px 18px 14px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #cdeadd;
  background:
    radial-gradient(120% 120% at 20% 10%, #1d5a4b 0%, #0f342e 55%, #0a2823 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 2px 6px rgba(11, 45, 37, .18);
}

.brand-text { flex: 1; min-width: 0; }

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: .05em;
}

.brand-text p {
  margin: 4px 0 0;
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--faint);
  font-weight: 500;
}

.mobile-close { display: none !important; }

.route-bar {
  display: flex;
  gap: 7px;
  padding: 0 18px 12px;
}

/* 光缆选择：按钮触发弹出对话框，设备分组可展开/折叠 */
.route-picker-btn {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  padding: 0 10px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.route-picker-btn:hover { border-color: #93bda8; }
.route-picker-btn:focus-visible { border-color: #93bda8; box-shadow: 0 0 0 3px rgba(15, 107, 92, .08); outline: none; }
.route-picker-btn:disabled { color: var(--faint); background: #f2f4ef; cursor: default; }

.route-picker-btn svg { flex: 0 0 auto; color: var(--muted); transition: transform .15s ease; }
.route-picker-btn[aria-expanded="true"] svg { transform: rotate(90deg); }

.route-picker-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

/* 选择光缆对话框 */
.route-pick-dlg { width: min(580px, calc(100vw - 28px)); }

.route-pick-body {
  min-height: 140px;
  max-height: min(62vh, 540px);
  overflow-y: auto;
  padding: 6px;
  border-top: 1px solid var(--line);
}

.route-pick-empty { padding: 28px 10px; text-align: center; font-size: 14px; color: var(--faint); }

.route-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  font-size: 14px;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
}

.route-item > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-item:hover { background: var(--accent-soft); }
.route-item.active { background: var(--accent-deep); color: #eefaf4; font-weight: 600; }

.route-menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }

.route-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  padding: 0 6px 0 4px;
  border: 0;
  border-radius: 7px;
  background: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
}

.route-group-head:hover { background: #f0f4ee; }

.route-group-head svg { flex: 0 0 auto; color: var(--muted); transition: transform .15s ease; }
.route-group.collapsed .route-group-head svg { transform: rotate(-90deg); }

.route-group-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-group-count {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #edf1ea;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.route-group-body { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 4px 14px; }
.route-group.collapsed .route-group-body { display: none; }

.icon-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink-2);
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.icon-btn:hover { background: #f1f5ee; border-color: #c3cfc0; }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.accent {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #e7f5ee;
}
.icon-btn.accent:hover { background: #0e5347; }

/* ---------------------------------------------------------------- 路线概要 */

.route-card {
  margin: 0 18px 12px;
  padding: 14px 15px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.route-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.route-title { flex: 1; min-width: 0; }

.route-name {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-section {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-edit-btn {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  margin-top: -1px;
  border-radius: 7px;
  color: var(--faint);
}

.route-edit-btn:hover { color: var(--accent-deep); }

.text-btn {
  border: 0;
  background: none;
  padding: 2px 0;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: .02em;
  white-space: nowrap;
}
.text-btn:hover { color: var(--accent-deep); text-decoration: underline; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}

.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.stat span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--faint);
  letter-spacing: .04em;
}

.chain { margin-top: 12px; }

.chain-track {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #0f6b5c 0%, #3e9478 55%, #c3923f 100%);
  opacity: .9;
}

.chain-cursor {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 10px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #0b3f36;
  box-shadow: 0 0 0 1.5px #fff;
  transition: left .18s ease;
}

.chain-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

.route-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--faint);
}

.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- 搜索与筛选 */

.tools {
  display: flex;
  gap: 7px;
  padding: 0 18px 9px;
}

.search { position: relative; flex: 1; min-width: 0; }

.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  padding: 0 10px 0 33px;
  font-size: 14px;
  outline: none;
}

.search input::placeholder { color: #9aa59d; }
.search input:focus { border-color: #9fc4b2; box-shadow: 0 0 0 3px rgba(15, 107, 92, .08); }

.filter-btn { position: relative; }
.filter-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 2px var(--panel);
}

.filter-panel {
  padding: 0 18px 10px;
}

.filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--faint);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink-2);
  font-size: 13px;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}

.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c, #6b7280);
}

.chip em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

.chip:hover { border-color: #bccbb9; }
.chip.active {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #eaf7f0;
}
.chip.active em { color: rgba(234, 247, 240, .62); }

.checkline {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.checkline input { accent-color: var(--accent); width: 13px; height: 13px; }

/* 显示范围开关：独立于类型筛选面板 */
.display-bar {
  padding: 0 18px 8px;
}

.display-bar .checkline {
  margin-top: 0;
  gap: 8px;
  height: 24px;
}

.display-bar .checkline:hover { color: var(--ink-2); }

/* 点击路由测距 */
.measure-icon { background: none; border: none; }

.measure-dot {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d97706;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 52, 46, .3), 0 2px 8px rgba(0, 0, 0, .35);
}

.measure-popup .leaflet-popup-content-wrapper {
  padding: 0 !important;
  border: none;
  border-radius: 9px !important;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 35, 28, .18) !important;
}

.measure-popup .leaflet-popup-content {
  margin: 0 !important;
  padding: 6px 11px 6px 10px;
  line-height: 1 !important;
}

.measure-popup .leaflet-popup-tip {
  background: #fff;
  box-shadow: 0 3px 8px rgba(15, 35, 28, .12) !important;
}

.measure-readout {
  display: flex;
  flex-direction: column;
  gap: 3px;
  white-space: nowrap;
}

.measure-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.measure-row .m-key {
  width: 30px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: .08em;
}

.measure-row b {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--accent-deep);
  letter-spacing: -.01em;
}

.measure-row .m-unit {
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: .03em;
}

/* ---------------------------------------------------------------- 信息点列表 */

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 18px 7px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: .09em;
  color: var(--faint);
}

.list-head span:last-child {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
}

.point-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 10px 14px;
  scroll-behavior: smooth;
}

.point-row {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}

.point-row:hover { background: #eef3ea; }
.point-row.hovered { background: #f1f5ed; }
.point-row.active {
  background: var(--accent-soft);
  border-color: #c9e0d2;
}

.point-seq {
  font-family: var(--mono);
  font-size: 11px;
  color: #a0aaa2;
  text-align: right;
  user-select: none;
}

.point-main { min-width: 0; }

.point-name {
  font-size: 14px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.point-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.type-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex: 0 0 5px;
}

.point-sub .sep { color: #c2cbc2; }

.point-km {
  font-family: var(--mono);
  font-size: 11px;
  color: #77837b;
  white-space: nowrap;
  letter-spacing: -.02em;
  text-align: right;
}

.point-row.active .point-km { color: var(--accent); }

.list-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
  line-height: 1.7;
}

/* ---------------------------------------------------------------- 空状态 */

.empty-state {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 34px 60px;
  text-align: center;
}

.empty-icon { color: #88a495; margin-bottom: 12px; }

.empty-state h2 { margin: 0; font-size: 18px; font-weight: 600; }

.empty-state p {
  margin: 8px 0 18px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
}

/* ---------------------------------------------------------------- 底栏 */

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 13px;
  border-top: 1px solid var(--line);
  background: rgba(251, 252, 249, .92);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.switch input { display: none; }

.track {
  position: relative;
  width: 33px;
  height: 18px;
  border-radius: 99px;
  background: #d5ddd3;
  transition: background .18s ease;
  flex: 0 0 33px;
}

.track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .22);
  transition: transform .18s ease;
}

.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(15px); }

.foot-actions {
  display: flex;
  gap: 6px;
  position: relative;
}

.foot-actions .icon-btn { width: 33px; height: 33px; flex-basis: 33px; }

.menu {
  position: absolute;
  right: 0;
  bottom: 42px;
  min-width: 168px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 12px 30px rgba(15, 35, 28, .16);
  z-index: 30;
}

.menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  font-size: 14px;
  color: var(--ink-2);
}

.menu button:hover { background: #f0f4ee; }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover { background: #fcf0ee; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* ---------------------------------------------------------------- 地图 */

.map-shell {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #dfe7dd;
}

.map-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

#map {
  position: absolute;
  inset: 0;
  background: #e4eae1;
  font-family: var(--sans);
}

.map-tools {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 500;
  display: flex;
  gap: 6px;
}

.seg {
  display: flex;
  padding: 2px;
  background: rgba(255, 255, 255, .95);
  border: 1px solid rgba(21, 41, 33, .13);
  border-radius: 9px;
  box-shadow: 0 3px 10px rgba(15, 35, 28, .12);
  backdrop-filter: blur(6px);
}

.seg button {
  height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: none;
  font-size: 14px;
  color: var(--muted);
}

.seg button.on {
  background: var(--accent-deep);
  color: #eefaf4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

.map-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(21, 41, 33, .13);
  border-radius: 9px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 3px 10px rgba(15, 35, 28, .12);
  font-size: 14px;
  color: var(--ink-2);
  backdrop-filter: blur(6px);
}

.map-btn:hover { background: #fff; }

.map-btn.icon-only {
  width: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.edit-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 520;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 8px 13px;
  border-radius: 9px;
  background: var(--accent-deep);
  color: #eaf7f0;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(8, 35, 28, .25);
  opacity: 0;
  transform: translate(-50%, -10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  white-space: nowrap;
}

body.editing .edit-bar {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

body.editing #map { cursor: crosshair; }

.edit-bar .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8fe0bd;
  box-shadow: 0 0 0 0 rgba(143, 224, 189, .6);
  animation: pulse 1.8s infinite;
}

.edit-bar button {
  height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 6px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 13px;
}

.edit-bar button:hover { background: rgba(255, 255, 255, .18); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(143, 224, 189, .55); }
  70% { box-shadow: 0 0 0 7px rgba(143, 224, 189, 0); }
  100% { box-shadow: 0 0 0 0 rgba(143, 224, 189, 0); }
}

.map-status {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 500;
  padding: 5px 8px;
  border: 1px solid rgba(21, 41, 33, .1);
  border-radius: 6px;
  background: rgba(255, 255, 255, .9);
  color: #617067;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: -.02em;
  backdrop-filter: blur(5px);
  pointer-events: none;
}

/* ---------------------------------------------------------------- DAS 瀑布图 */

.waterfall-panel {
  position: relative;
  flex: 0 0 auto;
  /* 默认可视区 300 + 头部/底部提示条 + 横向滚动条（JS 按实际 chrome 精确重设） */
  height: 384px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(15, 52, 46, .2);
  background: #0d1a16;
  color: #dcebe3;
}

/* 顶部拖拽把手：上下拖动调整面板高度 */
.wf-resizer {
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 9px;
  z-index: 30;
  cursor: ns-resize;
  touch-action: none;
}

.wf-resizer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  width: 44px;
  height: 3px;
  margin-left: -22px;
  border-radius: 999px;
  background: rgba(220, 240, 230, .32);
  transition: background .15s ease;
}

.wf-resizer:hover::after,
.waterfall-panel.resizing .wf-resizer::after { background: #7fd3b8; }

.wf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 6px 12px;
  background: #12211c;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.wf-head-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.wf-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
  color: #cfe4da;
  white-space: nowrap;
}

.wf-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: #7f9a8e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 历史瀑布图切换下拉（深色瀑布图头部内） */
.wf-select {
  height: 28px;
  max-width: 240px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  background: rgba(255, 255, 255, .05);
  color: #cfe4da;
  font-size: 13px;
  font-family: var(--mono);
  align-self: center;
  flex: 0 0 auto;
}

.wf-select:focus { outline: none; border-color: rgba(255, 255, 255, .3); }

.wf-select option { background: #12211c; color: #cfe4da; }

/* 横向缩放控制组：紧跟瀑布图切换下拉框右侧，靠左对齐 */
.wf-zoom {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  align-self: center;
}

.wf-zoom .wf-btn { padding: 0 8px; }

.wf-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.wf-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  background: rgba(255, 255, 255, .05);
  color: #cfe4da;
  font-size: 13px;
  transition: background .15s ease, border-color .15s ease;
}

.wf-btn:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .24); }
.wf-btn.on { background: #1f8a6d; border-color: #1f8a6d; color: #fff; }
.wf-btn.danger { color: #f3b4a8; }
.wf-btn.danger:hover { background: rgba(220, 80, 60, .2); border-color: rgba(220, 80, 60, .45); }
.wf-btn.ghost { color: #93aa9e; }

.wf-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.wf-scroll {
  height: 100%;
  /* 纵向滚动条常驻：矮图垂直拉伸填满后无内容可滚，滚动槽以禁用态显示，保持布局稳定 */
  overflow-y: scroll;
  overflow-x: auto;
  background: #08110e;
}

/* 矮图垂直拉伸：图片拉满可视区（canvas 高度由 JS 按滚动内容区精确设定，避免被横向滚动条遮挡） */
.waterfall-panel.fill-height .wf-canvas img { height: 100%; }

.wf-canvas {
  position: relative;
  width: 100%;
  line-height: 0;
}

.wf-canvas img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  cursor: crosshair;
}

.wf-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wf-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: #ff36c7;
  box-shadow: 0 0 8px rgba(255, 54, 199, .6);
  pointer-events: auto;
  cursor: ew-resize;
}

/* 命中热区：视觉线仅 2px 宽，鼠标难以精确点中（点击落在图片上只会弹距离气泡，
   表现为「无法选中/拖动/删除」）。用透明伪元素把可点区域扩为左右各 8px，
   事件仍由标注线自身处理，视觉不变。 */
.wf-mark::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -8px;
  width: 17px;
}

.wf-mark.dragging { box-shadow: 0 0 14px rgba(255, 130, 220, .98); opacity: .92; }

/* 标签固定层：sticky 吸附在可视区顶部，水平与图片对齐（宽度随画布），滚动时标签不消失 */
.wf-mark-labels {
  position: sticky;
  top: 0;
  width: 100%;
  height: 0;
  z-index: 6;
  pointer-events: none;
}

.wf-mark-label {
  position: absolute;
  top: 3px;
  margin-left: 2px;
  padding: 1px 5px;
  border: 1px solid rgba(255, 54, 199, .5);
  border-radius: 3px;
  background: rgba(12, 8, 16, .85);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  /* 默认隐藏，鼠标悬停对应标注线或拖动时才显示 */
  visibility: hidden;
  opacity: 0;
  transition: opacity .12s ease;
}

.wf-mark-label.show,
.wf-mark-label.dragging {
  visibility: visible;
  opacity: 1;
}

.wf-mark-label.flip { transform: translateX(-100%); margin-left: -2px; }

.wf-mark-label.dragging {
  box-shadow: 0 0 10px rgba(255, 130, 220, .85);
  background: rgba(42, 10, 32, .92);
}

.wf-pending {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, .8);
  animation: wfPulse 1s ease-in-out infinite;
  pointer-events: none;
}

/* 地图选中位置在瀑布图上的投影高亮线（白色虚线，与待定标注区分） */
.wf-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  margin-left: -1px;
  border-left: 2px dashed rgba(255, 255, 255, .95);
  box-shadow: 0 0 8px rgba(255, 255, 255, .4);
  pointer-events: none;
  z-index: 2;
}

@keyframes wfPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.wf-tip {
  position: absolute;
  z-index: 8;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 7px;
  background: rgba(6, 14, 11, .94);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
  color: #e6f2eb;
  font-size: 13px;
  line-height: 1.55;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
}

.wf-tip b { font-family: var(--mono); font-size: 14px; color: #8ff0c8; }
.wf-tip .wf-tip-row { display: flex; justify-content: space-between; gap: 14px; }
.wf-tip .wf-tip-key { color: #8aa196; }

.wf-foot {
  padding: 4px 12px 5px;
  border-top: 1px solid rgba(255, 255, 255, .05);
  background: #12211c;
  color: #7f9a8e;
  font-size: 12px;
}

.wf-foot.binding { color: #f5c46b; }

.wf-hint {
  position: absolute;
  left: 50%;
  bottom: 34px;
  z-index: 500;
  transform: translateX(-50%);
  height: 32px;
  padding: 0 14px;
  border: 1px solid rgba(15, 107, 92, .35);
  border-radius: 9px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 6px 18px rgba(15, 35, 28, .18);
  color: var(--accent-deep);
  font-size: 14px;
  backdrop-filter: blur(6px);
}

.wf-hint:hover { background: #fff; border-color: var(--accent); }

/* 收起瀑布图后的展开入口 */
.wf-reopen {
  position: absolute;
  left: 50%;
  bottom: 34px;
  z-index: 501;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid rgba(127, 211, 184, .35);
  border-radius: 9px;
  background: #12211c;
  color: #cfe4da;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(15, 35, 28, .24);
}

.wf-reopen svg { flex: 0 0 auto; color: #7fd3b8; }
.wf-reopen:hover { background: #173028; border-color: rgba(127, 211, 184, .55); }

.wf-check {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  background: #f6f8f4;
  color: var(--ink-2);
}

.wf-check.warn { background: #fdf3e6; color: #8a4b12; }
.wf-check b { font-family: var(--mono); }

.map-legend {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 500;
  width: 168px;
  padding: 0;
  border: 1px solid rgba(21, 41, 33, .11);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 4px 14px rgba(15, 35, 28, .12);
  backdrop-filter: blur(6px);
  overflow: hidden;
}

.legend-head {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: 0;
  background: none;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
}

.legend-head em {
  font-style: normal;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0;
}

.legend-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 8px;
  padding: 0 10px 9px;
}

.map-legend.collapsed .legend-body { display: none; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
}

.legend-item svg { flex: 0 0 auto; }

.legend-line {
  display: flex;
  align-items: center;
  gap: 6px;
  grid-column: 1 / -1;
  padding-top: 3px;
  font-size: 11px;
  color: var(--ink-2);
}

.legend-line-swatch {
  display: block;
  width: 26px;
  height: 3.5px;
  border-radius: 2px;
  background: #0f6b5c;
  box-shadow: 0 0 0 1.5px #fff;
}

.legend-line-swatch.pole { background: #8a6d3b; }
.legend-line-swatch.water { background: #2e86ab; }

.legend-dot-swatch {
  display: block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin: 0 9px;
  border-radius: 50%;
  background: #ff36c7;
  border: 1px solid #ffffff;
  box-shadow: 0 0 4px rgba(255, 54, 199, .55);
}

.mobile-toggle { display: none; }

.scrim { display: none; }

/* ---------------------------------------------------------------- Leaflet 覆盖 */

.leaflet-container { background: #e4eae1; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 3px 10px rgba(15, 35, 28, .14) !important; }
.leaflet-control-zoom a {
  width: 30px !important;
  height: 30px !important;
  line-height: 29px !important;
  color: var(--ink-2) !important;
  background: rgba(255, 255, 255, .96) !important;
  border-color: var(--line) !important;
  font-size: 19px !important;
}
.leaflet-control-zoom a:hover { background: #fff !important; }

.leaflet-control-scale-line {
  border-color: rgba(21, 41, 33, .35) !important;
  color: #4f5f56 !important;
  background: rgba(255, 255, 255, .78) !important;
  font-size: 11px !important;
  padding: 1px 4px !important;
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, .78) !important;
  color: #7b877f !important;
  font-size: 11px !important;
  padding: 1px 5px !important;
}
.leaflet-control-attribution a { color: #5e6f65 !important; }

.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 12px 40px rgba(10, 32, 25, .22) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
  line-height: 1.45 !important;
}

.leaflet-popup-tip { box-shadow: 0 3px 10px rgba(10, 32, 25, .12) !important; }

.leaflet-popup-close-button {
  top: 7px !important;
  right: 7px !important;
  width: 28px !important;
  height: 28px !important;
  font-size: 20px !important;
  line-height: 28px !important;
  color: #8b978f !important;
  border-radius: 50%;
}
.leaflet-popup-close-button:hover { background: #f1f4ee; color: var(--ink) !important; }

.pop {
  min-width: 270px;
  padding: 14px 16px 13px;
}

.pop-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .01em;
}

.pop-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f2f5ef;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 12px;
}

.pop h3 {
  margin: 8px 0 10px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.35;
  padding-right: 16px;
  word-break: break-all;
}

.pop-grid {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 5px 8px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.pop-grid dt { color: var(--faint); }
.pop-grid dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
  word-break: break-all;
}
.pop-grid dd.plain { font-family: var(--sans); font-size: 13px; }

.pop-note {
  margin: 9px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  max-height: 60px;
  overflow: auto;
}

.pop-actions {
  display: flex;
  gap: 7px;
  margin-top: 11px;
}

.pop-actions button {
  flex: 1;
  height: 29px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  color: var(--ink-2);
}
.pop-actions button:hover { background: #f2f6ef; }
.pop-actions button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pop-actions button.primary:hover { background: #0c5b4e; }

/* 点位符号 */
.pt-marker-wrap {
  background: none !important;
  border: 0 !important;
  position: absolute;
}

.pt-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  filter: drop-shadow(0 1px 2px rgba(12, 32, 25, .32));
  transition: transform .13s ease;
}

.key-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #b7791f;
  border: 1px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(183, 121, 31, .25);
}

.pt-marker-wrap:hover { z-index: 9999 !important; }
.pt-marker-wrap:hover .pt-marker { transform: scale(1.22); }
.pt-marker-wrap.is-hovered .pt-marker { transform: scale(1.22); }

.pt-marker-wrap.is-selected .pt-marker { transform: scale(1.34); }

.pt-marker-wrap.is-selected::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1.5px solid rgba(15, 107, 92, .65);
  border-radius: 50%;
  animation: marker-ring 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes marker-ring {
  0% { transform: scale(.85); opacity: .85; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* 瀑布图标注联动闪烁：选中/拖动标注点时，地图上对应点位放大闪烁并带粉色扩散环 */
.pt-marker-wrap.wf-map-flash .pt-marker {
  transform: scale(1.4);
  animation: wf-map-blink .6s ease-in-out infinite;
}

.pt-marker-wrap.wf-map-flash::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1.5px solid rgba(255, 54, 199, .75);
  border-radius: 50%;
  animation: marker-ring 1s ease-out infinite;
  pointer-events: none;
}

@keyframes wf-map-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

/* 未绑定信息点的标注：按里程在路线上显示的临时闪烁点 */
.wf-flash-icon { background: none !important; border: 0 !important; }

/* 瀑布图标注点在地图上的常驻 pin（品红） */
.wf-mark-pin-icon { background: none !important; border: 0 !important; }

.wf-mark-pin {
  display: block;
  width: 8px;
  height: 8px;
  margin: 1px;
  border-radius: 50%;
  background: #ff36c7;
  border: 1px solid #ffffff;
  box-shadow: 0 0 5px rgba(255, 54, 199, .85);
}

.wf-flash-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 1px;
  border-radius: 50%;
  background: #ff36c7;
  box-shadow: 0 0 0 3px rgba(255, 54, 199, .3), 0 0 12px rgba(255, 54, 199, .85);
  animation: wf-map-blink .6s ease-in-out infinite;
}

.pt-tip {
  border: 0 !important;
  border-radius: 5px !important;
  background: rgba(18, 40, 32, .92) !important;
  color: #eef7f1 !important;
  font-size: 13px !important;
  padding: 4px 7px !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .2) !important;
}
.pt-tip::before { border-top-color: rgba(18, 40, 32, .92) !important; }

/* 里程标签 */
.chainage-label {
  background: rgba(255, 255, 255, .93);
  border: 1px solid rgba(21, 60, 47, .16);
  border-radius: 4px;
  color: #52645a;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(15, 35, 28, .12);
  pointer-events: none;
}

/* 新增点临时标记 */
.temp-marker-icon {
  background: none !important;
  border: 0 !important;
}

.temp-marker {
  position: relative;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}

.temp-marker span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0f6b5c;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(8, 35, 28, .45);
}

.temp-marker::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(15, 107, 92, .55);
  border-radius: 50%;
  animation: temp-pulse 1.4s ease-out infinite;
}

@keyframes temp-pulse {
  0% { transform: scale(.55); opacity: .9; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* 起终点 */
.endpoint-icon {
  background: none !important;
  border: 0 !important;
}

.endpoint {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(8, 35, 28, .35);
}

.endpoint.end { background: #b7791f; }

/* ---------------------------------------------------------------- 对话框 */

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  max-width: none;
  max-height: none;
}

dialog::backdrop {
  background: rgba(10, 28, 22, .38);
  backdrop-filter: blur(2px);
}

.dlg {
  width: min(560px, calc(100vw - 28px));
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(8, 26, 20, .35);
  animation: dlg-in .18s ease;
}

@keyframes dlg-in {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.dlg-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.dlg-head > div { flex: 1; min-width: 0; }

.dlg-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: .01em;
}

.dlg-head p {
  margin: 5px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.dlg-close { width: 30px; height: 30px; flex-basis: 30px; }

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 132px;
  padding: 18px;
  border: 1.5px dashed #c8d5c9;
  border-radius: 11px;
  background: #f8faf6;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.drop:hover, .drop.dragover {
  border-color: var(--accent);
  background: #f1f8f3;
}

.drop.has-file {
  border-style: solid;
  border-color: #a9cdb7;
  background: #f2f8f3;
}

.drop-icon { color: #7fa391; margin-bottom: 2px; }

.drop strong { font-size: 14px; font-weight: 600; }
.drop span { font-size: 13px; color: var(--faint); }

fieldset.coords {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

fieldset.coords legend {
  padding: 0;
  margin-bottom: 7px;
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--faint);
}

.radio {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}

.radio:hover { border-color: #c2d2c2; background: #fafbf8; }
.radio input { margin-top: 2px; accent-color: var(--accent); }
.radio b { display: block; font-size: 14px; font-weight: 600; }
.radio small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); line-height: 1.5; }

.radio:has(input:checked) {
  border-color: #a8cbb7;
  background: #f2f9f4;
}

.hint {
  margin: 11px 0 0;
  padding: 9px 11px;
  border-radius: 7px;
  background: #f7f8f3;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.dlg-error {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 7px;
  background: #fdf0ee;
  color: #9a352c;
  font-size: 14px;
  line-height: 1.5;
}

.dlg-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.dlg-foot .btn { margin-left: auto; }
.dlg-foot .btn + .btn { margin-left: 0; }
.dlg-foot .btn-danger-ghost { margin-left: 0; }
.spacer { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #0c5b4e; border-color: #0c5b4e; }
.btn-primary:disabled { opacity: .55; cursor: default; }

.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover { background: #f4f7f1; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #9f3027; }

.btn-danger-ghost { background: #fff; border-color: #eccfca; color: var(--danger); }
.btn-danger-ghost:hover { background: #fdf1ef; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px 12px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
}

.form-grid label.full { grid-column: 1 / -1; }

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 8px 9px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  resize: vertical;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: #93bda8;
  box-shadow: 0 0 0 3px rgba(15, 107, 92, .08);
}

.form-grid label.checkline {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  margin-top: 2px;
  font-size: 14px;
  color: var(--ink-2);
}
.form-grid label.checkline input { width: 14px; height: 14px; accent-color: var(--accent); }

/* 区间管理对话框：每个区间一张卡片，特殊点位为键值对列表 */
.zone-dlg { width: min(640px, calc(100vw - 28px)); } /* 与 app.js placeZoneWindow 的默认停靠宽度保持一致 */

/* 区间管理：无遮罩浮动窗（非模态），背景地图/瀑布图不模糊、可继续操作；
   位置由 JS 控制并可拖动标题栏移动 */
dialog.zone-window {
  position: fixed;
  inset: auto;
  margin: 0;
  z-index: 1200;
}

dialog.zone-window .dlg-head {
  cursor: move;
  user-select: none;
  touch-action: none;
}

dialog.zone-window .dlg-head.dragging { cursor: grabbing; }
dialog.zone-window .dlg-head button { cursor: pointer; }
dialog.zone-window .zone-dlg { box-shadow: 0 24px 64px rgba(8, 26, 20, .45); }

.zone-body {
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 2px;
}

.zone-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px 13px;
  margin-bottom: 10px;
  background: #fcfdfa;
}

.zone-card:last-child { margin-bottom: 0; }

.zone-card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.zone-card-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}

.zone-card-range {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.zone-card .form-grid { grid-template-columns: 1.6fr 1fr; } /* 名称+阈值一行，时长+类型一行 */

.zone-sp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
  font-size: 13px;
  color: var(--muted);
}

.zone-sp-head .text-btn {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--accent-deep);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
}

.zone-sp-head .text-btn:hover { text-decoration: underline; }

.zone-sp-list { margin-top: 7px; display: grid; gap: 6px; }

.zone-sp-row {
  display: grid;
  grid-template-columns: 1fr 1fr 30px;
  gap: 8px;
  align-items: center;
}

.zone-sp-row input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  font-variant-numeric: tabular-nums;
}

.zone-sp-row input:focus {
  border-color: #93bda8;
  box-shadow: 0 0 0 3px rgba(15, 107, 92, .08);
}

.zone-sp-del {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: #b23b3b;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.zone-sp-del:hover { background: rgba(178, 59, 59, .08); }

.zone-sp-empty {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--muted);
}

.zone-count {
  margin-left: auto;
  margin-right: 10px;
  font-size: 13px;
  color: var(--muted);
}

/* 区间定位闪烁：瀑布图上品红色带（透明度 50%），与地图品红线段同步闪烁 3 秒 */
.wf-zone-flash {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #ff00ff;
  opacity: .5;
  pointer-events: none;
  z-index: 1;
}

/* 区间卡片标题：点击定位该区间 */
.zone-locate {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.zone-locate:hover { color: #c026d3; text-decoration: underline dotted; }

.zone-locate:focus-visible {
  outline: 2px solid rgba(192, 38, 211, .35);
  outline-offset: 2px;
  border-radius: 3px;
}

.zone-body::-webkit-scrollbar { width: 8px; }
.zone-body::-webkit-scrollbar-thumb { background: rgba(15, 107, 92, .18); border-radius: 4px; }

@media (max-width: 720px) {
  .zone-count { display: none; }
}

/* 路线对话框：浅绿信息块（设备名称、纤芯-通道对应共用同一背景） */
.rf-box {
  margin-top: 12px;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafbf8;
}

/* 设备名称 / 编号块 */
.rf-device-box label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.rf-device-box input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 8px 9px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}

.rf-device-box input:focus { border-color: #93bda8; box-shadow: 0 0 0 3px rgba(15, 107, 92, .08); }

.rf-device-tip { margin: 7px 0 0; font-size: 12px; color: var(--faint); line-height: 1.55; }

.rf-channels-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rf-channels-title { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.rf-channels-add {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  font-size: 13px;
  color: var(--accent-deep);
}

.rf-channels-add:hover { background: var(--accent-soft); border-color: #93bda8; }

.rf-channel-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.rf-channel-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.rf-row-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rf-row-arrow { color: var(--faint); font-size: 12px; }

.rf-channel-row input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 7px 8px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}

.rf-channel-row input:focus { border-color: #93bda8; box-shadow: 0 0 0 3px rgba(15, 107, 92, .08); }

.rf-row-del {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--danger);
  font-size: 13px;
  line-height: 1;
}

.rf-row-del:hover { background: #fcf0ee; border-color: #eccfca; }

.rf-channels-empty { margin: 8px 0 0; font-size: 12px; color: var(--faint); line-height: 1.55; }

.meta-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7f9f5;
  border: 1px solid #ebefe6;
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
}

.meta-box b { color: var(--ink-2); font-weight: 600; }
.meta-box code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.confirm { width: min(430px, calc(100vw - 32px)); }
.confirm .dlg-head { margin-bottom: 4px; }
.confirm .dlg-foot { justify-content: flex-end; }

/* 数据体检 */
#diagDialog .dlg {
  display: flex;
  flex-direction: column;
  width: min(620px, calc(100vw - 28px));
  overflow: hidden;
}

#diagDialog .dlg-head,
#diagDialog .dlg-foot { flex: 0 0 auto; }

#diagDialog .diag-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

#diagSub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diag-body { font-size: 14px; }

.diag-source {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 9px;
  background: #f1f8f3;
  border: 1px solid #dcebe0;
  margin-bottom: 14px;
}

.diag-source .badge {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  letter-spacing: .04em;
}

.diag-source p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--ink-2); }

.diag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 14px;
}

.diag-cell {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcf9;
}

.diag-cell b {
  display: block;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.diag-cell span { display: block; margin-top: 3px; font-size: 11px; color: var(--faint); }

.diag-table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0 14px;
  font-size: 13px;
}

.diag-table th, .diag-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.diag-table th:first-child, .diag-table td:first-child { text-align: left; }
.diag-table th { background: #f7f9f5; color: #617067; font-weight: 600; font-size: 12px; }
.diag-table td { font-family: var(--mono); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.diag-table tr.best td { color: var(--accent); font-weight: 600; background: #f4faf6; }

.diag-section-title {
  margin: 16px 0 7px;
  padding-top: 10px;
  border-top: 1px solid #edf0ea;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  color: #66756c;
}

.diag-warn {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
  color: #8a5a1c;
}

.diag-warn li { margin: 2px 0; }

.type-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 5px;
  background: #f4f6f1;
  font-size: 12px;
  color: var(--ink-2);
}
.type-pill b { font-family: var(--mono); font-weight: 600; color: var(--muted); }

/* ---------------------------------------------------------------- Toast */

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 4000;
  max-width: min(460px, calc(100vw - 32px));
  padding: 10px 15px;
  border-radius: 8px;
  background: #12261f;
  color: #eaf6ef;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 12px 35px rgba(8, 28, 21, .3);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: #7d2b24; }

/* ---------------------------------------------------------------- 滚动条 */

.point-list::-webkit-scrollbar,
.dlg::-webkit-scrollbar,
.diag-body::-webkit-scrollbar,
.pop-note::-webkit-scrollbar {
  width: 7px;
}

.point-list::-webkit-scrollbar-thumb,
.dlg::-webkit-scrollbar-thumb,
.diag-body::-webkit-scrollbar-thumb,
.pop-note::-webkit-scrollbar-thumb {
  background: #d3dcd2;
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.point-list::-webkit-scrollbar-thumb:hover,
.dlg::-webkit-scrollbar-thumb:hover,
.diag-body::-webkit-scrollbar-thumb:hover { background: #bcc9ba; background-clip: padding-box; }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1100px) {
  .map-legend { display: none; }
}

@media (max-width: 900px) {
  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(90vw, 396px);
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 18px 0 50px rgba(8, 28, 21, .24);
  }

  body.sidebar-open .sidebar { transform: none; }

  .scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 610;
    background: rgba(10, 28, 22, .35);
    backdrop-filter: blur(1px);
  }

  body.sidebar-open .scrim { display: block; }

  .mobile-toggle {
    display: grid;
    place-items: center;
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 505;
    width: 37px;
    height: 37px;
    border: 1px solid rgba(21, 41, 33, .13);
    border-radius: 9px;
    background: rgba(255, 255, 255, .95);
    color: var(--ink-2);
    box-shadow: 0 3px 10px rgba(15, 35, 28, .14);
    backdrop-filter: blur(6px);
  }

  .map-tools { top: 14px; right: 12px; }
  .edit-bar {
    top: auto;
    bottom: 52px;
    max-width: calc(100vw - 28px);
    white-space: normal;
  }
  .map-status { display: none; }
  .mobile-close { display: inline-flex !important; }
  .brand { padding-top: 16px; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .diag-grid { grid-template-columns: 1fr 1fr; }
  .seg button { padding: 0 8px; }
  .map-btn { padding: 0 9px; }
  .edit-bar span:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}