
/* ── Debug 模式 ── */
.debug-mode-banner {
  background: rgba(244, 114, 182, 0.12);
  border-bottom: 1px solid rgba(244, 114, 182, 0.35);
  color: #f9a8d4;
  font-size: 12px;
  text-align: center;
  padding: 6px 12px;
}

.debug-mode-banner[hidden] { display: none !important; }

/* ── Palantir / Blueprint 风格主题 ── */
:root {
  --pt-bg-app: #0d1219;
  --pt-bg-panel: #121822;
  --pt-bg-elevated: #182030;
  --pt-bg-hover: #243247;
  --pt-bg-input: #0a0e14;
  --pt-border: #243247;
  --pt-border-strong: #355070;
  --pt-border-subtle: #1a2433;
  --pt-text: #d7e0ea;
  --pt-text-muted: #7f8ea3;
  --pt-text-dim: #5a6778;
  --pt-accent: #38bdf8;
  --pt-accent-dim: #0ea5e9;
  --pt-accent-glow: rgba(56, 189, 248, 0.18);
  --pt-accent-2: #2dd4bf;
  --pt-accent-2-dim: rgba(45, 212, 191, 0.08);
  --pt-secondary-dark: #394b59;
  --pt-success: #22c55e;
  --pt-warning: #f97316;
  --pt-danger: #f87171;
  --pt-radius: 2px;
  --pt-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pt-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.app-shell {
  font-family: var(--pt-font);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.045), transparent 140px),
    var(--pt-bg-app);
  color: var(--pt-text);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.header {
  background: rgba(13, 18, 25, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--pt-text);
  padding: 0 20px;
  min-height: 56px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--pt-border);
}

.header-metrics {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 0;
  padding: 4px 0;
}

.header-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 18px;
  border-left: 1px solid var(--pt-border-subtle);
}

.header-metric:first-child {
  border-left: none;
}

.header-metric-value {
  font-family: var(--pt-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--pt-accent);
  line-height: 1.2;
  white-space: nowrap;
}

.header-metric-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pt-text-dim);
  white-space: nowrap;
}

.header-metric.is-loading .header-metric-value {
  color: var(--pt-text-dim);
  font-weight: 500;
}

@media (max-width: 1100px) {
  .header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 10px 16px;
    padding: 10px 16px;
  }

  .header-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .header-controls {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .header-metrics {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .header-metrics::-webkit-scrollbar {
    display: none;
  }
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  flex-shrink: 0;
  color: var(--pt-accent);
  font-size: 16px;
  line-height: 1;
  text-shadow: 0 0 12px var(--pt-accent-glow);
}

.header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--pt-text);
}

.header-subtitle {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pt-text-dim);
  padding-left: 10px;
  border-left: 1px solid var(--pt-border);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.source-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-switcher-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pt-text-muted);
}

.source-switch-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  background: var(--pt-bg-input);
  color: var(--pt-text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.source-switch-btn:hover:not(:disabled) {
  color: var(--pt-text);
  background: var(--pt-bg-hover);
  border-color: var(--pt-accent);
}

.source-switch-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.source-current-name {
  min-width: 168px;
  max-width: 260px;
  padding: 4px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--pt-text);
  background: var(--pt-bg-elevated);
  border: 1px solid var(--pt-border-subtle);
  border-radius: var(--pt-radius);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs {
  display: flex;
  gap: 6px;
}

.tab {
  background: var(--pt-bg-elevated);
  border: 1px solid var(--pt-border);
  color: var(--pt-text-muted);
  padding: 7px 14px;
  border-radius: var(--pt-radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--pt-font);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--pt-text);
  background: var(--pt-bg-hover);
  border-color: var(--pt-border-strong);
}

.tab.active {
  color: var(--pt-accent-2);
  background: var(--pt-accent-2-dim);
  border-color: var(--pt-border-strong);
}

/* ── Layout ── */
.main { flex: 1; display: flex; min-height: 0; }

/* ── Footer ── */
.app-footer {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 20px;
  background: rgba(13, 18, 25, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--pt-border);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--pt-text-muted);
}

