/* Knöpfe, Felder, Chips, Karten, Tabellen, Dialoge, Toast */

/* ---------- Knöpfe ---------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--btn-h); padding: 0 var(--sp-5); border-radius: var(--r-btn);
  font-weight: var(--fw-bold); font-size: var(--fs-base); line-height: 1.2; text-decoration: none; text-align: center;
  border: 2px solid var(--blue); background: var(--surface); color: var(--blue);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.knopf svg { width: 22px; height: 22px; flex: none; }
.knopf:hover { background: var(--blue-50); color: var(--blue-hover); border-color: var(--blue-hover); }
.knopf--primaer { background: var(--blue); color: #fff; }
.knopf--primaer:hover { background: var(--blue-hover); color: #fff; }
.knopf--gefahr { border-color: var(--red-text); color: var(--red-text); }
.knopf--gefahr:hover { background: var(--red-tint); color: var(--red-text); border-color: var(--red-text); }
.knopf--gefahr-voll { background: var(--red-text); border-color: var(--red-text); color: #fff; }
.knopf--gefahr-voll:hover { background: #a32f2f; color: #fff; border-color: #a32f2f; }
.knopf--voll { width: 100%; }
.knopf[disabled], .knopf[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.knopf--text {
  border: 0; background: none; padding: 0 var(--sp-2); min-height: var(--tap-min); color: var(--blue);
  font-weight: var(--fw-bold);
}
.knopf--text:hover { background: none; text-decoration: underline; color: var(--blue-hover); }
.knopf--symbol {
  border: 0; background: none; padding: 0; width: var(--tap-min); min-height: var(--tap-min); height: var(--tap-min);
  color: var(--text); position: relative; border-radius: var(--r-btn);
}
.knopf--symbol:hover { background: var(--bg-2); color: var(--blue); }
.knopf--symbol svg { width: 26px; height: 26px; }
.knopf--symbol .zaehler { position: absolute; top: 4px; right: 2px; }
.knopf--klein { min-height: 40px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
@media (max-width: 767px) {
  .knopf--haupt-mobil { min-height: var(--btn-h-mobile); width: 100%; }
}

/* Stern Merken */
.stern[aria-pressed="true"] { background: var(--orange-tint); border-color: var(--orange-text); color: var(--orange-text); }
.stern[aria-pressed="true"] svg { fill: var(--orange); stroke: var(--orange-text); }

/* ---------- Zähler / Badges ---------- */
.zaehler {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--red-text); color: #fff; font-size: 13px; font-weight: var(--fw-bold); line-height: 1;
  font-feature-settings: var(--num-features);
}
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-btn);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); line-height: 1.4; white-space: nowrap;
  background: var(--bg-3); color: var(--text);
}
.badge svg { width: 16px; height: 16px; flex: none; }
.badge--neutral  { background: var(--blue-50); color: var(--blue-hover); }
.badge--gut      { background: var(--green-tint); color: var(--green); }
.badge--achtung  { background: var(--orange-tint); color: var(--orange-text); }
.badge--kritisch { background: var(--red-tint); color: var(--red-text); }
.badge--aktion   { background: var(--orange); color: var(--black); }
.badge--neu      { background: var(--orange); color: var(--black); }
.badge--demo     { background: var(--bg-3); color: var(--text-2); border: 1px dashed var(--line-input); }

