/**
 * 对比频道专用样式 compare.css
 * 依赖：common.css（全局变量）+ detail-consolidated.css（content-card / btn-pro / data-section-header 等）
 * 禁止：引入 channel.css 或其他频道 CSS
 *
 * 规范：圆角上限 6px；禁止 transform(translate/scale)；
 *       禁止彩色 box-shadow；过渡仅 color/bg/border/opacity 0.15s ease
 */

/* ==================== 轮廓按钮（对比频道版） ==================== */

.btn-pro-outline {
  background: transparent;
  border: 1px solid #C9CDD4;
  color: #4A5568;
  border-radius: var(--border-radius-sm);
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-ui);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn-pro-outline:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: #F0F4FB;
}
.btn-pro-outline i{font-size: 12px;}
/* 主操作按钮（开始对比） */
.btn-compare-go {
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: var(--border-radius-md);
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.15s ease;
}

.btn-compare-go:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-compare-go:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== 页面布局 ==================== */

.compare-page {
  padding: 0;
}

/* 选择器标题栏 */
.compare-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.compare-selector-title {
  font-size: 16px;
  font-weight: 600;
  color: #1D2129;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compare-selector-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 结果页信息栏 */
.compare-info-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  flex-wrap: wrap;
}

.compare-title {
  font-size: 18px;
  font-weight: 600;
  color: #1D2129;
  margin: 0;
  flex-shrink: 0;
  font-family: SourceHanSerifCN;
}

.compare-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  flex: 1;
  color: var(--text-muted);
  font-size: 13px;
}

.compare-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.compare-actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

/* ==================== 步骤区块 ==================== */

.step-section {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

/* 已选择区域 */
.selected-regions-container {
  min-height: 36px;
}

.selected-empty-hint {
  margin-top: 8px;
  padding: 9px 12px;
  background: var(--bg-light);
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.selected-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--border-radius-sm);
  background: #EEF3FB;
  color: var(--primary-color);
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
  border: 1px solid #B8C8EF;
}

.selected-badge .remove-selected {
  cursor: pointer;
  font-size: 12px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.selected-badge .remove-selected:hover {
  opacity: 1;
}

/* ==================== 指标标签 ==================== */

.tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-chip {
  border: 1px solid #C9CDD4;
  background: transparent;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--text-dark);
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.tag-chip:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: #F0F4FB;
}

.tag-chip.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.tag-chip-more {
  position: relative;
}

.tag-chip-more .more-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag-chip-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  padding: 4px 0;
  border: 1px solid var(--border-color-dark);
  border-radius: var(--border-radius-md);
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: none;
  z-index: 30;
}

.tag-chip-more.open .tag-chip-dropdown {
  display: block;
}

.tag-dropdown-item {
  width: 100%;
  text-align: left;
  padding: 7px 14px;
  background: transparent;
  border: none;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-dark);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tag-dropdown-item:hover {
  background: var(--bg-light);
  color: var(--primary-color);
}

.tag-dropdown-item.active {
  background: var(--primary-color);
  color: #fff;
}

.tag-chip-unit {
  font-size: 11px;
  opacity: 0.6;
}

/* ==================== 国内/国外切换 ==================== */

.region-source-tabs {
  display: flex;
  gap: 0;
  margin-top: 14px;
  border-bottom: 1px solid var(--border-color);
}

.region-source-tab {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  color: #6B7280;
  cursor: pointer;
  margin-bottom: -1px;
  font-weight: 400;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.region-source-tab:hover {
  color: var(--primary-color);
}

.region-source-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 600;
}

.region-source-panel {
  margin-top: 14px;
}

/* ==================== 国内区域布局 ==================== */

.domestic-layout {
  display: flex;
  gap: 16px;
}

.province-column {
  width: 250px;
  flex-shrink: 0;
}

.province-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #C9CDD4 transparent;
}

