/* Estilos de la vista de análisis: cifras, gráficas y tabla.
   Los colores de los datos los pone analisis.js, porque cambian con el tema
   y salen del comprobador de la guía de visualización, no de la marca. */

#vistaAnalisis { display: grid; gap: 14px; min-width: 0; }

.an__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.an__head h2 { font-size: 1.05rem; }
.an__head select { width: auto; min-width: 150px; }

.an__titulo { margin: 0 0 4px; font-size: 1rem; font-weight: 700; }
.an__pie {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
}

/* --- Cifras de cabecera --- */
.an__tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.an-tile {
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: center;
}
.an-tile__n {
  font-size: 1.1rem; font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.an-tile__l { font-size: .7rem; color: var(--muted); line-height: 1.3; }

/* --- Observaciones --- */
.an__obs { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.an__obs li { font-size: .88rem; line-height: 1.5; }
.an__nota {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem; line-height: 1.5;
}

/* --- Lienzo de las gráficas --- */
.an__lienzo { position: relative; min-width: 0; }

.an-eje {
  fill: var(--muted);
  font-family: inherit;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.an-rejilla { stroke: var(--line); stroke-width: 1; }
/* La mediana manda sobre la referencia: llena frente a punteada. */
.an-mediana { stroke-width: 2; opacity: .85; }
.an-referencia {
  stroke: var(--muted); stroke-width: 1.5;
  stroke-dasharray: 4 4; opacity: .7;
}
/* Anillo del color de la superficie: separa los puntos que se solapan. */
.an-punto { stroke: var(--surface); stroke-width: 2; }

.an-vacio {
  padding: 26px 10px;
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}

/* --- Globo de información --- */
.an-globo {
  position: absolute;
  z-index: 5;
  max-width: 220px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--bg);
  font-size: .76rem;
  font-weight: 600;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: var(--sh-md);
}

/* --- Barra de reparto --- */
.an-barra {
  display: flex;
  height: 26px;
  border-radius: 99px;
  overflow: hidden;
  /* Un hilo del color del fondo entre trozos, para que no se fundan. */
  gap: 2px;
  background: var(--surface);
}
.an-barra__trozo { min-width: 3px; }

.an-leyenda {
  margin: 12px 0 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 6px 16px;
}
.an-leyenda li {
  display: flex; align-items: center; gap: 7px;
  font-size: .82rem; color: var(--ink);
}
.an-leyenda__punto {
  width: 11px; height: 11px; flex: none;
  border-radius: 3px;
}

/* --- Tabla --- */
.an__tabla > summary {
  min-height: 44px;
  display: flex; align-items: center;
  color: var(--muted);
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
}
.an-tabla {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.an-tabla th, .an-tabla td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}
.an-tabla th:first-child, .an-tabla td:first-child { text-align: left; }
.an-tabla th {
  color: var(--muted);
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}

@media (min-width: 480px) {
  .an__tiles { grid-template-columns: repeat(4, 1fr); }
}
