/* Monitoring dashboard and utilization charts.
   Series colors: reference data-viz palette, light mode, categorical slots 1-2. */
:root {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --chart-grid: #eef0f3;
  --chart-axis: #d0d5dd;
}

.muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }

/* Alert when host metrics can't be trusted */
.monitor-alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid #fcd34d;
  border-left: 4px solid #d97706;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--warning-text);
  font-size: 0.9rem;
}
.monitor-alert i { margin-top: 3px; }

/* Utilization meters in tables: one hue, high values flagged with icon + text */
.meter { display: inline-flex; align-items: center; gap: 8px; min-width: 130px; }
.meter-track { position: relative; flex: 0 0 72px; height: 8px; border-radius: 4px; background: var(--chart-grid); overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--series-1); }
.meter-value { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.85rem; }
.meter-hot .meter-fill { background: #d97706; }
.meter-hot .meter-value { color: var(--warning-text); }

.monitor-table td { vertical-align: top; }
.exporter { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; font-size: 0.8rem; font-weight: 600; }
.exporter.ok { color: var(--success-text); }
.exporter.down { color: var(--danger-text); }

.monitor-details {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.monitor-details summary { cursor: pointer; font-weight: 600; }

/* Charts */
.metric-charts { margin: 8px 0 28px; }
.metric-charts-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.metric-charts-head h2 { margin: 0; }
.range-picker { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 100%; }
.range-picker .btn { flex: 0 0 auto; min-width: 0; min-height: 32px; padding: 4px 12px; font-size: 0.85rem; }
.range-picker .btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.chart-card {
  padding: 14px 16px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
}
.chart-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.chart-card-head h3 { margin: 0; font-size: 0.95rem; }
.chart-legend { display: flex; gap: 14px; margin: 0; padding: 0; list-style: none; font-size: 0.8rem; color: var(--text-muted); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.swatch.series-1 { background: var(--series-1); }
.swatch.series-2 { background: var(--series-2); }

.chart-plot { position: relative; width: 100%; }
.chart-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-plot .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-plot .axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart-plot .tick { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-plot .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-plot .line.series-1 { stroke: var(--series-1); }
.chart-plot .line.series-2 { stroke: var(--series-2); }
.chart-plot .crosshair { stroke: var(--text-subtle); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-plot .dot { stroke: var(--surface); stroke-width: 2; }
.chart-plot .dot.series-1 { fill: var(--series-1); }
.chart-plot .dot.series-2 { fill: var(--series-2); }
.chart-plot .hit { fill: transparent; cursor: crosshair; }
.chart-empty { padding: 48px 0; text-align: center; font-size: 0.9rem; }

.chart-tip {
  position: absolute;
  top: 6px;
  z-index: 5;
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  pointer-events: none;
}
.chart-tip-time { margin-bottom: 4px; color: var(--text-muted); }
.chart-tip-row { display: flex; align-items: center; gap: 6px; }
.chart-tip-name { flex: 1; color: var(--text-muted); }
.chart-tip strong { color: var(--text); font-variant-numeric: tabular-nums; }

.chart-data { margin-top: 4px; font-size: 0.8rem; }
.chart-data summary { cursor: pointer; color: var(--text-muted); }
.chart-data table { margin-top: 6px; }
.chart-data th, .chart-data td { padding: 4px 8px 4px 0; text-align: left; font-variant-numeric: tabular-nums; }
.chart-data th { color: var(--text-muted); font-weight: 600; }

@media (max-width: 640px) {
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
}