.province-card {
  border: 1px solid var(--border-color-dark);
  border-radius: var(--border-radius-sm);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.province-card.active,
.province-card:hover {
  border-color: var(--primary-color);
  background: #F0F4FB;
}

.province-card-body {
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

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

.province-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.province-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.cities-column {
  flex: 1;
  min-height: 260px;
}

.province-cities {
  display: none;
  padding: 14px;
  background: var(--bg-light);
  border-radius: var(--border-radius-md);
}

.cities-header {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.cities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}

.city-item-wrapper {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.city-item {
  padding: 8px 10px;
  border: 1px solid var(--border-color-dark);
  border-radius: var(--border-radius-sm);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.city-item:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: #F0F4FB;
}

.city-item.selected {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: #fff;
}

.city-name {
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.city-districts-btn {
  font-size: 12px;
  padding: 2px 6px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.city-districts-btn:hover {
  color: var(--primary-color);
}

/* 区县 */
.districts-section {
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: 6px;
}

.districts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 5px;
  padding: 6px 0;
}

.district-item {
  padding: 5px 8px;
  border: 1px solid var(--border-color-dark);
  border-radius: var(--border-radius-sm);
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dark);
  background: #fff;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.district-item:hover {
  background: #F0F4FB;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.district-item.selected {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* 国外区域 */
.continent-card {
  border-radius: var(--border-radius-md);
  margin-bottom: 10px;
}

.continent-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.countries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  padding: 12px;
}

.country-item {
  padding: 7px 10px;
  background: #fff;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color-dark);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
  text-align: center;
  font-size: 13px;
  color: var(--text-dark);
}

.country-item:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: #F0F4FB;
}

.country-item.selected {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* 通用选中状态 */
[data-region-node].selected {
  background: var(--primary-color) !important;
  color: #fff !important;
  border-color: var(--primary-color) !important;
}

/* ==================== 图表区 ==================== */

/* 对比图表控制栏（对比频道版，覆盖 detail-consolidated.css 的 .pro-chart-controls）
   .compare-page 为 cart/data 旧布局容器，.workbench-main 为全屏工作台右栏 */
.compare-page .pro-chart-controls,
.workbench-main .pro-chart-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  margin: 0;
}

.compare-page .pro-chart-controls {
  justify-content: space-between;
}

.compare-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
}

.chart-type-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 360px;
  padding: 16px 20px;
  box-sizing: border-box;
}

/* 混合度量提示条 + 原始值/指数切换 */
.compare-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px 0;
}
.compare-mode-bar .cmb-hint {
  font-size: 12px;
  color: var(--text-light, #8a9099);
}
.compare-mode-bar .cmb-hint b {
  font-weight: 600;
  color: var(--text-dark, #1f2329);
}
.compare-mode-bar .cmb-toggle {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--border-color, #e5e6eb);
  border-radius: 4px;
  overflow: hidden;
}
.compare-mode-bar .cmb-btn {
  border: 0;
  background: #fff;
  color: var(--text-light, #8a9099);
  font-size: 12px;
  padding: 3px 12px;
  cursor: pointer;
}
.compare-mode-bar .cmb-btn + .cmb-btn {
  border-left: 1px solid var(--border-color, #e5e6eb);
}
.compare-mode-bar .cmb-btn.active {
  background: var(--bg-gray-th-2, #f5f6f8);
  color: var(--text-dark, #1f2329);
}

/* 时间范围滑块（覆盖 detail-consolidated.css） */
.compare-page .chart-range-controls {
  background: var(--bg-gray-th-2);
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  margin: 0;
}

/* ==================== 表格区 ==================== */

.compare-table-scroll {
  overflow-x: auto;
}

/* ==================== 操作按钮区 ==================== */

.compare-action-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 16px 0 4px;
}

.action-buttons-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
}

/* 统一单位转换 */
#unit-converter-section {
  background: var(--bg-light);
  border-left: 3px solid var(--primary-color);
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
  padding: 10px 14px;
  margin: 0 20px 12px;
}

#unit-converter-section label {
  color: var(--text-dark);
  font-size: 13px;
}

#unified-unit-select {
  border-color: var(--primary-color);
}

#unified-unit-select:focus {
  border-color: var(--primary-color);
  outline: none;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
  margin-bottom: 16px;
}

