* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: #f5f5f5;
  color: #222;
}

header {
  background: #1a5fa8;
  color: white;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  flex-wrap: wrap;
}

h1 {
  font-weight: normal;
  font-size: 2rem;
  padding: 0rem 2rem;
  text-align: center;
}
nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}
nav a {
  color: white;
  text-decoration: none;
  padding-left: 1.5rem;
  font-size: 1rem;
  font-weight: normal;
  padding: 1rem 1.618rem;
  flex: 1 1 0;
  text-align: center;
}
nav a:hover {
  background-color: #555;
}

nav a:hover {
  opacity: 1;
}

main {
  margin: 1rem auto;
  padding: 0 2%;
}

.resumen {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  text-align: center;
}

.tarjeta {
  background: white;
  margin: .3rem;
  border-radius: 8px;
  padding: 1.2rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  flex: 1 1 0;
}

.tarjeta .valor {
  font-size: 2rem;
  /* font-weight: 600; */
  color: #1a5fa8;
}

.tarjeta .etiqueta {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.3rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #333;
}

.demarcaciones {
  list-style-type: none;
}
.demarcacion-elemento {
  background: white;
  margin: 1em 0 1em 0;
  border-radius: 1rem;
  box-shadow: 0 .1em .3em rgba(0, 0, 0, 0.06);
}
.demarcacion-enlace{
  display: block;
  padding: 1rem 1.2rem;
  text-decoration: none;
  color: #1a5fa8;

}
.demarcacion-enlace:visited{
  color: #1a5fa8;
}
.demarcacion-encabezado{
  font-size: 1rem;
  font-weight: 500;
}
.demarcacion-pares {
  /* text-align: right; */
  margin-top: -1rem;
}
.demarcacion-primer-elemento {
  text-align: right; /* Añadido */
}
.demarcacion-termino {
  display: inline;
  font-weight: 100;
  font-size: .7em;
  color: #1a5fa8;
}
.demarcacion-definicion {
  display: inline;
  color: #1a5fa8;
  font-weight:bold
}
.demarcacion-barra {
  width: 100%;
  height: 2rem;
}

.demarcacion-barra {
  width: 100%;
  height: .7rem;
  background-color:grey; /* Firefox */
  border-radius: .35rem;
}

meter::-webkit-meter-bar { 
  background: #eee;
  border-radius: .35em; 
}
/* relleno (todas las variantes usan el mismo color) */
meter::-webkit-meter-optimum-value,
meter::-webkit-meter-suboptimum-value,
meter::-webkit-meter-even-less-good-value {
  background: #1a5fa8;
  border-radius: .35em;
}
meter::-moz-meter-bar {
  background: #1a5fa8;
  border-radius: .35em;
}

.demarcacion-detalles {
  /* text-align: left; */
  display: inline-flex; /* Añadido */
  flex-flow: row;
}

/* .demarcacion-detalles > div {
  display: inline
} */
.demarcacion-detalles::after {
  content: "•";
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.4rem;
}
.demarcacion-detalles:last-child::after {
  content: none;
}
.demarcacion-detalle {
  /* display: inline; */
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.4rem;
}
dt.demarcacion-detalle::after {
  content: ":\00a0";
}
dd.demarcacion-detalle::after {
  content: "\00a0";
}
.pie {
  font-size: 0.78rem;
  color: #aaa;
  text-align: center;
  margin-top: 2rem;
  padding-bottom: 2rem;
}

.volver {
  display: inline-block;
  font-size: 0.85rem;
  color: #1a5fa8;
  text-decoration: none;
  margin-bottom: 1.2rem;
}

.volver:hover {
  text-decoration: underline;
}

.ficha {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
}

.ficha h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.ficha .demarcacion {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1.2rem;
}

.metricas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.metrica {
  background: #f5f5f5;
  border-radius: 6px;
  padding: 0.9rem 1rem;
}

.metrica .valor {
  font-size: 1.5rem;
  font-weight: 600;
}

.metrica .etiqueta {
  font-size: 0.78rem;
  color: #777;
  margin-top: 0.2rem;
}

.grafica-bloque {
  background: white;
  border-radius: 8px;
  padding: 2% 1%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
  width: 100%;
  position: relative;
  height: 50vh;
  min-height: 17.7rem;
}
.grafica-evolucion {
  width: 100% !important;
  height: 100% !important;
}
.grafica-bloque h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: #333;
}

.filtro-anios {
  display: none;
  /* display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;*/
} 
/* 
.filtro-anios button {
  padding: 0.3rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: white;
  font-size: 0.82rem;
  cursor: pointer;
  color: #444;
}

.filtro-anios button.activo {
  background: #1a5fa8;
  color: white;
  border-color: #1a5fa8;
}

.filtros {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filtros input,
.filtros select {
  padding: 0.5rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
  color: #222;
}

.filtros input {
  flex: 1;
  min-width: 200px;
} */

.contador {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

thead {
  background: #f0f0f0;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  color: #555;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

th:hover {
  background: #e4e4e4;
}

td {
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  border-top: 1px solid #f0f0f0;
}

tr:hover td {
  background: #fafafa;
}

.barra-mini {
  height: 6px;
  background: #e8e8e8;
  border-radius: 3px;
  overflow: hidden;
  width: 80px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.barra-mini-relleno {
  height: 100%;
  border-radius: 3px;
}

.pct-valor {
  font-weight: 600;
  vertical-align: middle;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: #e8f0fe;
  color: #1a5fa8;
}

.enlace-embalse {
  color: #1a5fa8;
  font-weight: 500;
  text-decoration: none;
}

.enlace-embalse:hover {
  text-decoration: underline;
}