/*
 * SV Soporte · gráficas, indicadores y medidor.
 * Colores de datos validados (dataviz validator) sobre la superficie #121b23:
 *   serie 1 #0aa39a (turquesa de marca, un paso más oscuro para barras)
 *   serie 2 #d95926 (naranja)
 * El texto nunca usa el color de la serie: usa --viz-text / --viz-muted.
 */
.svs-viz-root {
	--viz-surface: #121b23;
	--viz-text: #e7eef2;
	--viz-text-2: #b9c6cd;
	--viz-muted: #8fa1ad;
	--viz-grid: #1f2b35;
	--viz-base: #34434f;
	--series-1: #0aa39a;
	--series-2: #d95926;
	--st-good: #0ca30c;
	--st-warn: #fab219;
	--st-crit: #d03b3b;
	color: var(--viz-text);
	font-family: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Indicadores */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile {
	position: relative; display: flex; flex-direction: column; gap: 2px;
	background: var(--viz-surface); border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; padding: 16px 18px;
}
.tile-icon { position: absolute; top: 14px; right: 14px; color: var(--viz-muted); opacity: .8; }
.tile-label { color: var(--viz-muted); font-size: .82rem; font-weight: 500; }
.tile-value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; color: var(--viz-text); }
.tile-sub { color: var(--viz-muted); font-size: .78rem; }
.tile-hero { border-color: rgba(11, 180, 170, .45); background: linear-gradient(180deg, rgba(11, 180, 170, .10), var(--viz-surface) 70%); }
.tile-hero .tile-value { font-size: clamp(1.45rem, 5.5vw, 2.2rem); }
.tile-value { overflow-wrap: anywhere; }

/* Tarjetas de gráficas */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-bottom: 18px; }
.chart-card, .svs-card { background: var(--viz-surface); border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; padding: 18px 18px 12px; }
.viz { margin: 0; }
.viz-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.viz-title { font-weight: 600; font-size: .98rem; color: var(--viz-text); margin: 0; }
.viz-sub { color: var(--viz-muted); font-size: .8rem; }
.viz-empty { color: var(--viz-muted); font-size: .9rem; padding: 18px 0; }
.viz-legend { display: flex; gap: 16px; list-style: none; margin: 0 0 6px; padding: 0; font-size: .8rem; color: var(--viz-text-2); }
.viz-legend li { display: inline-flex; align-items: center; gap: 6px; }
.viz-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.viz-svg { width: 100%; height: auto; display: block; overflow: visible; }
.viz-grid line { stroke: var(--viz-grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz-grid line.viz-base { stroke: var(--viz-base); }
.viz-tick { fill: var(--viz-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.viz-value { fill: var(--viz-text); font-size: 13px; font-weight: 600; }
.viz-ref line { stroke: var(--viz-text-2); stroke-width: 1; opacity: .7; }
.viz-ref text { fill: var(--viz-text-2); font-size: 12px; }
.viz-fill-1 { fill: var(--series-1); background: var(--series-1); }
.viz-fill-2 { fill: var(--series-2); background: var(--series-2); }
.viz-bar { transition: filter .15s, opacity .15s; }
.viz-hit { fill: transparent; cursor: default; outline: none; }
.viz-col:hover .viz-bar, .viz-col:focus-within .viz-bar { filter: brightness(1.18); }
.viz-col:focus-within .viz-hit { stroke: var(--viz-base); stroke-width: 1; }

.viz-table { margin-top: 6px; font-size: .82rem; }
.viz-table summary { cursor: pointer; color: var(--viz-muted); padding: 4px 0; list-style: none; }
.viz-table summary::-webkit-details-marker { display: none; }
.viz-table summary::before { content: '▸ '; }
.viz-table[open] summary::before { content: '▾ '; }
.viz-table table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.viz-table th, .viz-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--viz-grid); color: var(--viz-text-2); }
.viz-table th { color: var(--viz-muted); font-weight: 600; }

/* Barras horizontales */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; align-items: center; gap: 10px; font-size: .86rem; outline: none; border-radius: 6px; }
.hbar:focus-visible { box-shadow: 0 0 0 2px var(--viz-base); }
.hbar-label { color: var(--viz-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar-fill { height: 12px; border-radius: 0 4px 4px 0; min-width: 3px; transition: filter .15s; }
.hbar:hover .hbar-fill { filter: brightness(1.18); }
.hbar-val { color: var(--viz-text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Medidor de bolsa de horas */
.meter { background: var(--viz-surface); border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
.meter-head, .meter-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.meter-foot { color: var(--viz-text-2); font-size: .85rem; margin-top: 8px; }
.meter-state { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; color: var(--viz-text-2); }
.meter-track { height: 12px; border-radius: 999px; background: rgba(10, 163, 154, .18); overflow: hidden; margin-top: 10px; }
.meter-fill { display: block; height: 100%; border-radius: 999px; background: var(--series-1); }
.meter-warn .meter-track { background: rgba(250, 178, 25, .18); }
.meter-warn .meter-fill { background: var(--st-warn); }
.meter-warn .meter-state .dashicons { color: var(--st-warn); }
.meter-over .meter-track { background: rgba(208, 59, 59, .2); }
.meter-over .meter-fill { background: var(--st-crit); }
.meter-over .meter-state .dashicons { color: var(--st-crit); }
.meter-ok .meter-state .dashicons { color: var(--st-good); }
.mini-meter { display: block; width: 120px; height: 6px; border-radius: 999px; background: rgba(10, 163, 154, .18); margin-top: 4px; overflow: hidden; }
.mini-meter span { display: block; height: 100%; background: var(--series-1); border-radius: 999px; }
.mini-meter.meter-warn { background: rgba(250, 178, 25, .18); }
.mini-meter.meter-warn span { background: var(--st-warn); }
.mini-meter.meter-over { background: rgba(208, 59, 59, .2); }
.mini-meter.meter-over span { background: var(--st-crit); }

/* Tooltip (lo crea assets/js/viz.js) */
.viz-tip {
	position: fixed; z-index: 9999; pointer-events: none; min-width: 140px; max-width: 260px;
	background: #0b1117; border: 1px solid #2c3a45; border-radius: 10px; padding: 9px 12px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, .45); color: #e7eef2; font: 400 12px/1.4 'Onest', system-ui, sans-serif;
	opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.viz-tip.is-on { opacity: 1; transform: none; }
.viz-tip-t { color: #8fa1ad; font-size: 11px; margin-bottom: 4px; text-transform: capitalize; }
.viz-tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.viz-tip-row b { font-size: 13px; color: #fff; font-variant-numeric: tabular-nums; }
.viz-tip-row span { display: inline-flex; align-items: center; gap: 6px; color: #b9c6cd; }
.viz-tip-key { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.viz-tip-total { border-top: 1px solid #2c3a45; margin-top: 5px; padding-top: 5px; }

@media (forced-colors: active) {
	.viz-bar, .hbar-fill, .meter-fill { forced-color-adjust: none; }
}
@media print {
	.viz-tip { display: none; }
}

@media (max-width: 520px) {
	.charts { grid-template-columns: 1fr; }
	.chart-card { padding: 14px 12px 10px; }
}