/* ---------- Felder ---------- */
.feld { display: flex; flex-direction: column; gap: 6px; }
.feld + .feld { margin-top: var(--sp-5); }
.feld label, .feld .feld__label { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--text); }
.feld__hilfe { font-size: var(--fs-xs); color: var(--text-2); }
.eingabe, .auswahl, .textfeld {
  width: 100%; min-height: var(--input-h); padding: 0 var(--sp-4); border: 1px solid var(--line-input);
  border-radius: var(--r-input); background: var(--surface); font-size: var(--fs-base);
}
.textfeld { padding: var(--sp-3) var(--sp-4); min-height: 140px; resize: vertical; line-height: var(--lh-base); }
.auswahl { appearance: none; padding-right: 44px; background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.eingabe:focus-visible, .auswahl:focus-visible, .textfeld:focus-visible { border: 2px solid var(--blue); box-shadow: 0 0 0 3px var(--blue-200); border-radius: var(--r-input); }
.eingabe[aria-invalid="true"], .textfeld[aria-invalid="true"] { border: 2px solid var(--red-text); }
.feld__fehler { display: flex; gap: 6px; align-items: flex-start; color: var(--red-text); font-size: var(--fs-sm); font-weight: var(--fw-semi); }
.feld__fehler svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.eingabe-gruppe { position: relative; display: flex; }
.eingabe-gruppe .eingabe { padding-right: 60px; }
.eingabe-gruppe .knopf--text { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.eingabe-gruppe .eingabe-auge { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; min-width: 48px; min-height: 48px; padding: 0; }

.haken { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap-min); cursor: pointer; font-weight: var(--fw-semi); }
.haken input { width: 26px; height: 26px; accent-color: var(--blue); flex: none; margin: 0; }

/* Suchfeld (Pille) */
.suchfeld { position: relative; display: flex; align-items: center; width: 100%; }
.suchfeld svg { position: absolute; left: 16px; width: 22px; height: 22px; color: var(--text-muted); pointer-events: none; }
.suchfeld input {
  width: 100%; min-height: var(--input-h); padding: 0 var(--sp-4) 0 50px; border-radius: var(--r-pill);
  border: 1px solid var(--line-input); background: var(--surface); font-size: var(--fs-base);
}
.suchfeld input::placeholder { color: var(--text-muted); }
.suchfeld input:focus-visible { border: 2px solid var(--blue); box-shadow: 0 0 0 3px var(--blue-200); border-radius: var(--r-pill); }
.suchfeld-knopf {
  align-items: center; gap: var(--sp-3); width: 100%; min-height: 48px; padding: 0 var(--sp-4); border-radius: var(--r-pill);
  border: 1px solid var(--line-input); background: var(--bg-2); color: var(--text-2); font-weight: var(--fw-semi); font-size: 16px; text-align: left;
}
.suchfeld-knopf:hover { background: var(--surface); border-color: var(--blue); color: var(--text); }
.suchfeld-knopf svg { width: 22px; height: 22px; color: var(--text-muted); flex: none; }
.suchfeld-knopf span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: inherit; font-size: 13px; font-weight: var(--fw-bold); padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface); color: var(--text-2); }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.chips__label { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--text-2); margin-right: var(--sp-1); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--sp-4); margin: 2px 0;
  border-radius: var(--r-pill); border: 1px solid var(--line-input); background: var(--surface);
  font-weight: var(--fw-semi); font-size: var(--fs-sm); color: var(--text); text-decoration: none; position: relative;
}
.chip::after { content: ""; position: absolute; inset: -4px 0; } /* Tippfläche 48 px */
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--blue-100); border-color: var(--blue); color: var(--blue-hover); font-weight: var(--fw-bold); }
.chip svg { width: 18px; height: 18px; }
.chip-gruppe { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); margin-bottom: var(--sp-4); }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }

/* ---------- Schalter ---------- */
.schalter { display: inline-flex; align-items: center; gap: var(--sp-3); min-height: var(--tap-min); background: none; border: 0; padding: 0 var(--sp-1); font-weight: var(--fw-bold); color: var(--text); }
.schalter__bahn { position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line-input); transition: background var(--dur-fast) var(--ease); flex: none; }
.schalter__bahn::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--line-input); transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.schalter[aria-checked="true"] .schalter__bahn { background: var(--blue); border-color: var(--blue); }
.schalter[aria-checked="true"] .schalter__bahn::after { transform: translateX(20px); background: #fff; }
.schalter__wort { min-width: 2.2em; text-align: left; font-size: var(--fs-sm); }
.schalter[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Karten ---------- */
.karte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--sp-5); }
@media (max-width: 767px) { .karte { padding: var(--sp-4); } }
.karte--flach { padding: 0; overflow: hidden; }
.karte > h2, .karte > h3 { margin-bottom: var(--sp-3); }

