/* taso-inv - panel de Estadisticas (F7). Colores SOLO de tokens.css. Regla del rojo (DISENO.md 7): nada de texto --bad sobre --card-high. */

/* ---------- utilidades del panel ---------- */
.pila-v { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid2 > .card, .grid2 > .pila-v { min-width: 0; }
@media (max-width: 1099px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.fila-i { display: flex; align-items: flex-start; gap: 8px; }
.card > h2:has(+ .ayuda) { margin-bottom: 2px; }
.ayuda { margin-bottom: 16px; }
.sep { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.sep h3 { margin: 0 0 10px; font-size: 0.8125rem; font-weight: 600; color: var(--text2); }

/* tonos: cada gráfica lee --bar */
.t-accent, .s-accent { --bar: var(--accent); }
.t-ok, .s-ok { --bar: var(--ok); }
.t-warn, .s-warn { --bar: var(--warn); }
.t-bad, .s-bad { --bar: var(--bad); }
.t-outline, .s-outline { --bar: var(--outline); }

/* ---------- filtros y pestañas ---------- */
.filtros { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; }
.seg.tabs { display: flex; max-width: 100%; align-self: flex-start; overflow-x: auto; scrollbar-width: thin; }
.seg.tabs button { flex: none; min-width: 0; padding: 0 18px; white-space: nowrap; }

/* ---------- entrada escalonada (micro-transicion, 280 ms) ---------- */
.rev { animation: rev .28s ease-out both; animation-delay: calc(min(var(--i, 0), 8) * 40ms); }
@keyframes rev { from { opacity: 0; transform: translateY(8px); } }
@keyframes crece { from { transform: scaleX(0); } }
@keyframes sube { from { transform: scaleY(0); } }

/* ---------- indicadores ---------- */
.kpis { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 600px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px 18px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); }
.kpi.hero { border-color: var(--border-accent); }
.kpi-t { color: var(--text2); font-size: 0.75rem; font-weight: 500; }
.kpi-v { font: 600 1.625rem/1.15 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.kpi-v.n { text-align: left; }
.kpi-v small { font: 400 0.75rem var(--font-ui); color: var(--text2); letter-spacing: 0; }
.kpi.hero .kpi-v { font-size: 2rem; color: var(--accent); }
.kpi-d { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; color: var(--text2); }
.kpi-d small { font-weight: 400; color: var(--text2); }
.kpi-s { height: 34px; margin-top: 4px; }
.spark { display: block; width: 100%; height: 100%; }
.spark polyline { stroke: var(--bar); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; fill: none; }

/* ---------- avisos ("Que mirar") ---------- */
.avisos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.avisos li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; color: var(--text); background: var(--card-high); border: 1px solid var(--border); border-radius: var(--radius-field); }
.avisos li .icon { margin-top: 1px; }
.avisos li.warn { border-color: var(--warn); } .avisos li.warn .icon { color: var(--warn); }
.avisos li.bad { border-color: var(--bad); } .avisos li.bad .icon { color: var(--bad); }

/* ---------- ranking horizontal y cascada ---------- */
.hb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.hb li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l v" "t t"; gap: 6px 12px; align-items: baseline; }
.hb-l { grid-area: l; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.hb-l small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--text2); }
.hb-v { grid-area: v; font: 500 0.8125rem var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-t { grid-area: t; position: relative; height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.hb-b { display: block; height: 100%; width: var(--p); min-width: 3px; border-radius: 999px; background: var(--bar); transform-origin: left; animation: crece .45s ease-out both; animation-delay: calc(min(var(--i, 0), 10) * 40ms); }
.wf .hb-t { height: 14px; }
.wf-b { position: absolute; top: 0; bottom: 0; left: var(--l); width: var(--w); border-radius: 4px; background: var(--bar); animation: rev .4s ease-out both; animation-delay: calc(min(var(--i, 0), 10) * 40ms); }
.wf .hb-t::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--z); width: 1px; background: var(--outline); }

/* ---------- columnas (dias de la semana) ---------- */
.cols { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.col-v { min-height: 1.2em; font: 500 0.6875rem var(--font-mono); color: var(--text2); white-space: nowrap; }
.col-t { display: flex; align-items: flex-end; width: 100%; height: 120px; border-radius: 8px; background: var(--surface); overflow: hidden; }
.col-b { display: block; width: 100%; height: var(--p); min-height: 2px; border-radius: 6px 6px 0 0; background: var(--outline); transform-origin: bottom; animation: sube .45s ease-out both; animation-delay: calc(min(var(--i, 0), 10) * 40ms); }
.col.top .col-b { background: var(--brand); }
.col.top .col-v, .col.top .col-l { color: var(--accent); font-weight: 600; }
.col-l { font-size: 0.75rem; color: var(--text2); }

/* ---------- barra apilada con leyenda ---------- */
.apil-b { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface); }
.apil-b > span { min-width: 4px; background: var(--bar); }
.apil-l { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.apil-l li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 58px; gap: 10px; align-items: center; }
.sw { width: 12px; height: 12px; border-radius: 4px; background: var(--bar); }
.apil-e { min-width: 0; overflow-wrap: anywhere; }
.pct { color: var(--text2); }

/* ---------- progreso ---------- */
.prog { position: relative; height: 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.prog-f { position: absolute; top: 0; bottom: 0; left: 0; width: var(--v); border-radius: 999px; background: var(--bar); transform-origin: left; animation: crece .45s ease-out both; }
.prog-m { position: absolute; top: -5px; bottom: -5px; left: var(--m); width: 2px; border-radius: 2px; background: var(--text); }

/* ---------- linea de tendencia ---------- */
.lin-leg { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; padding: 0; font-size: 0.75rem; color: var(--text2); }
.lin-leg li { display: flex; align-items: center; gap: 8px; }
.lin-svg { width: 100%; min-height: 230px; }
.lin-svg svg { display: block; touch-action: pan-y; }
.lin-svg svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.lin-g { stroke: var(--outline); stroke-opacity: .28; stroke-width: 1; }
.lin-e { fill: var(--text2); font: 11px var(--font-mono); }
.lin-l { fill: none; stroke: var(--bar); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.lin-a { fill: var(--bar); fill-opacity: .14; stroke: none; }
.lin-p { fill: var(--card); stroke: var(--bar); stroke-width: 2; }
.lin-c { stroke: var(--outline); stroke-width: 1; stroke-dasharray: 3 3; }
.lin-tip { min-height: 2.6em; margin-top: 6px; color: var(--text2); }
.lin-datos { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.lin-datos summary { display: flex; align-items: center; min-height: 36px; cursor: pointer; color: var(--accent); }
.lin-datos .tw { max-height: 260px; overflow: auto; }

/* ---------- variacion de precio y equipos ---------- */
.varia { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.varia li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.varia li:last-child { border-bottom: 0; }
.varia .icon { color: var(--text2); }
.vn { display: flex; flex: 1; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.vn small { font: 0.75rem var(--font-mono); color: var(--text2); }
.equipos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.equipos li { display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 599px) { .kpi-v { font-size: 1.5rem; } .kpi.hero .kpi-v { font-size: 1.75rem; } .col-v { font-size: 0.625rem; } }