.app-footer-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    90deg,
    rgba(45, 212, 191, 0.14) 0%,
    rgba(56, 189, 248, 0.32) 55%,
    rgba(56, 189, 248, 0.22) 100%
  );
  transition: width 0.35s ease;
}

.app-footer.has-progress {
  border-top-color: rgba(56, 189, 248, 0.35);
}

.app-footer.has-progress .app-footer-status {
  color: var(--pt-text);
}

.app-footer-status {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-footer-author {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  color: var(--pt-text-dim);
  letter-spacing: 0.02em;
}

.map-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0a0c0f;
  position: relative;
}

.map { flex: 1; min-width: 0; min-height: 0; position: relative; z-index: 0; }
#map { width: 100%; height: 100%; -webkit-tap-highlight-color: transparent; }

.leaflet-container path.leaflet-interactive { outline: none; }

/* 仅暗化底图瓦片，轨迹/标注层不受影响 */
.leaflet-tile-pane {
  filter: brightness(0.78) saturate(0.88) contrast(1.05);
}

.trip-timeline-panel {
  flex-shrink: 0;
  height: 240px;
  background: var(--pt-bg-panel);
  border-top: 1px solid var(--pt-border);
  padding: 8px 12px 4px;
  display: flex;
  flex-direction: column;
}

.trip-timeline-panel.hidden { display: none; }

.trip-timeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.trip-timeline-head h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pt-text-muted);
}

.trip-timeline-hint {
  font-size: 10px;
  color: var(--pt-text-dim);
  white-space: nowrap;
  font-family: var(--pt-mono);
}

.trip-timeline-chart { flex: 1; min-height: 0; width: 100%; }


/* 禁止点击 S2 格子时 SVG 路径出现浏览器焦点矩形框 */
.leaflet-overlay-pane path.leaflet-interactive:focus,
.leaflet-overlay-pane path.leaflet-interactive:focus-visible {
  outline: none !important;
}

.leaflet-overlay-pane svg:focus,
.leaflet-overlay-pane svg:focus-visible {
  outline: none !important;
}

/* ── Leaflet 控件（已禁用 zoom / attribution） ── */
.leaflet-control-zoom,
.leaflet-control-attribution {
  display: none !important;
}

/* ── 热力图图例（地图左下角） ── */
.heat-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1000;
  width: max-content;
  max-width: min(168px, calc(100vw - 48px));
  padding: 7px 8px;
  background: rgba(13, 18, 25, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  user-select: none;
}

.heat-legend-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 7px;
}

.heat-legend-bar {
  width: 10px;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 72px;
  border-radius: 2px;
  border: 1px solid var(--pt-border);
  background: linear-gradient(to top, #2b2d42, #e63946);
}

.heat-legend-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.heat-legend-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--pt-text);
  white-space: nowrap;
}

.heat-legend-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-height: 36px;
  gap: 2px;
}

.heat-legend-label-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.heat-legend-tag {
  font-size: 9px;
  color: var(--pt-text-dim);
  flex-shrink: 0;
}

.heat-legend-label {
  font-family: var(--pt-mono);
  font-size: 10px;
  color: var(--pt-text);
  line-height: 1.2;
}


.heat-legend-cmap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.heat-legend-cmap-label {
  font-size: 9px;
  color: var(--pt-text-dim);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* Palantir 风格自定义下拉（替代原生 select 白底菜单） */
.heat-cmap-select.pt-select {
  position: relative;
  flex: 1;
  min-width: 0;
}
.pt-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  padding: 3px 6px;
  font-size: 9px;
  font-family: inherit;
  line-height: 1.3;
  border: 1px solid var(--pt-border);
  border-radius: 2px;
  background: var(--pt-bg-input);
  color: var(--pt-text);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.pt-select-trigger:hover {
  background: var(--pt-bg-hover);
  border-color: var(--pt-border-strong);
}
.pt-select-trigger:focus {
  outline: none;
  border-color: var(--pt-accent);
  box-shadow: 0 0 0 1px var(--pt-accent-glow);
}
.pt-select-chevron {
  font-size: 8px;
  color: var(--pt-text-dim);
  flex-shrink: 0;
}
.pt-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  margin: 0;
  padding: 3px 0;
  list-style: none;
  background: var(--pt-bg-elevated);
  border: 1px solid var(--pt-border-strong);
  border-radius: var(--pt-radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.48);
  max-height: none;
  overflow: visible;
  z-index: 1100;
}
.heat-cmap-select .pt-select-menu {
  max-height: none;
  overflow: visible;
}