/* ---------- Kachel (Widget) ---------- */
.kachel { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--sp-5); min-width: 0; transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
@media (max-width: 767px) { .kachel { padding: var(--sp-4); } }
.kachel:hover { box-shadow: var(--shadow-1); border-color: var(--line-strong); }
.kachel__kopf { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); min-height: 40px; }
.kachel__symbol { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-btn); background: var(--blue-50); color: var(--blue); }
.kachel__symbol svg { width: 24px; height: 24px; }
.kachel__titel { flex: 1; min-width: 0; font-size: var(--fs-md); font-weight: var(--fw-bold); line-height: 1.2; overflow-wrap: normal; hyphens: auto; }
.kachel__titel a { color: var(--text); text-decoration: none; }
.kachel__titel a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card); z-index: 0; }
.kachel__titel a:focus-visible { box-shadow: none; }
.kachel__titel a:focus-visible::after { box-shadow: var(--focus-ring); }
.kachel__pfeil { color: var(--text-muted); width: 24px; height: 24px; flex: none; }
.kachel__inhalt { flex: 1; min-width: 0; }
.kachel__inhalt a, .kachel__inhalt button, .kachel__fuss a, .kachel__fuss button { position: relative; z-index: 1; }
.kachel__fuss { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--text-2); font-weight: var(--fw-semi); }
.kachel--offline .kachel__inhalt > :not(.hinweis) { opacity: .6; }
.kachel--alarm-rand { border-left: 4px solid var(--red); }
.kachel__beschreibung { color: var(--text-2); }
.kachel__mehr { display: inline-flex; align-items: center; min-height: var(--tap-min); font-weight: var(--fw-bold); margin-top: var(--sp-2); }

/* KPI */
.kpi-reihe { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.kpi-reihe--modul { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: var(--sp-3); }
@media (max-width: 380px) { .kpi-reihe--modul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.kpi--karte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--sp-4); }
.kpi--klickbar.kpi--karte:hover { border-color: var(--blue); }
.kpi__link { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; min-width: 0; }
a.kpi__link:hover { color: inherit; }
a.kpi__link:hover .kpi__label > span { text-decoration: underline; }
.kpi__unter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 2px; }
.kpi__wert { font-size: var(--fs-kpi); font-weight: var(--fw-black); line-height: 1.05; font-feature-settings: var(--num-features); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.01em; color: var(--text); white-space: nowrap; }
.kpi__einheit { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--text-2); margin-left: 4px; letter-spacing: 0; }
.kpi__label { font-weight: var(--fw-semi); color: var(--text); font-size: var(--fs-sm); line-height: 1.3; display: flex; align-items: center; gap: 4px; }
.kpi__label svg { width: 18px; height: 18px; color: var(--text-muted); }
.kpi__trend { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--text-2); }
.kpi__trend svg { width: 16px; height: 16px; }
.kpi--gut .kpi__trend, .kpi--gut .kpi__wert { color: var(--green); }
.kpi--kritisch .kpi__wert { color: var(--red-text); }
.kpi--kritisch .kpi__trend { color: var(--red-text); }
.kpi--achtung .kpi__wert { color: var(--orange-text); }
.kpi--achtung .kpi__trend { color: var(--orange-text); }
.kpi--kritisch.kpi--karte { border-left: 4px solid var(--red); }
.kpi--achtung.kpi--karte { border-left: 4px solid var(--orange); }
.kpi--gut.kpi--karte { border-left: 4px solid var(--green); }
.kpi__ton { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: var(--fw-bold); }
.kpi__ton svg { width: 16px; height: 16px; }
.info-knopf { display: inline-grid; place-items: center; width: 32px; height: 32px; margin: -8px 0; border: 0; background: none; color: var(--text-muted); padding: 0; position: relative; }
.info-knopf::after { content: ""; position: absolute; inset: -8px; }
.info-knopf:hover { color: var(--blue); }
.info-knopf svg { width: 20px; height: 20px; }
.info-text { font-size: var(--fs-xs); color: var(--text-2); margin-top: 4px; }