/* 复选框 */
.form-check-input {
  cursor: pointer;
  border: 1px solid #C9CDD4;
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.cursor-pointer {
  cursor: pointer;
}

/* ==================== 响应式 ==================== */

@media (max-width: 992px) {
  .domestic-layout {
    flex-direction: column;
  }

  .province-column {
    width: 100%;
  }

  .province-grid {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
    overflow: visible;
  }

  .province-card {
    width: calc(50% - 3px);
  }
}

@media (max-width: 768px) {
  .compare-info-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .compare-meta {
    flex-direction: column;
    gap: 6px;
  }

  .chart-type-btns {
    flex-wrap: wrap;
  }

  .compare-page .pro-chart-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .action-buttons {
    width: 100%;
    flex-direction: column;
  }

  .action-buttons .btn {
    width: 100%;
  }
}

/* ============================================================
 * 统一替代 inline style 的工具类
 * ============================================================ */

/* 对比表格数据单元格：等宽数字 + 数据字体 */
.compare-table-scroll .data-table td {
  font-family: var(--font-data);
  font-feature-settings: "tnum" on, "lnum" on;
}

/* 对比表格时期列固定宽度 */
.compare-table-scroll th.sticky-col {
  min-width: 90px;
}

/* 购物车使用说明条 */
.compare-usage-hint {
  padding: 12px 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.compare-usage-hint .iconfont {
  font-size: 16px;
  margin-top: 1px;
  flex-shrink: 0;
}

/* 单位转换选择器宽度 */
#unified-unit-select {
  max-width: 180px;
}

/* 已选数量高亮文字 */
.compare-selected-count {
  color: var(--primary-color);
}

/* 累计值小角标 */
.badge-cumulative {
  font-size: 11px;
  padding: 2px 8px;
}

/* 时间范围高亮显示 */
.compare-period-range {
  color: var(--primary-color);
}

/* 省市面板内小型操作按钮 */
.btn-compact {
  font-size: 12px;
  padding: 3px 8px;
}

/* ============================================================
 * 全屏对比工作台（左操作栏 + 右图表数据栏）
 * 仅作用于 body.compare-fullscreen 页面，不影响 cart/data 旧布局
 * ============================================================ */

body.compare-fullscreen {
  height: 100vh;
  /* 顶部导航 .searchbox 是 fixed 定位（60px），不占文档流，需主动腾出高度 */
  padding-top: 60px;
  display: flex;
  flex-direction: column;
  overflow: hidden !important; /* common.css 对 body 写了 overflow:auto!important，需同权重覆盖 */
  background: var(--bg-light);
}

.compare-workbench {
  flex: 1;
  min-height: 0;
  display: flex;
  /* 对齐数据分析工作台：左右操作/结果区无间距、无外边距，靠分隔线区隔 */
  gap: 0;
  padding: 0;
}

/* ---------- 左侧操作栏 ---------- */

/* 用 order 控制视觉顺序为「左栏选择、右栏结果」 */
.workbench-rail {
  order: 1;
  width: 680px;              /* 对齐数据分析工作台左操作区(数据篮320+方法360=680) */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-right: 1px solid var(--border-color);  /* 分隔线代替间距 */
}

.rail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  flex-shrink: 0;
}

.rail-title {
  font-size: 15px;
  font-weight: 600;
  color: #1D2129;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.rail-footer {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border-color);
}

.rail-footer .btn-compare-go {
  flex: 1;
  justify-content: center;
  padding: 8px 18px;
}