.pt-select-menu.hidden {
  display: none;
}
.pt-select-option {
  padding: 5px 8px;
  font-size: 9px;
  color: var(--pt-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}
.pt-select-option:hover {
  background: var(--pt-bg-hover);
  color: var(--pt-text);
}
.pt-select-option.is-active,
.pt-select-option[aria-selected="true"] {
  background: rgba(56, 189, 248, 0.12);
  color: var(--pt-accent);
}

.heat-legend-note {
  font-size: 9px;
  color: var(--pt-text-dim);
  line-height: 1.35;
}

/* ── 路径动画 ── */
.leaflet-overlay-pane svg path.route-flow-line {
  animation: route-flow 1.1s linear infinite;
}

@keyframes route-flow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -28; }
}

.route-arrow-leaflet-icon {
  background: transparent !important;
  border: none !important;
}

.route-arrow-svg {
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
  transform-origin: center center;
}

.leaflet-tooltip.point-time-label {
  font-family: var(--pt-mono);
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(16, 20, 24, 0.92);
  color: var(--pt-accent);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  white-space: nowrap;
  pointer-events: none;
}

.leaflet-tooltip.point-time-label.interpolated {
  color: #F472B6;
  font-size: 9px;
}

.leaflet-tooltip.point-time-label::before {
  border-top-color: var(--pt-border);
}

.btn.active-draw {
  box-shadow: 0 0 0 1px var(--pt-accent), 0 0 12px var(--pt-accent-glow);
}

/* ── Sidebars ── */
.sidebar {
  background: var(--pt-bg-panel);
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-left {
  width: 280px;
  border-right: 1px solid var(--pt-border);
}

.sidebar-right {
  width: 320px;
  border-left: 1px solid var(--pt-border);
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--pt-border);
  border-radius: 3px;
}

.panel { padding: 12px; }
.panel.hidden { display: none; }

.card {
  background: var(--pt-bg-elevated);
  border: 1px solid var(--pt-border-subtle);
  border-radius: var(--pt-radius);
  padding: 12px;
  margin-bottom: 10px;
}

.card h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--pt-accent-2);
}

.btn-row { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }

.btn {
  padding: 5px 12px;
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  background: transparent;
  color: var(--pt-text);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--pt-font);
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.btn:hover {
  background: var(--pt-bg-hover);
  border-color: var(--pt-text-dim);
}

.btn.primary {
  background: var(--pt-accent-dim);
  color: var(--pt-text);
  border-color: rgba(46, 168, 255, 0.5);
}

.btn.primary:hover {
  background: #1a8cd4;
  border-color: var(--pt-accent);
}

.btn.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.full { width: 100%; margin-top: 4px; }

.mode-btn.active {
  background: var(--pt-secondary-dark);
  color: var(--pt-text);
  border-color: var(--pt-border);
  box-shadow: inset 0 0 0 1px var(--pt-accent-glow);
}

.slider-label {
  display: block;
  font-size: 11px;
  color: var(--pt-text-muted);
  margin-top: 10px;
  letter-spacing: 0.02em;
}

.slider-label span {
  font-family: var(--pt-mono);
  color: var(--pt-accent);
  font-weight: 500;
}

.slider-label input[type="range"] {
  width: 100%;
  margin-top: 6px;
  height: 4px;
  appearance: none;
  background: var(--pt-border);
  border-radius: 2px;
  outline: none;
}

.slider-label input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 1px;
  background: var(--pt-accent);
  border: 1px solid var(--pt-bg-app);
  cursor: pointer;
}