/* Zeilenliste (Kachel/Allgemein) */
.zeilen { list-style: none; margin: 0; padding: 0; }
.zeile { position: relative; display: flex; align-items: center; gap: var(--sp-3); min-height: var(--row-h); padding: var(--sp-2) 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.zeilen > li:first-child > .zeile { border-top: 0; }
a.zeile:hover, button.zeile:hover { color: var(--text); background: var(--bg-2); }
button.zeile { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; font: inherit; }
.zeile--rand { padding-left: var(--sp-3); }
.zeile--rand::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 2px; background: var(--blue-200); }
.zeile--gut::before { background: var(--green); }
.zeile--kritisch::before { background: var(--red); }
.zeile--achtung::before { background: var(--orange); }
.zeile__symbol { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-btn); background: var(--blue-50); color: var(--blue); }
.zeile__symbol svg { width: 22px; height: 22px; }
.zeile__text { flex: 1; min-width: 0; }
.zeile__titel { font-weight: var(--fw-semi); line-height: 1.3; }
.zeile__unter { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.35; margin-top: 2px; }
.zeile__wert { flex: none; text-align: right; font-weight: var(--fw-black); font-feature-settings: var(--num-features); font-size: var(--fs-md); }
.zeile__pfeil { flex: none; width: 22px; height: 22px; color: var(--text-muted); }
.zeile mark, .treffer mark { background: none; color: inherit; font-weight: var(--fw-black); text-decoration: underline; text-decoration-color: var(--blue-300); text-decoration-thickness: 2px; }