.rail-footer .rail-reset {
  flex-shrink: 0;
}

/* header 右侧操作区：上传按钮 + 模式切换并排 */
.rail-header-actions { display: flex; align-items: center; gap: 10px; }

/* 上传数据：独立次要按钮（非选项卡），无边框，靠布局与模式切换成组 */
.rail-upload-btn {
  display: inline-flex; align-items: center; gap: 4px;
  border: none; background: #fff; color: #4E5969;
  border-radius: var(--border-radius-sm); padding: 6px 12px;
  font-size: 13px; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: color 0.15s ease;
}
.rail-upload-btn:hover { color: var(--primary-color); }

/* 自选 / AI 助手 切换（左栏内嵌 AI，对齐数据分析工作台）：无边框，active=文字蓝+短下标线 */
.rail-mode-tabs {
  display: inline-flex;
}

.rail-mode-tab {
  position: relative;
  border: 0;
  background: transparent;
  color: #4E5969;
  font-size: 13px;
  line-height: 1;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.rail-mode-tab:hover {
  color: var(--primary-color);
}

.rail-mode-tab.active {
  color: var(--primary-color);
}

.rail-mode-tab.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  margin-left: -8px;   /* 规范禁 transform，用负 margin 居中 */
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--primary-color);
}

/* 手动选数区：包住 body + footer，AI 模式整块隐藏 */
.rail-manual {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* AI 内嵌区：填满左栏，dock 面板 height:100% 据此撑开 */
.rail-ai {
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.rail-ai-dock {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* dock 面板用 flex 撑满高度（不依赖 height:100% 百分比解析，否则弹性父级下会塌高，
   导致 ai-assistant.css 的 .gha-body.gha-empty 空状态 180px 居中失效） */
.rail-ai-dock > .gha-modal--dock {
  flex: 1;
  min-height: 0;
}

/* ===== 数据对比数据篮（搜索-添加，复刻数据分析 DataPanel：.ghs-* 跨栈复制其样式数值，不 import Vue） ===== */
.compare-workbench {
  --ghs-brand: #1A4FBE;
  --ghs-divider: #ebeef5;
  --ghs-border: #C9CDD4;
  --ghs-text: #1F2329;
  --ghs-text-2: #4E5969;
  --ghs-text-3: #86909C;
  --ghs-black: #000;
  --ghs-bg: #F5F6F8;
}

.data-panel-body { padding: 12px; }

.ghs-search-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%; flex-shrink: 0;
  padding: 9px 10px; border: 1px solid transparent; border-radius: 4px;
  background: #F2F5FA; color: var(--ghs-text-3); font-size: 13px; text-align: left;
  cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease;
}
.ghs-search-trigger:hover { background: #fff; border-color: var(--ghs-brand); }

.ghs-panel-head { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 8px; }
.ghs-panel-title { font-size: 13px; color: var(--ghs-black); }
.ghs-panel-meta { font-size: 12px; color: var(--ghs-text-3); }

.ghs-series-list { display: flex; flex-direction: column; gap: 6px; }
/* 数据篮中的上传序列标签 */
.ghs-upload-tag {
  display: inline-block; padding: 0 5px; line-height: 16px;
  font-size: 11px; color: var(--ghs-brand); background: #EAF1FF; border-radius: 3px;
}
.ghs-series-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border: 1px solid var(--ghs-divider); border-radius: 4px;
}
/* 数据篮解锁入口：与图表/分析工作台 .ghs-unlock 完全同款（轻量文字、无边框），
   compare.css 之前缺这两个 class，浏览器给了默认按钮边框，故补齐 */
.ghs-unlock {
  border: 0; background: none; color: var(--ghs-brand);
  font-size: 12px; cursor: pointer; padding: 4px 6px; border-radius: 4px;
  white-space: nowrap; transition: background-color 0.15s ease;
}
.ghs-unlock:hover { background: rgba(26, 79, 190, 0.06); }
/* ≥2 条待解锁的一键解锁条 */
.ghs-denied-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 8px; margin-bottom: 4px;
  background: #FAFAFB; border: 1px solid var(--ghs-divider); border-radius: 4px;
}
.ghs-denied-bar .ghs-unlock { font-weight: 500; }
.ghs-color-dot {
  position: relative; width: 14px; height: 14px; border-radius: 3px; flex: none;
  cursor: pointer; border: 1px solid rgba(0, 0, 0, 0.12);
}
.ghs-color-dot input[type='color'] {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0;
}
.ghs-series-info { flex: 1; min-width: 0; }
.ghs-series-name {
  display: block; font-size: 13px; color: var(--ghs-text); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
a.ghs-series-name:hover { color: var(--ghs-brand); }
.ghs-series-meta {
  display: flex; gap: 6px; font-size: 11px; color: var(--ghs-text-3);
  white-space: nowrap; overflow: hidden;
}
.ghs-series-ops { display: flex; gap: 2px; flex: none; align-items: center; }
.ghs-icon-btn {
  border: 0; background: none; cursor: pointer; line-height: 1; padding: 4px;
  color: var(--ghs-text-3); border-radius: 4px; font-size: 14px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ghs-icon-btn:hover { background: var(--ghs-bg); color: var(--ghs-text); }
.ghs-icon-danger:hover { color: #BA2A20; }
.ghs-empty { padding: 24px 0; text-align: center; color: var(--ghs-text-3); line-height: 1.8; font-size: 13px; }

/* 选数弹窗外壳（复刻 .ghs-modal-*） */
.ghs-modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.ghs-modal {
  background: #fff; border-radius: 4px; width: 560px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 80px); display: flex; flex-direction: column;
}
.ghs-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--ghs-divider);
}
.ghs-modal-body { padding: 12px 14px; overflow-y: auto; }
.ghs-picker-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--ghs-divider);
}
.ghs-picker-count { font-size: 12px; color: var(--ghs-text-3); }