.slider-hint {
  font-size: 10px;
  color: var(--pt-text-dim);
  margin-top: 6px;
  line-height: 1.5;
  font-family: var(--pt-mono);
}

#entitySelectWrap label {
  display: block;
  font-size: 11px;
  color: var(--pt-text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#entitySelectWrap select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 5px 8px;
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  background: var(--pt-bg-input);
  color: var(--pt-text);
  font-size: 12px;
}

/* ── 搜索结果 ── */
.card-results { padding-bottom: 8px; }

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.results-head h3 { margin-bottom: 0; }

.results-summary {
  font-family: var(--pt-mono);
  font-size: 10px;
  color: var(--pt-text-dim);
  white-space: nowrap;
}

.results-list {
  max-height: 380px;
  overflow-y: auto;
  font-size: 12px;
  padding-right: 2px;
}

.results-list::-webkit-scrollbar { width: 4px; }
.results-list::-webkit-scrollbar-thumb {
  background: var(--pt-border);
  border-radius: 2px;
}

.results-empty { text-align: center; padding: 24px 12px; color: var(--pt-text-dim); }
.results-empty-icon { font-size: 24px; margin-bottom: 8px; opacity: 0.4; }
.results-empty p { font-size: 13px; color: var(--pt-text-muted); margin-bottom: 4px; }
.results-empty span { font-size: 11px; }

.result-card {
  background: var(--pt-bg-panel);
  border: 1px solid var(--pt-border-subtle);
  border-radius: var(--pt-radius);
  margin-bottom: 6px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.result-card:hover {
  border-color: var(--pt-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.result-card.open {
  border-color: rgba(46, 168, 255, 0.45);
  box-shadow: 0 0 0 1px var(--pt-accent-glow);
}

.result-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  user-select: none;
}

.result-header:hover { background: var(--pt-bg-hover); }

.result-rank {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: var(--pt-radius);
  background: var(--pt-bg-elevated);
  color: var(--pt-text-muted);
  font-family: var(--pt-mono);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pt-border-subtle);
}

.result-card:nth-child(1) .result-rank {
  background: var(--pt-accent-dim);
  color: var(--pt-text);
  border-color: var(--pt-accent);
}

.result-card:nth-child(2) .result-rank {
  background: var(--pt-secondary-dark);
  color: var(--pt-text);
}

.result-card:nth-child(3) .result-rank {
  background: #2d4054;
  color: var(--pt-text);
}

.result-main { flex: 1; min-width: 0; }

.result-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.result-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--pt-text);
}

.result-name.mono {
  font-family: var(--pt-mono);
  font-size: 11px;
  font-weight: 500;
}

.result-meta { display: flex; align-items: center; gap: 8px; }

.result-meta-label {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pt-text-dim);
  min-width: 44px;
}

.result-chevron {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--pt-text-dim);
  transition: transform 0.15s, color 0.15s;
  transform: rotate(0deg);
  line-height: 1;
}

.result-card.open .result-chevron {
  transform: rotate(90deg);
  color: var(--pt-accent);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--pt-radius);
  font-family: var(--pt-mono);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-count {
  background: rgba(46, 168, 255, 0.12);
  color: var(--pt-accent);
  border-color: rgba(46, 168, 255, 0.25);
}

.badge-sim { background: var(--pt-bg-elevated); color: var(--pt-text-muted); border-color: var(--pt-border-subtle); }
.badge-sim.high { background: rgba(61, 204, 145, 0.12); color: var(--pt-success); border-color: rgba(61, 204, 145, 0.3); }
.badge-sim.mid { background: rgba(255, 179, 102, 0.12); color: var(--pt-warning); border-color: rgba(255, 179, 102, 0.3); }
.badge-sim.low { background: rgba(255, 115, 115, 0.12); color: var(--pt-danger); border-color: rgba(255, 115, 115, 0.3); }
.badge-sim.sm { font-size: 9px; padding: 1px 5px; }