/* Alarm */
.alarm { position: relative; display: flex; gap: var(--sp-3); padding: var(--sp-4); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--r-card); background: var(--surface); }
.alarm--hoch   { border-left-color: var(--red); }
.alarm--mittel { border-left-color: var(--orange); }
.alarm__symbol { flex: none; width: 28px; height: 28px; }
.alarm--hoch .alarm__symbol { color: var(--red-text); }
.alarm--mittel .alarm__symbol { color: var(--orange-text); }
.alarm--info .alarm__symbol { color: var(--blue); }
.alarm__text { flex: 1; min-width: 0; }
.alarm__kopf { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-bottom: 2px; }
.alarm__titel { font-weight: var(--fw-bold); }
.alarm__satz { line-height: 1.45; }
.alarm__meta { font-size: var(--fs-xs); color: var(--text-2); font-weight: var(--fw-semi); margin-top: var(--sp-1); }
.alarm__aktion { margin-top: var(--sp-3); }
.alarme { display: grid; gap: var(--sp-3); }
.wichtig-heute { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; margin-bottom: var(--sp-6); }
@media (min-width: 1024px) { .wichtig-heute { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }
.stufe-wort { font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .06em; }
.alarm--hoch .stufe-wort { color: var(--red-text); }
.alarm--mittel .stufe-wort { color: var(--orange-text); }
.alarm--info .stufe-wort { color: var(--blue); }

/* Hinweis-Bänder */
.hinweis { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-card); border: 1px solid var(--line); background: var(--blue-50); font-weight: var(--fw-semi); margin-bottom: var(--sp-4); }
.hinweis svg { flex: none; width: 24px; height: 24px; margin-top: 1px; color: var(--blue); }
.hinweis--achtung { background: var(--orange-tint); border-color: #f3d29a; color: #4a2c00; }
.hinweis--achtung svg { color: var(--orange-text); }
.hinweis--fehler { background: var(--red-tint); border-color: #f4c3c3; }
.hinweis--fehler svg { color: var(--red-text); }
.hinweis--gut { background: var(--green-tint); border-color: #c4dcc7; }
.hinweis--gut svg { color: var(--green); }
.hinweis--demo { background: var(--bg-3); border-style: dashed; border-color: var(--line-input); }
.hinweis--demo svg { color: var(--text-2); }
.hinweis__text { flex: 1; min-width: 0; }
.hinweis .knopf--text { min-height: 32px; padding: 0; }

/* Stand-Zeile */
.stand { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-2); }
.stand svg { width: 16px; height: 16px; flex: none; }
.stand--veraltet { color: var(--orange-text); }
.stand--offline { color: var(--red-text); }

/* Leer / Fehler */
.leer { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: var(--sp-6) var(--sp-4); color: var(--text-2); }
.leer__symbol { width: 56px; height: 56px; color: var(--blue-300); }
.leer__symbol svg { width: 56px; height: 56px; }
.leer__text { max-width: 44ch; color: var(--text); font-weight: var(--fw-semi); }
.leer--fehler .leer__symbol { color: var(--red-text); }
.leer--klein { padding: var(--sp-4) 0; }
.technik { margin-top: var(--sp-2); font-size: var(--fs-xs); text-align: left; }
.technik summary { cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; font-weight: var(--fw-semi); color: var(--text-2); }
.technik pre { white-space: pre-wrap; background: var(--bg-2); padding: var(--sp-3); border-radius: var(--r-btn); margin: 0; font-size: 13px; }

/* Skelett */
.skelett { background: var(--bg-3); border-radius: 3px; animation: puls 1.4s ease-in-out infinite; }
.skelett--zeile { height: 18px; margin: 10px 0; }
.skelett--gross { height: 44px; width: 60%; margin-bottom: 8px; }
.skelett--kurz { width: 40%; }
.skelett-text { font-size: var(--fs-xs); color: var(--text-2); font-weight: var(--fw-semi); margin-top: var(--sp-2); }
@keyframes puls { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skelett { animation: none; } }

/* ---------- Tabellen ---------- */
.tabelle-huelle { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.tabelle { width: 100%; font-size: var(--fs-sm); }
.tabelle th, .tabelle td { padding: var(--sp-2) var(--sp-3); text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; height: var(--row-h); }
.tabelle thead th { position: sticky; top: 0; background: var(--bg-2); font-weight: var(--fw-bold); color: var(--text); white-space: nowrap; border-bottom: 1px solid var(--line-strong); height: 52px; z-index: 1; }
.tabelle tbody tr:last-child td { border-bottom: 0; }
.tabelle tbody tr:hover { background: var(--bg-2); }
.tabelle tbody tr.klickbar { cursor: pointer; }
.tabelle td.zahl, .tabelle th.zahl { text-align: right; font-feature-settings: var(--num-features); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle td:first-child { font-weight: var(--fw-semi); }
.tabelle td.rand-gut { box-shadow: inset 4px 0 0 var(--green); }
.tabelle td.rand-kritisch { box-shadow: inset 4px 0 0 var(--red); }
.tabelle td.rand-achtung { box-shadow: inset 4px 0 0 var(--orange); }
.tabelle td a { font-weight: var(--fw-bold); text-decoration: none; }
.tabelle td a:hover { text-decoration: underline; }
.tabelle .breite-gross { min-width: 180px; }
.tabelle .breite-mittel { min-width: 110px; }
.sort-knopf { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0 4px; min-height: 44px; font-weight: var(--fw-bold); color: var(--text); }
.sort-knopf:hover { color: var(--blue); }
.sort-knopf svg { width: 16px; height: 16px; color: var(--text-muted); }
th[aria-sort="ascending"] .sort-knopf, th[aria-sort="descending"] .sort-knopf { color: var(--blue); }
th[aria-sort] .sort-knopf svg { color: var(--blue); }
.tabelle .aktionen { text-align: right; white-space: nowrap; }

/* Karten statt Tabelle (Handy) */
.daten-karten { display: none; list-style: none; padding: 0; margin: 0; }
.daten-karten > li + li { margin-top: var(--sp-3); }
.daten-karte { position: relative; display: block; padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); color: var(--text); text-decoration: none; }
a.daten-karte:hover { border-color: var(--blue); color: var(--text); }
.daten-karte--gut { border-left: 4px solid var(--green); }
.daten-karte--kritisch { border-left: 4px solid var(--red); }
.daten-karte--achtung { border-left: 4px solid var(--orange); }
.daten-karte__titel { font-weight: var(--fw-bold); font-size: var(--fs-base); line-height: 1.3; padding-right: 28px; }
.daten-karte__unter { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.daten-karte__werte { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); margin-top: var(--sp-3); }
.daten-karte__wert-label { font-size: var(--fs-xs); color: var(--text-2); font-weight: var(--fw-semi); }
.daten-karte__wert { font-size: 22px; font-weight: var(--fw-black); font-feature-settings: var(--num-features); line-height: 1.1; }
.daten-karte__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-3); }
.daten-karte__pfeil { position: absolute; right: 12px; top: 16px; width: 22px; height: 22px; color: var(--text-muted); }
@media (max-width: 767px) {
  .nur-breit { display: none !important; }
  .daten-karten { display: block; }
}
/* Spalten-Priorität (06 §8: Spalte.prioritaet) */
@media (min-width: 768px) and (max-width: 1023px) {
  .tabelle .prio-2, .tabelle .prio-3 { display: none; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .tabelle .prio-3 { display: none; }
}
/* Aktionsspalte bleibt rechts stehen, auch wenn die Tabelle seitlich scrollt */
.tabelle th.aktionen, .tabelle td.aktionen { position: sticky; right: 0; background: var(--surface); box-shadow: -10px 0 10px -10px rgba(20,20,20,.18); }
.tabelle thead th.aktionen { background: var(--bg-2); z-index: 2; }
.tabelle tbody tr:hover td.aktionen { background: var(--bg-2); }

/* Blättern */
.blaettern { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-4); }
.blaettern__info { color: var(--text-2); font-weight: var(--fw-semi); font-size: var(--fs-sm); }
.blaettern__knoepfe { display: flex; gap: var(--sp-2); }
@media (max-width: 767px) { .blaettern__knoepfe { width: 100%; } .blaettern__knoepfe .knopf { flex: 1; } }

/* ---------- Reiter ---------- */
.reiter { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-5); overflow-x: auto; scrollbar-width: none; }
.reiter__punkt { position: relative; display: inline-flex; align-items: center; min-height: 52px; padding: 0 var(--sp-4); background: none; border: 0; font-weight: var(--fw-semi); color: var(--text-2); text-decoration: none; white-space: nowrap; }
.reiter__punkt:hover { color: var(--blue); }
.reiter__punkt[aria-selected="true"], .reiter__punkt[aria-current="page"] { color: var(--blue); font-weight: var(--fw-bold); }
.reiter__punkt[aria-selected="true"]::after, .reiter__punkt[aria-current="page"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; background: var(--blue); }

