:root {
  --accent: #2D6A4F;
  --accent-2: #40916C;
  --bg: #f3f5f8;
  --card: #ffffff;
  --border: #e3e7ee;
  --text: #1f2937;
  --muted: #6b7280;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.topbar {
  background: linear-gradient(135deg, #1B4332 0%, #2D6A4F 100%);
  color: #fff;
  padding: 18px 16px 20px;
  max-width: 1400px;
  margin: 0 auto;
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; }
.topbar .sub { margin-top: 2px; font-size: 12px; opacity: 0.85; }

/* 筛选面板 */
.filter-panel {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 12px 14px;
}
.filter-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.filter-row + .filter-row { margin-top: 10px; }
.filter-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-item select {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.dropdown { position: relative; flex: 1; min-width: 0; }
.dropdown-toggle {
  position: relative;
  width: 100%;
  height: 38px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dropdown-toggle::after {
  content: '';
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s;
}
.dropdown.open .dropdown-toggle::after { transform: translateY(-30%) rotate(225deg); }
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  max-height: 320px;
  overflow-y: auto;
  z-index: 60;
  padding: 6px;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 6px;
}
.dropdown.open .dropdown-menu { display: grid; }
.check-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.check-item:hover { background: #f5f7fa; }
.check-item input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.check-item.check-all { font-weight: 600; border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 10px; grid-column: 1 / -1; }
.seg {
  display: inline-flex;
  background: #eef1f6;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: none;
  background: transparent;
  padding: 6px 18px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.seg-btn.active {
  background: #fff;
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* 指标卡 */
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
}
.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.metric-label { font-size: 13px; color: var(--muted); }
.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.metric-value small { font-size: 13px; font-weight: 600; margin-left: 4px; color: var(--muted); }
.metric-prev {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.metric-prev .up { color: #2d8c6e; font-weight: 600; }
.metric-prev .down { color: #c0392b; font-weight: 600; }

/* 图表区 */
.charts { padding: 0 14px 20px; }
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
.chart-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.chart { width: 100%; height: 280px; }

.foot {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 12px 16px 24px;
}

/* 桌面端 */
@media (min-width: 768px) {
  .topbar { padding: 22px 28px 24px; }
  .topbar h1 { font-size: 24px; }
  .filter-panel { padding: 14px 28px; }
  .metrics { padding: 14px 28px; grid-template-columns: repeat(2, 1fr); }
  .charts { padding: 0 28px 24px; }
  .chart { height: 340px; }
  .metric-value { font-size: 30px; }
}

@media (min-width: 1100px) {
  .metrics { grid-template-columns: repeat(5, 1fr); }
}

/* —— 图表全屏按钮 & 全屏显示 —— */
.fs-btn {
  flex-shrink: 0;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.fs-btn:hover { color: #111827; border-color: #6b7280; background: #f3f4f6; }
.chart-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card.fs, .chart-card.fs, .panel.fs {
  position: fixed !important;
  inset: 0;
  z-index: 99990;
  background: #fff;
  border-radius: 0;
  margin: 0 !important;
  padding: 16px 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.card.fs .chart, .chart-card.fs .chart, .panel.fs .chart {
  flex: 1 1 auto;
  height: calc(100vh - 90px) !important;
  min-height: 300px;
}

/* —— 宽屏响应式布局（参考酒店系统） —— */
.wrap { max-width: 1400px; margin: 0 auto; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 14px 20px; }
.charts .chart-card { margin-bottom: 0; }
@media (min-width: 768px) { .charts { padding: 16px 28px 20px; } }
@media (max-width: 800px) { .charts { grid-template-columns: 1fr; } }

/* —— 移动端：图表 canvas 左右贴边 —— */
@media (max-width: 767px) { .chart-card .chart { margin-left: -14px; margin-right: -14px; } }