/* Upstream Health page: Grafana-style panels on the evot dark palette. */

.health-page-shell { display: flex; flex-direction: column; gap: 16px; }

.health-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
    padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
}
.health-toolbar-group { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-tertiary); }
.health-toolbar-group .health-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.health-seg button {
    appearance: none; border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 12px;
    padding: 4px 10px; cursor: pointer; transition: background var(--transition), color var(--transition);
}
.health-seg button + button { border-left: 1px solid var(--border); }
.health-seg button:hover { background: var(--sidebar-hover); color: var(--ink); }
.health-seg button.is-active { background: var(--ink); color: var(--primary-foreground); }
.health-toolbar-status { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-tertiary); }
.health-toolbar-status .is-error { color: var(--red); }

.health-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.health-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px;
    border: 1px solid var(--border); color: var(--text-secondary); background: var(--card);
}
.health-chip b { color: var(--ink); }
.health-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.health-chip.is-danger::before { background: var(--red); box-shadow: 0 0 8px var(--red-line); }
.health-chip.is-warn::before { background: var(--amber); }
.health-chip.is-ok::before { background: var(--green); }

.health-grid-panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); gap: 14px; }
@media (max-width: 720px) { .health-grid-panels { grid-template-columns: 1fr; } }

.health-panel {
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 12px 14px 10px;
    display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.health-panel.is-danger { border-color: var(--red-line); box-shadow: inset 3px 0 0 var(--red); }
.health-panel.is-warn { box-shadow: inset 3px 0 0 var(--amber); }
.health-panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.health-panel-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.health-panel-title h3 { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-panel-service { font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.health-status { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 3px; }
.health-status-danger { color: var(--red); background: var(--red-fill); }
.health-status-warn { color: var(--amber); background: var(--amber-fill); }
.health-status-ok { color: var(--green-ink); background: var(--green-fill); }
.health-status-muted { color: var(--text-muted); background: var(--sidebar-hover); }

.health-stats { display: flex; gap: 18px; margin: 0; }
.health-stats div { display: flex; flex-direction: column; gap: 1px; }
.health-stats dt { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.health-stats dd { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.health-stats dd small { margin-left: 4px; font-size: 10px; font-weight: 500; color: var(--text-tertiary); }
.health-stats dd small.is-bad, .health-stats dd.is-bad { color: var(--red); }

.health-chart { position: relative; width: 100%; }
.health-svg { display: block; width: 100%; font-family: var(--font-mono); }
.health-svg text { fill: var(--text-muted); font-size: 10px; }
.health-grid line { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.health-xaxis line { stroke: #ffffff0d; }
.health-axis { stroke: var(--border); shape-rendering: crispEdges; }
.health-axis-label { fill: var(--text-muted); }
.health-note { fill: var(--text-muted); font-size: 11px; }
.health-stats-caption dd { color: var(--text-tertiary); font-weight: 500; }
.health-line { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.health-line-p50 { stroke: var(--accent-blue); }
.health-line-p95 { stroke: var(--amber); }
.health-point-p50 { fill: var(--accent-blue); }
.health-point-p95 { fill: var(--amber); }
.health-baseline { stroke: var(--text-muted); stroke-dasharray: 4 4; stroke-width: 1; }
.health-baseline-label { fill: var(--text-muted); font-size: 9px; }
.health-band-stalled { fill: var(--red); fill-opacity: 0.10; }
.health-bar-served { fill: var(--accent-blue); fill-opacity: 0.35; }
.health-bar-errors { fill: var(--red); fill-opacity: 0.85; }
.health-bar-nfb { fill: var(--accent-violet); fill-opacity: 0.85; }
.health-marker line { stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.9; }
.health-crosshair line { stroke: var(--text-secondary); stroke-width: 1; stroke-dasharray: 3 3; }
.health-dot-p50 { fill: var(--accent-blue); stroke: var(--card); stroke-width: 1.5; }
.health-dot-p95 { fill: var(--amber); stroke: var(--card); stroke-width: 1.5; }

.health-tooltip {
    position: absolute; top: 8px; z-index: 3; pointer-events: none; min-width: 168px;
    background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px;
    box-shadow: var(--el-box-shadow-light); font-size: 11px; color: var(--text-secondary);
}
.health-tooltip-time { color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.health-tooltip-row { display: flex; align-items: center; gap: 6px; line-height: 1.6; }
.health-tooltip-row b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.health-tooltip-event { margin-top: 6px; padding-left: 8px; border-left: 2px solid var(--amber); color: var(--text-secondary); white-space: normal; max-width: 280px; }

.health-swatch { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.health-swatch-p50 { background: var(--accent-blue); }
.health-swatch-p95 { background: var(--amber); }
.health-swatch-baseline { background: repeating-linear-gradient(90deg, var(--text-muted) 0 3px, transparent 3px 6px); }
.health-swatch-served { background: var(--accent-blue); opacity: .45; height: 8px; }
.health-swatch-errors { background: var(--red); height: 8px; }
.health-swatch-nfb { background: var(--accent-violet); height: 8px; }
.health-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; color: var(--text-tertiary); }
.health-legend-base { margin-left: auto; color: var(--text-muted); }

.health-events { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.health-events-head { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.health-events-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.health-events-head span { font-size: 11px; color: var(--text-muted); }
.health-events ol { list-style: none; margin: 0; padding: 4px 0; max-height: 320px; overflow: auto; }
.health-events li { display: grid; grid-template-columns: 96px 176px 1fr; gap: 12px; padding: 5px 14px; font-size: 12px; align-items: baseline; }
.health-events li:hover { background: var(--sidebar-hover); }
.health-events time { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.health-events .health-event-kind { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.health-events .health-event-kind i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.health-events .health-event-msg { color: var(--ink); overflow-wrap: anywhere; }
.health-empty { padding: 28px; text-align: center; color: var(--text-muted); font-size: 12px; border: 1px dashed var(--border); border-radius: var(--radius); }
