/* DatosClaros · Agua y energía en España */
.ae {
	--ae-fg: var(--tinta);
	--ae-muted: var(--tinta-2);
	--ae-bg: var(--hoja);
	--ae-panel: var(--hoja-2);
	--ae-line: var(--linea);
	--ae-accent: var(--t-dinero);
	--ae-bad: var(--peligro);
	--ae-ok: var(--bien);
	--ae-warn: #A35F00;
	--ae-muted-bar: var(--linea);
	--ae-radius: var(--radio);
	color: var(--ae-fg);
}
:root[data-theme="dark"] .ae { --ae-warn: #f0b04d; }

.ae h2 { margin: 0 0 .75rem; scroll-margin-top: 130px; }
.ae h3 { font-size: 1.02rem; margin: 0 0 .25rem; }
.ae p { margin: .4rem 0; }
.ae .ae-lead { font-size: 1.12rem; max-width: 62rem; }
.ae .ae-muted, .ae .ae-nota { color: var(--ae-muted); font-size: .88rem; }
.ae .ae-nota a { color: inherit; }
.ae b.ae-n, .ae .ae-v { font-variant-numeric: tabular-nums; }

.ae .dc-el-indice a.activo { text-decoration: underline; text-underline-offset: 4px; }

.ae-seccion { margin: 2.5rem 0; }
.ae-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); gap: 1rem; }
.ae-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.ae-card { background: var(--ae-panel); border: 1px solid var(--ae-line); border-radius: var(--ae-radius); padding: 1.1rem 1.2rem; min-width: 0; }
.ae-tile .ae-k { font-size: .85rem; color: var(--ae-muted); }
.ae-tile .ae-v { font-size: 1.9rem; font-weight: 600; line-height: 1.2; margin: .2rem 0; }
.ae-tile .ae-u { font-size: .95rem; font-weight: 400; color: var(--ae-muted); margin-left: .2rem; }
.ae .ae-bad { color: var(--ae-bad); }
.ae .ae-ok { color: var(--ae-ok); }
.ae .ae-warn { color: var(--ae-warn); }

/* Barras HTML (sin JS) */
.ae-barras { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .45rem; }
.ae-barras li { display: grid; grid-template-columns: minmax(7rem, 38%) 1fr auto; align-items: center; gap: .6rem; font-size: .88rem; }
.ae-barras .ae-et { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ae-barras .ae-pista { position: relative; height: 1.1rem; background: transparent; }
.ae-barras .ae-barra { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--ae-accent); transform-origin: left; }
.ae-barras .ae-barra.ae-mal { background: var(--ae-bad); }
.ae-barras .ae-barra.ae-gris { background: var(--ae-muted-bar); }
.ae-barras .ae-marca { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ae-fg); }
.ae-barras .ae-punto { position: absolute; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--ae-muted-bar); border: 1px solid var(--ae-panel); }
.ae-barras .ae-val { font-variant-numeric: tabular-nums; color: var(--ae-muted); min-width: 3.5rem; text-align: right; }
@media (max-width: 520px) { .ae-barras li { grid-template-columns: 1fr auto; } .ae-barras .ae-pista { grid-column: 1 / -1; order: 3; } }
@media (prefers-reduced-motion: no-preference) {
	.ae-anim .ae-barra { animation: ae-crece .9s cubic-bezier(.2, .7, .2, 1) both; }
	@keyframes ae-crece { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

.ae-leyenda { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .82rem; color: var(--ae-muted); margin-top: .5rem; }
.ae-leyenda i { display: inline-block; width: .75rem; height: .75rem; border-radius: 2px; vertical-align: -1px; margin-right: .3rem; background: var(--ae-accent); }
.ae-leyenda i.ae-mal { background: var(--ae-bad); }
.ae-leyenda i.ae-gris { background: var(--ae-muted-bar); }
.ae-leyenda i.ae-raya { width: 2px; background: var(--ae-fg); }
.ae-leyenda i.ae-dot { border-radius: 50%; background: var(--ae-muted-bar); }

/* Tablas */
.ae-tabla { overflow-x: auto; margin-top: .8rem; }
.ae-tabla table { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
.ae-tabla th { text-align: left; color: var(--ae-muted); font-weight: 600; border-bottom: 1px solid var(--ae-line); padding: .35rem .4rem; }
.ae-tabla td { border-bottom: 1px solid var(--ae-line); padding: .35rem .4rem; vertical-align: top; }
.ae-tabla .ae-r { text-align: right; }

/* En directo */
.ae-directo .ae-vivo { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--ae-ok); font-weight: 600; }
.ae-directo .ae-vivo::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
@media (prefers-reduced-motion: no-preference) { .ae-directo .ae-vivo::before { animation: ae-late 1.6s infinite; } @keyframes ae-late { 50% { opacity: .25; } } }
.ae-cargando { min-height: 8rem; display: flex; align-items: center; justify-content: center; color: var(--ae-muted); font-size: .88rem; }
.ae-svg { width: 100%; height: auto; display: block; margin-top: .8rem; overflow: visible; }
.ae-svg text { fill: var(--ae-muted); font-size: 11px; font-family: inherit; }
.ae-svg .ae-linea { fill: none; stroke: var(--ae-accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ae-svg .ae-rej { stroke: var(--ae-line); }
.ae-svg .ae-ahora { stroke: var(--ae-fg); stroke-dasharray: 3 3; }

.ae-cronologia { list-style: none; padding: 0; margin: .8rem 0 0; border-left: 2px solid var(--ae-line); }
.ae-cronologia li { position: relative; padding: 0 0 .8rem 1rem; font-size: .9rem; }
.ae-cronologia li::before { content: ""; position: absolute; left: -6px; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--ae-accent); }
.ae-cronologia time { display: block; font-size: .8rem; color: var(--ae-muted); }

.ae-fuentes { font-size: .85rem; color: var(--ae-muted); }
.ae-fuentes li { margin: .2rem 0; }
.ae-fuentes a { color: inherit; }