.ghs-search-input-wrap {
  display: flex; align-items: center; gap: 8px; border: 1px solid transparent;
  border-radius: 4px; padding: 0 10px; color: var(--ghs-text-3); background: #F2F5FA;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.ghs-search-input-wrap:focus-within { background: #fff; border-color: var(--ghs-brand); }
.ghs-search-input {
  flex: 1; min-width: 0; border: 0; outline: none; padding: 9px 0;
  font-size: 13px; color: var(--ghs-text); background: none;
}
.ghs-search-input::placeholder { color: var(--ghs-text-3); }

.ghs-picker-results { margin-top: 10px; min-height: 200px; max-height: 52vh; overflow-y: auto; }
.ghs-menu-empty { padding: 14px 10px; text-align: center; color: var(--ghs-text-3); font-size: 12px; }

.ghs-search-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%;
  border: 0; background: none; padding: 6px 8px; cursor: pointer; border-radius: 4px;
  text-align: left; transition: background-color 0.15s ease;
}
.ghs-search-item:hover { background: var(--ghs-bg); }
.ghs-search-item.ghs-picker-item { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.ghs-picker-item-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ghs-search-name { font-size: 13px; color: var(--ghs-text); }
.ghs-search-meta { display: flex; gap: 8px; font-size: 11px; color: var(--ghs-text-3); }
.ghs-picker-add { flex: none; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--ghs-brand); }

.ghs-btn {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--ghs-border);
  background: #fff; color: var(--ghs-text-2); border-radius: 4px; padding: 5px 11px;
  font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.ghs-btn:hover { border-color: var(--ghs-brand); color: var(--ghs-brand); }
