/* Hand-built SVG charts. Marks carry series colour; text wears ink tokens. */

.viz { position: relative; width: 100%; min-width: 0; }
.viz svg { display: block; width: 100%; overflow: visible; }
.viz text { font-family: var(--font-sans); font-size: 10.5px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.viz .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz .axis-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.viz .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .area { fill: var(--series-1); opacity: 0.1; }
.viz .dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.viz .end-label { fill: var(--ink); font-weight: 600; font-size: 11px; }
.viz .bar { fill: var(--series-1); transition: opacity 0.1s; }
.viz .bar.s2 { fill: var(--series-2); }
.viz .bar.s3 { fill: var(--series-3); }
.viz .bar.dim { opacity: 0.35; }
.viz .hit { fill: transparent; cursor: crosshair; }
.viz .hit:focus { outline: none; }
.viz g.col:hover .bar, .viz g.col:focus .bar, .viz g.col.on .bar { opacity: 0.8; }
.viz .cross { stroke: var(--line-3); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.viz .ref-line { stroke: var(--ink-4); stroke-width: 1; shape-rendering: crispEdges; }
.viz .ref-text { fill: var(--ink-3); font-size: 10px; }
.viz .val-label { fill: var(--ink-2); font-size: 10.5px; }
.viz .cat-label { fill: var(--ink-2); font-size: 11.5px; }
.viz-empty { display: grid; place-items: center; color: var(--ink-4); font-size: 12px; height: 100%; min-height: 120px; }

/* one floating tooltip for every chart */
.viz-tip {
    position: fixed; z-index: 150; pointer-events: none;
    min-width: 140px; max-width: 280px;
    background: var(--surface-4); border: 1px solid var(--line-3); border-radius: var(--r-2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    padding: 7px 10px; font-size: 12px;
    opacity: 0; transition: opacity 0.08s;
}
.viz-tip.on { opacity: 1; }
.viz-tip .tt-head { color: var(--ink-3); font-size: 11px; margin-bottom: 4px; }
.viz-tip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.viz-tip .tt-row + .tt-row { margin-top: 2px; }
.viz-tip .tt-key { width: 10px; height: 2px; border-radius: 1px; flex: none; background: var(--series-1); }
.viz-tip .tt-key.s2 { background: var(--series-2); }
.viz-tip .tt-key.s3 { background: var(--series-3); }
.viz-tip .tt-name { color: var(--ink-2); flex: 1; }
.viz-tip .tt-val { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--series-1); display: inline-block; }
.legend i.s2 { background: var(--series-2); }
.legend i.s3 { background: var(--series-3); }
.legend i.line { height: 2px; border-radius: 1px; }

.chart-card .panel-body { padding-top: 12px; }
.chart-toggle.on { background: var(--surface-3); color: var(--ink); }
.chart-table { max-height: 300px; overflow: auto; }

/* meter: severity fill over a lighter step of the same ramp */
.meter { position: relative; }
.meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.meter-label { font-size: 12px; color: var(--ink-2); }
.meter-value { font-size: 22px; font-weight: 600; white-space: nowrap; }
.meter-value small { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 4px; }
.meter-track {
    position: relative; height: 10px; margin: 10px 0 22px; border-radius: 5px;
    background: rgba(34, 176, 97, 0.16);
}
.meter.warn .meter-track { background: rgba(240, 196, 25, 0.16); }
.meter.crit .meter-track { background: rgba(229, 72, 77, 0.18); }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--good); min-width: 2px; }
.meter.warn .meter-fill { background: var(--warn); }
.meter.crit .meter-fill { background: var(--crit); }
.meter-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink-2); border-radius: 1px; }
.meter-mark.hard { background: var(--crit); }
.meter-mark span {
    position: absolute; top: 18px; transform: translateX(-50%); white-space: nowrap;
    font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.meter-mark.end span { transform: translateX(-100%); }
.meter-foot { font-size: 11.5px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ranked horizontal bars (html) */
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; align-items: center; }
.hbar-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-name .sub { color: var(--ink-3); font-size: 11.5px; margin-left: 6px; }
.hbar-val { font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.hbar-track { grid-column: 1 / -1; height: 6px; position: relative; }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 3px 3px 0; min-width: 2px; }

/* request timing waterfall */
.wf { display: grid; grid-template-columns: 96px minmax(0, 1fr) 62px; gap: 5px 10px; align-items: center; font-size: 12px; }
.wf-name { color: var(--ink-2); }
.wf-track { position: relative; height: 12px; border-left: 1px solid var(--axis); }
.wf-seg { position: absolute; top: 2px; bottom: 2px; background: var(--series-1); border-radius: 0 3px 3px 0; min-width: 2px; }
.wf-seg.major { background: var(--series-1); }
.wf-seg.minor { background: var(--series-1); opacity: 0.6; }
.wf-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-family: var(--font-mono); font-size: 11.5px; }
.wf-total-name { color: var(--ink) !important; font-weight: 600; }
.wf-total .wf-seg { background: var(--ink-3); }

/* compact inline timing bar used in log rows */
.tbar { display: flex; height: 6px; width: 120px; border-radius: 3px; overflow: hidden; background: var(--surface-4); gap: 1px; }
.tbar i { display: block; height: 100%; background: var(--series-1); }
.tbar i.o { background: var(--ink-3); }

.spark svg { display: block; width: 100%; height: 34px; }
.spark .line { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
.spark .last { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