/* ---------- Diagramm ---------- */
.diagramm { position: relative; width: 100%; min-width: 0; }
.diagramm svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.diagramm__legende { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin-bottom: var(--sp-2); font-size: var(--fs-sm); font-weight: var(--fw-semi); }
.legende-punkt { display: inline-flex; align-items: center; gap: 6px; }
.legende-punkt::before { content: ""; width: 18px; height: 4px; border-radius: 2px; background: var(--farbe, var(--blue)); }
.legende-punkt--2::before { background: repeating-linear-gradient(90deg, #767979 0 6px, transparent 6px 10px); }
.legende-punkt--3::before { background: var(--green); }
.diagramm__tipp { position: absolute; pointer-events: none; background: var(--black); color: #fff; padding: 6px 10px; border-radius: 3px; font-size: var(--fs-xs); font-weight: var(--fw-semi); white-space: nowrap; transform: translate(-50%, -110%); z-index: 2; }
.diagramm-achse { font-size: 14px; fill: var(--text-2); font-family: var(--font); font-weight: 600; font-feature-settings: var(--num-features); }
.sparkline { display: flex; align-items: flex-end; gap: var(--sp-3); margin-top: var(--sp-3); }
.sparkline svg { flex: 1; height: auto; max-height: 80px; min-width: 0; }
.sparkline__wert { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--text-2); font-feature-settings: var(--num-features); white-space: nowrap; }

/* ---------- Dialog & Panel ---------- */
.ueberlagerung { position: fixed; inset: 0; z-index: var(--z-overlay); background: rgba(24,23,22,.42); }
.dialog {
  position: fixed; z-index: var(--z-dialog); left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-pop); padding: var(--sp-6);
}
.dialog h2 { margin-bottom: var(--sp-3); font-size: var(--fs-lg); }
.dialog__text { color: var(--text); }
.dialog__knoepfe { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-6); }
@media (max-width: 767px) { .dialog__knoepfe { flex-direction: column-reverse; } .dialog__knoepfe .knopf { width: 100%; min-height: var(--btn-h-mobile); } }

.panel {
  position: fixed; z-index: var(--z-dialog); top: 0; right: 0; bottom: 0; width: min(480px, 100vw);
  background: var(--surface); box-shadow: var(--shadow-pop); display: flex; flex-direction: column;
}
.panel__kopf { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-6); border-bottom: 1px solid var(--line); min-height: var(--topbar-h); }
.panel__kopf h2 { flex: 1; font-size: var(--fs-lg); }
.panel__inhalt { flex: 1; overflow: auto; padding: var(--sp-6); overscroll-behavior: contain; }
.panel__fuss { padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--line); display: flex; gap: var(--sp-3); flex-wrap: wrap; }
@media (max-width: 767px) { .panel { width: 100vw; } .panel__inhalt { padding: var(--sp-4); } .panel__fuss .knopf { flex: 1; } }

