/* ============================================================
   ESTADÍSTICAS
   Gráficos sin librerías: barras con CSS, línea con SVG
   ============================================================ */

/* ---------- selector de periodo ---------- */

.st-periodos {
  display: flex;
  border-bottom: 0.5px solid var(--line);
}
.st-periodos button {
  flex: 1;
  padding: 0.75rem 0;
  font-size: 0.58rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
}
.st-periodos button[aria-pressed="true"] { color: var(--black); font-weight: 700; }
.st-periodos button[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
}

/* ---------- cifras grandes ---------- */

.st-cifras {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5px;
  background: var(--line-sutil);
  border-bottom: 0.5px solid var(--line-sutil);
}

.st-cifra {
  background: var(--white);
  padding: 1.2rem var(--pad-x);
}
.st-cifra b {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}
.st-cifra span {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* ---------- bloque de gráfico ---------- */

.st-bloque {
  padding: 1.7rem var(--pad-x);
  border-bottom: 0.5px solid var(--line-sutil);
}
.st-bloque h2 {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}
.st-vacio {
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--muted-2);
}

/* ---------- barras verticales (mes a mes) ---------- */

.st-meses {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 130px;
}
.st-mes {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  gap: 0.5rem;
  min-width: 0;
}
.st-mes i {
  display: block;
  width: 100%;
  background: var(--black);
  min-height: 2px;
  transition: height 0.5s var(--curva);
}
/* El mes en curso va en naranja: todavía no ha terminado */
.st-mes[data-actual="true"] i { background: var(--accent); }
.st-mes[data-cero="true"] i { background: var(--line); }

.st-mes-pie {
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.st-mes-val {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ---------- barras horizontales (reparto) ---------- */

.st-fila { padding: 0.6rem 0; }
.st-fila-cab {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.35rem;
}
.st-fila-cab span {
  font-size: 0.85rem;
  font-weight: 300;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-fila-cab span em {
  font-style: normal;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 0.45rem;
}
.st-fila-cab b {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.st-barra {
  height: 3px;
  background: var(--line-sutil);
}
.st-barra i {
  display: block;
  height: 100%;
  background: var(--black);
  transition: width 0.5s var(--curva);
}
.st-fila:first-child .st-barra i { background: var(--accent); }

/* ---------- productos ---------- */

.st-prod {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0;
  text-align: left;
  border-bottom: 0.5px solid var(--line-sutil);
}
.st-prod:last-child { border-bottom: none; }
.st-prod .res-icono { width: 20px; height: 20px; font-size: 17px; }
.st-prod-n { flex: 1; min-width: 0; font-size: 0.85rem; font-weight: 300; }
.st-prod-n em {
  display: block;
  font-style: normal;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}
.st-prod b { font-size: 0.88rem; font-weight: 700; letter-spacing: -0.025em; }

/* ---------- evolución de precio ---------- */

.st-linea { margin: 0.9rem 0 0.4rem; }
.st-linea svg { width: 100%; height: 64px; display: block; overflow: visible; }
.st-linea path { fill: none; stroke: var(--black); stroke-width: 1.5; }
.st-linea circle { fill: var(--white); stroke: var(--black); stroke-width: 1.5; }
.st-linea circle:last-of-type { fill: var(--accent); stroke: var(--accent); }

.st-extremos {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.st-variacion {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted-2);
  margin-top: 0.7rem;
}
.st-variacion b { font-weight: 700; color: var(--black); }
.st-variacion[data-sube="true"] b { color: #c0392b; }
.st-variacion[data-sube="false"] b { color: #1e7d4f; }

/* ---------- histórico dentro de la ficha ---------- */

.fi-historial {
  margin-top: 1.3rem;
  padding-top: 1.2rem;
  border-top: 0.5px solid var(--line);
}
.fi-historial .fi-label { margin-bottom: 0.2rem; }
.fi-punto {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0;
  font-size: 0.78rem;
  color: var(--muted-2);
}
.fi-punto b { font-weight: 700; color: var(--black); letter-spacing: -0.02em; }