.ghs-btn-primary { background: var(--ghs-brand); border-color: var(--ghs-brand); color: #fff; }
.ghs-btn-primary:hover { background: #163F99; color: #fff; }

/* 时间范围拖动 + 周期快捷（复刻图表工作台 RangeSlider，置于图表下方） */
.ghs-range { flex-shrink: 0; margin-top: 10px; padding: 0 2px; }
.ghs-range-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ghs-range-label { font-size: 12px; color: var(--ghs-text-3); }
.ghs-range-value { font-size: 12px; color: var(--ghs-brand); }
.ghs-range-chips { display: flex; gap: 4px; margin-left: auto; }
.ghs-chip {
  border: none; background: #fff; color: var(--ghs-text-2);
  border-radius: 4px; padding: 2px 8px; font-size: 12px; cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.ghs-chip:hover { color: var(--ghs-brand); }
.ghs-chip.active { background: rgba(26, 79, 190, 0.08); color: var(--ghs-brand); }
.ghs-range-track { position: relative; height: 12px; background: #ebedf0; border-radius: 4px; cursor: pointer; touch-action: none; }
.ghs-range-fill { position: absolute; top: 0; bottom: 0; background: rgba(26, 79, 190, 0.18); border-radius: 4px; }
.ghs-range-handle {
  position: absolute; top: 50%; width: 20px; height: 16px; background: #fff;
  border: 1px solid #b6bcc7; border-radius: 4px; transform: translate(-50%, -50%);
  cursor: ew-resize; transition: border-color 0.15s ease;
}
.ghs-range-handle:hover { border-color: var(--ghs-brand); }
.ghs-range-ends { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--ghs-text-3); }

/* 步骤区块窄栏覆写 */
.workbench-rail .step-section {
  padding: 12px 16px;
  border-top: none;
  border-bottom: 1px solid var(--border-color);
}

.workbench-rail .step-section:last-child {
  border-bottom: none;
}

/* 窄栏内省市两列：省份窄列 + 城市面板吸顶 */
.workbench-rail .domestic-layout {
  gap: 8px;
}

.workbench-rail .province-column {
  width: 190px;
}

.workbench-rail .province-grid {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.workbench-rail .province-card-body {
  padding: 7px 10px;
}

.workbench-rail .cities-column {
  align-self: flex-start;
  position: sticky;
  top: 0;
  min-height: 0;
}

.workbench-rail .province-cities {
  padding: 10px;
}

.workbench-rail .cities-header {
  flex-wrap: wrap;
  gap: 6px;
}

.workbench-rail .cities-grid {
  grid-template-columns: repeat(3, 1fr);
}

.workbench-rail .districts-grid {
  grid-template-columns: repeat(3, 1fr);
}

.workbench-rail .countries-grid {
  grid-template-columns: repeat(3, 1fr);
  padding: 10px;
}

.workbench-rail .continent-header {
  padding: 8px 10px;
}

/* ---------- 右侧结果栏 ---------- */

.workbench-main {
  order: 2; /* 配合 .workbench-rail 的 order:1 */
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.workbench-main .content-card {
  flex-shrink: 0;
}

.result-stack {
  display: flex;
  flex-direction: column;
}

.result-stack.d-none {
  display: none;
}

/* 结果空状态：无边框、置于结果区灰底之上（对齐分析工作台空状态） */
.workbench-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
  min-height: 320px;
}

.workbench-empty .iconfont {
  font-size: 42px;
  opacity: 0.35;
}

/* ---------- 响应式：窄屏退化为上下堆叠、恢复页面滚动 ---------- */

@media (max-width: 992px) {
  body.compare-fullscreen {
    height: auto;
    overflow: auto;
  }

  .compare-workbench {
    flex-direction: column;
  }

  .workbench-rail {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .rail-body {
    overflow-y: visible;
  }

  .workbench-main {
    overflow-y: visible;
  }

  .workbench-rail .cities-column {
    position: static;
  }

  /* 窄屏堆叠后左栏高度自适应，给 AI dock 兜底高度避免坍塌 */
  .rail-ai-dock {
    min-height: 70vh;
  }
}