.sim-bar {
  flex: 1;
  height: 3px;
  background: var(--pt-border);
  border-radius: 1px;
  overflow: hidden;
  min-width: 40px;
}

.sim-bar-fill { height: 100%; border-radius: 1px; transition: width 0.3s; }
.sim-bar-fill.high { background: var(--pt-success); }
.sim-bar-fill.mid { background: var(--pt-warning); }
.sim-bar-fill.low { background: var(--pt-danger); }
.sim-bar-fill.count { background: var(--pt-accent); }

.match-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 8px;
  border-top: 1px solid var(--pt-border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

.match-list.hidden { display: none; }

.match-item {
  padding: 7px 9px;
  margin-top: 5px;
  border-radius: var(--pt-radius);
  background: var(--pt-bg-elevated);
  border: 1px solid var(--pt-border-subtle);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.match-item:hover {
  border-color: rgba(46, 168, 255, 0.4);
  background: var(--pt-bg-hover);
}

.match-item.active {
  border-color: var(--pt-accent);
  background: rgba(46, 168, 255, 0.08);
  box-shadow: inset 2px 0 0 var(--pt-accent);
}

.match-item.loading { opacity: 0.5; pointer-events: none; }

.match-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.match-date {
  font-family: var(--pt-mono);
  font-size: 11px;
  color: var(--pt-text-muted);
  font-variant-numeric: tabular-nums;
}

.match-time-range {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.time-entry, .time-exit {
  font-family: var(--pt-mono);
  font-size: 10px;
  color: var(--pt-text-muted);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 4px;
}

.time-entry em, .time-exit em {
  font-style: normal;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 1px;
  flex-shrink: 0;
}

.time-entry em { background: rgba(61, 204, 145, 0.15); color: var(--pt-success); }
.time-exit em { background: rgba(255, 115, 115, 0.15); color: var(--pt-danger); }

.match-time { color: var(--pt-text-dim); margin-left: 6px; font-size: 10px; }

.match-action {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--pt-accent);
  opacity: 0;
  transition: opacity 0.12s;
}

.match-item:hover .match-action,
.match-item.active .match-action { opacity: 1; }

/* ── 频繁路线 ── */
#panelLeftFrequent {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.frequent-routes-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.frequent-routes-panel .results-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.frequent-routes-panel .results-summary {
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  width: 100%;
}

.frequent-routes-panel.hidden { display: none; }

.frequent-routes-panel .results-list {
  flex: 1;
  min-height: 120px;
  max-height: none;
}

.freq-list .result-card { margin-bottom: 6px; }

.freq-route-card {
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.freq-route-card:hover {
  border-color: rgba(46, 168, 255, 0.25);
}

.freq-route-card.active {
  border-color: var(--pt-accent);
  background: var(--pt-accent-dim);
  box-shadow: 0 0 0 1px var(--pt-accent-glow);
}

.freq-route-card .result-header {
  cursor: pointer;
}

.freq-route-card .result-chevron { display: none; }

.freq-entity-panel .results-empty {
  padding: 32px 12px;
}

.freq-entity-root {
  list-style: none;
  margin: 0;
  padding: 0;
}

.freq-entity-item {
  margin: 5px 0;
  border-radius: var(--pt-radius);
  background: var(--pt-bg-panel);
  border: 1px solid var(--pt-border-subtle);
  overflow: hidden;
}

.freq-entity-item.open { border-color: rgba(46, 168, 255, 0.35); }

.freq-l2 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  cursor: pointer;
  user-select: none;
  background: var(--pt-bg-elevated);
}

.freq-l2:hover { background: var(--pt-bg-hover); }

.freq-l2 .entity-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--pt-text);
}

.freq-l2 .result-chevron.sm { font-size: 13px; }

.freq-l3-list {
  list-style: none;
  margin: 0;
  padding: 5px 7px 7px;
  background: rgba(0, 0, 0, 0.12);
  border-top: 1px solid var(--pt-border-subtle);
}

.freq-l3-list.hidden { display: none; }
.freq-event-item { margin-top: 4px; }

