.dashboard-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 210px) minmax(150px, 210px) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

#dashboardSource,
#dashboardRange {
  max-width: 210px;
}

#dashboardVrm,
#dashboardRange,
.dashboard-source-trigger {
  height: 48px;
}

.dashboard-source-picker {
  position: relative;
  width: 100%;
  max-width: 210px;
}

.dashboard-source-trigger {
  width: 100%;
  text-align: left;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 36px 9px 10px;
  color: var(--text);
  position: relative;
}

.dashboard-source-trigger::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 3px solid var(--muted);
  border-bottom: 3px solid var(--muted);
  transform: translateY(-60%) rotate(45deg);
}

.dashboard-source-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 35;
  width: 300px;
  max-height: 360px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(31, 41, 51, 0.16);
  padding: 6px;
}

.dashboard-source-menu[hidden] {
  display: none;
}

.dashboard-source-menu .parent-row,
.dashboard-source-menu .child-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
}

.dashboard-source-menu input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}

.dashboard-source-menu label {
  display: inline-block;
  color: var(--text);
  line-height: 1.2;
  margin: 0;
}

.dashboard-source-menu .parent-row label {
  font-weight: 700;
}

.dashboard-source-menu .child-row {
  padding-left: 22px;
}

.dashboard-source-menu .child-row label {
  font-weight: 400;
}

#dashboardSummary {
  display: none;
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
  align-self: start;
  white-space: nowrap;
  overflow-wrap: normal;
  min-width: fit-content;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
}

.chart-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background: #fbfcfd;
}

.chart-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.chart-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.chart-download {
  padding: 9px 12px;
  white-space: nowrap;
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 320px;
  border: 1px solid #d7dde3;
  border-radius: 6px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.chart-legend span.inactive {
  opacity: 0.45;
}

.chart-legend i {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 999px;
}

.dashboard-tooltip {
  position: fixed;
  z-index: 50;
  display: grid;
  gap: 4px;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 12px 30px rgba(31, 41, 51, 0.16);
  font-size: 13px;
  font-weight: 800;
  pointer-events: none;
}

.dashboard-tooltip[hidden] {
  display: none;
}

.dashboard-tooltip span {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 920px) {
  .dashboard-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  #dashboardSummary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .dashboard-toolbar {
    grid-template-columns: 1fr;
  }
}
