/* ===== 左侧控制面板 ===== */
.sidebar {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 12px;
  width: 300px;
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  transition: transform var(--t-normal) ease;
}
.panel-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--t-fast) ease;
}
.panel-toggle .ico {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s ease;
}
.panel-toggle:hover { background: rgba(255, 255, 255, .2); }
.panel-toggle:hover .ico { transform: translateX(-2px); }

.panel-body { flex: 1; overflow-y: auto; padding-top: 8px; scrollbar-width: none; -ms-overflow-style: none; }
/* 同上：条不见，滚照旧 */
.panel-body::-webkit-scrollbar { width: 0; height: 0; display: none; }
.section { padding: 12px 14px; border-bottom: 1px solid var(--border); }
/* range 轨道透明，保证毛玻璃通透 */
.sidebar input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 16px;
  background: transparent;
  cursor: pointer;
}
.sidebar input[type=range]::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--val, 0%), rgba(255,255,255,.1) var(--val, 0%));
  border-radius: 3px;
  height: 4px;
}
.sidebar input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -5px;
  cursor: pointer;
}
.sidebar input[type=range]::-moz-range-track {
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--val, 0%), rgba(255,255,255,.1) var(--val, 0%));
  border-radius: 3px;
  height: 4px;
}
.sidebar input[type=range]::-moz-range-progress {
  background: var(--accent);
  border-radius: 3px;
  height: 4px;
}
.sidebar input[type=range]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.section:last-child { border-bottom: none; }
.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.panel-foot {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  background: rgba(255, 255, 255, .02);
}
.sidebar.collapsed { transform: translateX(-115%); }
.sidebar.collapsed ~ .legend { left: 12px; }

/* 展开面板的悬浮按钮 */
.panel-fab {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: var(--z-sidebar);
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  transition: all var(--t-fast) ease;
}
.panel-fab .ico {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s ease;
}
.panel-fab:hover { color: #fff; border-color: var(--accent); }
.panel-fab:hover .ico { transform: translateX(1.5px); }

/* 统计 */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  padding: 10px;
}
.stat .v { font-size: 18px; font-weight: 700; color: #fff; }
.stat .k { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* 图层开关 */
.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13px;
}
.layer-item + .layer-item { border-top: 1px dashed rgba(255, 255, 255, .08); }
.layer-item .name { display: flex; align-items: center; gap: 8px; }
.layer-item .ico { width: 14px; height: 14px; border-radius: 3px; }
.lyr-ico { width: 15px; height: 15px; flex-shrink: 0; opacity: .9; }
.switch { position: relative; width: 38px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, .12);
  border-radius: 20px;
  transition: .2s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* 滑块 */
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.range-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.range-label b { color: var(--accent2); font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* 数据上传 */
.upload-btn {
  width: 100%;
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.upload-btn:hover { background: rgba(255, 255, 255, .1); }
.upload-hint { font-size: 11px; color: var(--muted); margin-top: 6px; word-break: break-all; }

/* 下拉选择器 */
.select {
  width: 100%;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  color: var(--text);
  outline: none;
  font-size: 12px;
}
.select:focus { border-color: var(--accent); }

/* 配色 */
.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.color-label { font-size: 12px; color: var(--muted); }
.seg { display: flex; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--radius-sm); overflow: hidden; }
.seg-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 0;
  padding: 4px 11px;
  font-size: 11px;
  cursor: pointer;
}
.seg-btn.active { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.seg.wide { width: 100%; }
.seg.wide .seg-btn { flex: 1; text-align: center; padding: 6px 0; }
input[type=color] {
  width: 44px;
  height: 26px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
}

/* 查询 */
.search { display: flex; gap: 6px; }
.search .select { width: 110px; flex-shrink: 0; }
.search input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  color: var(--text);
  outline: none;
}
.search input:focus { border-color: var(--accent); }