.badge-entity {
  background: rgba(61, 204, 145, 0.12);
  color: var(--pt-success);
  border-color: rgba(61, 204, 145, 0.25);
}

.loading-item, .empty-item {
  padding: 10px;
  text-align: center;
  color: var(--pt-text-dim);
  font-size: 11px;
}

.hotspot-detail-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--pt-text-dim);
}

.hotspot-detail-empty p {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--pt-text-muted);
}

.hotspot-detail-empty span {
  font-size: 11px;
  line-height: 1.5;
}

.hotspot-cell-item { cursor: pointer; }
.hotspot-cell-item.active {
  border-color: var(--pt-accent);
  background: var(--pt-accent-dim);
  box-shadow: 0 0 0 1px var(--pt-accent-glow);
}

/* ── 数据概况 ── */
.overview-lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--pt-text);
}

.overview-meta {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overview-meta-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.overview-meta-row dt {
  margin: 0;
  color: var(--pt-text-muted);
  font-weight: 500;
}

.overview-meta-row dd {
  margin: 0;
  color: var(--pt-text);
}

.overview-ref {
  margin: 12px 0 0;
  font-size: 12px;
}

.overview-ref a {
  color: var(--pt-accent);
  text-decoration: none;
}

.overview-ref a:hover { text-decoration: underline; }

.overview-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.overview-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--pt-bg-elevated);
  border: 1px solid var(--pt-border-subtle);
  border-radius: var(--pt-radius);
}

.overview-stat-value {
  font-family: var(--pt-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--pt-text);
}

.overview-stat-label {
  font-size: 11px;
  color: var(--pt-text-muted);
}

.overview-local-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--pt-text-muted);
}

.overview-local-note strong {
  color: var(--pt-text);
  font-weight: 500;
}

/* ── 双侧栏通用 ── */
.sidebar-notes {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--pt-text-muted);
}

.sidebar-notes li + li { margin-top: 6px; }

.sidebar-notes strong { color: var(--pt-text); font-weight: 500; }

.sidebar-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--pt-text-muted);
}

.sidebar-steps li + li { margin-top: 6px; }

.sidebar-steps strong { color: var(--pt-text); font-weight: 500; }

.sidebar-details {
  margin: 0 12px 10px;
  border: 1px solid var(--pt-border-subtle);
  border-radius: var(--pt-radius);
  background: var(--pt-bg-elevated);
}

.sidebar-details summary {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pt-text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.sidebar-details summary::-webkit-details-marker { display: none; }

.sidebar-details summary::before {
  content: '▸ ';
  color: var(--pt-text-dim);
}

.sidebar-details[open] summary::before { content: '▾ '; }

.sidebar-details-body {
  margin: 0;
  padding: 0 10px 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--pt-text-muted);
}

.query-path-summary dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.query-path-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  font-size: 12px;
}

.query-path-row dt {
  color: var(--pt-text-muted);
  font-weight: 500;
}

.query-path-row dd {
  margin: 0;
  color: var(--pt-text);
  font-family: var(--pt-mono);
}


.track-point-setting-card h3 {
  margin-bottom: 10px;
}

.track-point-setting-card .seg-switch {
  margin-top: 0;
}

.seg-switch {
  display: flex;
  width: 100%;
  padding: 3px;
  border-radius: 999px;
  background: var(--pt-bg-input);
  border: 1px solid var(--pt-border);
  gap: 3px;
}

.seg-switch-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--pt-text-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.seg-switch-btn:hover:not(.active) {
  color: var(--pt-text);
  background: rgba(255, 255, 255, 0.04);
}

.seg-switch-btn.active {
  background: var(--pt-bg-elevated);
  color: var(--pt-accent-2);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--pt-accent-2-dim);
}

.detail-card.hidden { display: none; }

.detail-body dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.detail-row dt {
  color: var(--pt-text-muted);
  font-weight: 500;
}

.detail-row dd {
  margin: 0;
  color: var(--pt-text);
  word-break: break-all;
}

.detail-row dd.mono { font-family: var(--pt-mono); font-size: 11px; }

