/* API Data Elements – Frontend. Farben/Abstände über Variablen anpassbar. */

.ade {
	--ade-text: #2b2b2b;
	--ade-muted: #6b7280;
	--ade-grid: #e5e7eb;
	--ade-zero: #374151;
	--ade-border: #d6d6db;
	--ade-head-bg: #5b2c50;
	--ade-head-text: #fff;
	--ade-stripe: #f6f6f8;
	--ade-surface: #fff;
	--ade-focus: #1b6ed4;
	--ade-radius: 4px;

	margin: 0 0 2em;
	color: var(--ade-text);
	min-width: 0;
}

.ade__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}
.ade__title {
	flex: 1 1 auto;
	margin: 0 0 .6em;
	font-size: 1.15em;
	line-height: 1.3;
	text-align: center;
}
.ade__title:empty { display: none; }
.ade__actions { display: flex; gap: 6px; flex: 0 0 auto; }
.ade__actions:empty { display: none; }

.ade__body { position: relative; min-height: 120px; }
.ade--line .ade__body,
.ade--bar .ade__body { min-height: min(var(--ade-height, 400px), 70vh); }

.ade__canvas {
	position: relative;
	height: clamp(240px, 62vw, var(--ade-height, 400px));
}
.ade__canvas canvas { display: block; }

.ade__caption {
	margin-top: .6em;
	font-size: .85em;
	color: var(--ade-muted);
}

/* ---- Buttons ---- */
.ade__btn {
	font: inherit;
	font-size: .85em;
	line-height: 1.2;
	padding: .45em .9em;
	border: 1px solid var(--ade-border);
	border-radius: var(--ade-radius);
	background: var(--ade-surface);
	color: var(--ade-text);
	cursor: pointer;
}
.ade__btn:hover { border-color: var(--ade-text); }
.ade__btn--small { font-size: .75em; padding: .35em .7em; }

.ade :focus-visible {
	outline: 2px solid var(--ade-focus);
	outline-offset: 2px;
}

/* ---- Status: Laden, leer, Fehler ---- */
.ade__status {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .7em;
	padding: 1em;
	text-align: center;
	color: var(--ade-muted);
	font-size: .95em;
	background: var(--ade-stripe);
	border-radius: var(--ade-radius);
}
.ade__status--error { color: #9b1c1c; background: #fdf2f2; }
.ade__status-detail {
	max-width: 100%;
	font-size: .8em;
	white-space: pre-wrap;
	word-break: break-word;
	color: inherit;
	background: none;
}
noscript .ade__status { position: static; }

.ade__spinner {
	width: 28px;
	height: 28px;
	border: 3px solid var(--ade-grid);
	border-top-color: var(--ade-head-bg);
	border-radius: 50%;
	animation: ade-spin .8s linear infinite;
}
@keyframes ade-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	.ade__spinner { animation-duration: 2.4s; }
}

.ade__note {
	margin: .5em 0 0;
	font-size: .8em;
	color: #92400e;
}

/* ---- Legende ---- */
.ade__legend {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px 14px;
	margin: 0 0 .6em;
	padding: 0;
	list-style: none;
}
.ade__legend li { margin: 0; padding: 0; }
.ade__legend-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 4px;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: .8em;
	cursor: pointer;
	border-radius: 3px;
}
.ade__legend-item[aria-pressed="false"] { opacity: .45; }
.ade__legend-item[aria-pressed="false"] span:last-child { text-decoration: line-through; }
.ade__swatch {
	display: inline-block;
	width: 22px;
	border-top: 3px solid var(--ade-swatch);
}
.ade__swatch--dashed { border-top-style: dashed; }
.ade__swatch--dotted { border-top-style: dotted; }
.ade--bar .ade__swatch {
	width: 12px;
	height: 12px;
	border: 0;
	border-radius: 2px;
	background: var(--ade-swatch);
}

/* ---- Datentabelle unter Diagrammen ---- */
.ade__data { margin-top: .8em; font-size: .9em; }
.ade__data summary {
	display: inline-block;
	cursor: pointer;
	color: var(--ade-muted);
	font-size: .9em;
}
.ade__data[open] summary { margin-bottom: .5em; }
.ade__data .ade__scroll { max-height: 360px; overflow-y: auto; }
.ade__data .ade-table thead th { position: sticky; top: 0; z-index: 2; }

/* ---- Tabellen ---- */
.ade__scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	/* Schatten am Rand zeigen an, dass horizontal gescrollt werden kann */
	background:
		linear-gradient(to right, var(--ade-surface) 30%, rgba(255,255,255,0)) left center / 40px 100% no-repeat local,
		linear-gradient(to left, var(--ade-surface) 30%, rgba(255,255,255,0)) right center / 40px 100% no-repeat local,
		radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.18), rgba(0,0,0,0)) left center / 12px 100% no-repeat scroll,
		radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.18), rgba(0,0,0,0)) right center / 12px 100% no-repeat scroll;
}

.ade-table {
	width: 100%;
	margin: 0;
	border-collapse: separate;
	border-spacing: 0;
	font-size: .85em;
	line-height: 1.35;
	font-variant-numeric: tabular-nums;
}
.ade-table th,
.ade-table td {
	padding: .45em .7em;
	border: 0;
	border-bottom: 1px solid var(--ade-border);
	text-align: left;
	vertical-align: middle;
	white-space: nowrap;
}
.ade-table thead th {
	background: var(--ade-head-bg);
	color: var(--ade-head-text);
	font-weight: 600;
	border-bottom-color: rgba(255,255,255,.35);
}
.ade-table thead th.ade-group { text-align: center; }
.ade-table tbody tr:nth-child(even) td { background: var(--ade-stripe); }
.ade-table tbody tr:nth-child(odd) td { background: var(--ade-surface); }
.ade-table .is-num { text-align: right; }
.ade-table .ade-gstart { border-left: 1px solid var(--ade-border); }
.ade-table thead .ade-gstart { border-left-color: rgba(255,255,255,.35); }
.ade-table .ade-sublabel {
	display: block;
	font-size: .85em;
	font-weight: 400;
	opacity: .85;
}
.ade-table tbody th {
	font-weight: 600;
	background: var(--ade-surface);
}
/* Erste Spalte bleibt beim horizontalen Scrollen stehen */
.ade-table tbody tr > :first-child,
.ade-table thead tr:first-child > :first-child {
	position: sticky;
	left: 0;
	z-index: 1;
}
.ade-table thead tr:first-child > :first-child { z-index: 3; }

.ade-table--data { font-size: .9em; }
.ade-table--data thead th { background: var(--ade-stripe); color: var(--ade-text); border-bottom-color: var(--ade-border); }

@media (max-width: 600px) {
	.ade-table { font-size: .78em; }
	.ade-table th,
	.ade-table td { padding: .4em .5em; }
	.ade-table tbody th { white-space: normal; min-width: 7.5em; }
	.ade__title { font-size: 1.05em; text-align: left; }
}

.ade-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ade-missing { padding: .8em; border: 1px dashed #d63638; color: #d63638; }