.faq { border-top: 1px solid var(--line); }
.faq:last-child { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 56px; cursor: pointer; font-weight: var(--fw-bold); list-style: none; padding: var(--sp-2) 0; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { width: 22px; height: 22px; flex: none; color: var(--blue); transition: transform var(--dur-fast); }
.faq[open] summary svg { transform: rotate(180deg); }
.faq p { padding: 0 0 var(--sp-4); color: var(--text); }

/* Menü ⋯ */
.menue { position: absolute; z-index: var(--z-overlay); right: 0; top: calc(100% + 4px); min-width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-pop); padding: var(--sp-1) 0; }
.menue button { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 48px; padding: 0 var(--sp-4); background: none; border: 0; text-align: left; font-weight: var(--fw-semi); }
.menue button:hover, .menue button:focus-visible { background: var(--blue-50); color: var(--blue-hover); box-shadow: none; }
.menue button svg { width: 20px; height: 20px; color: var(--text-muted); }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: var(--z-toast); left: 50%; transform: translateX(-50%); bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom) + 16px); display: flex; flex-direction: column; gap: var(--sp-2); width: min(520px, calc(100vw - 32px)); pointer-events: none; }
@media (min-width: 768px) { .toasts { bottom: 24px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); background: var(--black); color: #fff; border-radius: var(--r-card); box-shadow: var(--shadow-pop); font-weight: var(--fw-semi); min-height: 56px; }
.toast svg { flex: none; width: 22px; height: 22px; }
.toast--gut svg { color: #8fd19a; }
.toast--fehler svg { color: #ff9b9b; }
.toast__text { flex: 1; }
.toast .knopf--symbol { color: #fff; }
.toast .toast__aktion { color: #fff; text-decoration: underline; font-weight: var(--fw-bold); min-height: 44px; }
.toast .toast__aktion:hover { background: rgba(255,255,255,.12); color: #fff; }
.toast .knopf--symbol:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Kopierfeld */
.kopierfeld { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.kopierfeld code { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-sm); background: var(--bg-2); border: 1px solid var(--line); padding: 6px 10px; border-radius: 3px; word-break: break-all; }

/* Status-Ampel */
.ampel { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--fw-bold); font-size: var(--fs-sm); }
.ampel::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--line-input); flex: none; }
.ampel--laeuft::before { background: var(--green); }
.ampel--laeuft { color: var(--green); }
.ampel--verzoegert::before { background: var(--orange); }
.ampel--verzoegert { color: var(--orange-text); }
.ampel--gestoert::before, .ampel--defekt::before { background: var(--red); }
.ampel--gestoert, .ampel--defekt { color: var(--red-text); }
.ampel--aus { color: var(--text-2); }
.ampel--demo::before { background: var(--blue-300); }
.ampel--demo { color: var(--blue-hover); }

/* Felder-Liste (Detail) */
.felder { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 0 var(--sp-6); margin: 0; }
.felder > div { padding: var(--sp-3) 0; border-top: 1px solid var(--line); min-width: 0; }
.felder dt { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--text-2); letter-spacing: .02em; }
.felder dd { margin: 2px 0 0; font-weight: var(--fw-semi); font-size: var(--fs-base); }
.felder dd.ton-gut { color: var(--green); }
.felder dd.ton-kritisch { color: var(--red-text); }
.felder dd.ton-achtung { color: var(--orange-text); }
.felder--zwei { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
/* Büro-Laptop (768–1279 px): Aktionsknöpfe mit Symbol nur als Symbol, damit die Tabelle hineinpasst */
@media (min-width: 768px) and (max-width: 1279px) {
  .tabelle td.aktionen .knopf:has(svg) > span { display: none; }
  .tabelle td.aktionen .knopf:has(svg) { min-width: 44px; padding-inline: 10px; }
}
@media (max-width: 480px) {
  .toast { flex-wrap: wrap; }
  .toast__text { flex: 1 1 calc(100% - 90px); }
  .toast .toast__aktion { order: 3; margin-left: 34px; }
}