.card-results {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-right .panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sidebar-right .results-list {
  flex: 1;
  min-height: 120px;
  max-height: none;
}

.hidden { display: none !important; }


.chart { height: 200px; }

.hotspot-freq-chart { height: 200px; min-height: 200px; }

/* ── 选中格子详情 ── */
.hotspot-detail-kpi {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--pt-radius);
  background: var(--pt-bg-elevated);
  border: 1px solid var(--pt-border-subtle);
}

.hotspot-detail-kpi-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.hotspot-detail-rank {
  font-family: var(--pt-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--pt-accent);
}

.hotspot-detail-pass {
  font-size: 15px;
  font-weight: 600;
  color: var(--pt-text);
}

.hotspot-detail-kpi-sub {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--pt-text-muted);
  line-height: 1.45;
}

.hotspot-detail-section {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pt-border-subtle);
}

.hotspot-detail-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.hotspot-detail-heading {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pt-text-dim);
}

.hotspot-detail-loading {
  margin: 0;
  font-size: 12px;
  color: var(--pt-text-muted);
}

.hotspot-detail-note {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--pt-text-dim);
  font-weight: 400;
}

.hotspot-detail-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.hotspot-detail-btn {
  padding: 1px 6px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--pt-accent);
  background: transparent;
  border: 1px solid var(--pt-border-subtle);
  border-radius: 4px;
  cursor: pointer;
}

.hotspot-detail-btn:hover {
  background: var(--pt-accent-dim);
  border-color: var(--pt-accent);
}

.hotspot-hour-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 48px;
  margin-top: 8px;
  padding: 0 2px;
}

.hotspot-hour-bar {
  flex: 1;
  min-width: 0;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--pt-accent) 0%, rgba(45, 212, 191, 0.35) 100%);
  opacity: 0.85;
}

.hotspot-hour-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 9px;
  color: var(--pt-text-dim);
  font-family: var(--pt-mono);
}

.hotspot-entity-list,
.hotspot-flow-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hotspot-entity-list li,
.hotspot-flow-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  line-height: 1.4;
}

.hotspot-entity-name {
  color: var(--pt-text);
  font-family: var(--pt-mono);
}

.hotspot-entity-count,
.hotspot-flow-count {
  color: var(--pt-text-muted);
  white-space: nowrap;
}

.hotspot-flow-id {
  font-size: 10px;
  color: var(--pt-text-muted);
}

.hotspot-flow-label {
  margin: 8px 0 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--pt-text-dim);
  letter-spacing: 0.04em;
}

.hotspot-flow-label:first-of-type { margin-top: 0; }

.hotspot-flow-empty {
  margin: 0;
  font-size: 11px;
  color: var(--pt-text-dim);
}

.detail-card .detail-body {
  max-height: none;
}


.freq-route-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pt-border);
}
.freq-route-filter.hidden { display: none; }

.freq-len-tabs {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--pt-border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--pt-bg-input);
}

.freq-len-tab {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 5px 2px;
  border: none;
  border-right: 1px solid var(--pt-border);
  border-radius: 0;
  background: transparent;
  color: var(--pt-text-muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: background 0.12s, color 0.12s;
}

.freq-len-tab:last-child { border-right: none; }

.freq-len-tab:hover:not(.active) {
  color: var(--pt-text);
  background: rgba(255, 255, 255, 0.04);
}

.freq-len-tab.active {
  background: var(--pt-accent-2-dim);
  color: var(--pt-accent-2);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--pt-accent-2);
}
.freq-display-min { margin: 0; font-size: 11px; }
.freq-display-min.disabled { opacity: 0.45; pointer-events: none; }
.badge-len-short { background: rgba(56, 189, 248, 0.15); color: var(--pt-accent); }
.badge-len-medium { background: rgba(45, 212, 191, 0.15); color: var(--pt-accent-2); }
.badge-len-long { background: rgba(244, 162, 97, 0.18); color: #f4a261; }

.freq-precompute-hint.ready {
  color: var(--pt-accent);
}
.freq-precompute-hint:empty {
  display: none;
}
