/* ==========================================================================
   states.css – Leer · Laden · Fehler · Erfolg · Hinweise
   Leer:    kleine Faden-Zeichnung + hilfreicher Satz + EINE Aktion          .a-empty
   Laden:   Skeleton in Leinen (ruhiger Schimmer) · Faden-Lader für Prüfungen  .a-skel · .a-loader
   Fehler:  klare Sprache + Lösung (was ist passiert, was tun wir, was können Sie tun)
            .a-alert (Zeile/Banner) · .a-error (Block mit gerissenem Faden)
   Erfolg:  Toast mit Stich (overlay.css) · .a-success (Knoten schließt sich)
   Neu laden: .is-refreshing hält den Rahmen und dimmt nur (kein Springen)

   Zeichnungen: <svg class="a-art" viewBox="0 0 120 80" aria-hidden="true">
     .a-art__ink (Kontur) · .a-art__paper (Fläche) · .a-art__thread (roter Faden)
     .a-art__knot (Knoten) · .a-art__dash (gestrichelt) · .a-art--draw (zeichnet sich einmal)
   ========================================================================== */

/* ---- Zeichnungen ------------------------------------------------------------------- */
.a-art { display: block; width: 7.5rem; height: auto; overflow: visible; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.a-art__ink { stroke: var(--fg-2); stroke-width: 1.25; opacity: .7; }
.a-art__line { stroke: var(--a-line-3); stroke-width: 1.25; }
.a-art__paper { fill: var(--a-surface); stroke: var(--a-line-3); stroke-width: 1.25; }
.a-art__linen { fill: var(--a-surface-2); stroke: var(--a-line-3); stroke-width: 1.25; }
.a-art__thread { stroke: var(--a-thread); stroke-width: 1.5; }
.a-art__knot { fill: var(--a-thread); stroke: none; }
.a-art__dash { stroke: var(--a-line-3); stroke-width: 1.25; stroke-dasharray: 3 4; }
.a-art__stitch { stroke: var(--a-thread); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
@media (prefers-reduced-motion: no-preference) {
  .a-art--draw .a-art__thread { stroke-dasharray: 400; stroke-dashoffset: 400; animation: a-draw 1.4s var(--ease-out) .15s forwards; }
  .a-art--draw .a-art__knot { transform-box: fill-box; transform-origin: center; animation: a-knot 520ms var(--ease-back) 1.1s both; }
}
@keyframes a-draw { to { stroke-dashoffset: 0; } }
@keyframes a-knot { from { transform: scale(0); } }

/* ---- Leer ----------------------------------------------------------------------------- */
.a-empty {
  display: grid;
  justify-items: center;
  gap: .5rem;
  max-width: 26rem;
  margin-inline: auto;
  padding: 2.25rem 1rem;
  text-align: center;
}
.a-empty__art { width: 7.5rem; margin-bottom: .5rem; }
.a-empty__title {
  --wght: 380;
  font-family: var(--font-display);
  font-weight: var(--wght);
  font-variation-settings: "SOFT" 50, "WONK" 0;
  font-size: var(--a-fs-xl);
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--fg);
  text-wrap: balance;
}
.a-empty__title em { font-style: italic; font-variation-settings: "SOFT" 100, "WONK" 1; }
.a-empty__text { font-size: var(--a-fs-base); line-height: var(--a-lh-text); color: var(--fg-2); text-wrap: pretty; }
.a-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: .75rem; }
/* kompakt in Karte/Tabelle: Zeichnung links */
.a-empty--inline {
  grid-template-columns: auto minmax(0, 1fr);
  justify-items: start;
  align-items: center;
  column-gap: 1.25rem;
  row-gap: .2rem;
  max-width: 34rem;
  padding: 1.25rem 1rem;
  text-align: left;
}
.a-empty--inline .a-empty__art { grid-row: span 3; width: 4.5rem; margin: 0; }
.a-empty--inline .a-empty__title { font-size: var(--a-fs-lg); }
.a-empty--inline .a-empty__actions { justify-content: flex-start; margin-top: .4rem; }
/* Leere Suche: Begriff hervorheben */
.a-empty__query { font-weight: 600; color: var(--fg); }

/* ---- Laden: Skeleton -------------------------------------------------------------------- */
.a-skel {
  position: relative;
  display: block;
  width: var(--w, 100%);
  height: var(--h, .75rem);
  border-radius: 4px;
  background: var(--a-skel);
  overflow: hidden;
}
.a-skel + .a-skel { margin-top: .5rem; }
.a-skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--a-skel-hi) 50%, transparent);
  transform: translateX(-100%);
  animation: a-shimmer 1.8s var(--ease-inout) infinite;
}
@keyframes a-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .a-skel::after { animation: none; display: none; } }
.a-skel--title { --h: 1.125rem; --w: 45%; }
.a-skel--figure { --h: 2.25rem; --w: 6.5rem; border-radius: 6px; }
.a-skel--circle { --h: 2rem; --w: 2rem; border-radius: 50%; }
.a-skel--pill { --h: 1.375rem; --w: 5rem; border-radius: var(--r-pill); }
.a-skel--block { --h: 8rem; border-radius: var(--a-r-card); }
.a-skel-inline { display: inline-block; vertical-align: middle; }
.a-skel-inline + .a-skel-inline { margin-top: 0; margin-left: .5rem; }
.a-skel-row { display: flex; align-items: center; gap: .75rem; }
.a-skel-row + .a-skel-row { margin-top: .9rem; }
.a-skel-row > .a-skel { margin: 0; }
/* Diagramm lädt: Balken in Leinen */
.a-skel-bars { display: flex; align-items: flex-end; gap: 4px; height: 8rem; }
.a-skel-bars > .a-skel { flex: 1 1 0; margin: 0; border-radius: 3px 3px 0 0; }
/* Neu laden: Rahmen bleibt, nur gedimmt */
.is-refreshing { opacity: .55; transition: opacity var(--d-2) var(--ease-out); pointer-events: none; }

/* Faden-Lader: für Prüfungen mit Wartezeit („Kalender werden geprüft …“) */
.a-loader {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--fg-2);
  font-size: var(--a-fs-sm);
}
.a-loader__thread {
  position: relative;
  flex: none;
  width: 3.5rem;
  height: 2px;
  background-image: repeating-linear-gradient(90deg, var(--a-thread) 0 6px, transparent 6px 10px);
  background-size: 20px 2px;
  animation: a-sew .9s linear infinite;
}
.a-loader__thread::after {   /* Nadel/Knoten vorn */
  content: "";
  position: absolute;
  right: -3px;
  top: -2.5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--a-thread);
}
@keyframes a-sew { to { background-position: 20px 0; } }
@media (prefers-reduced-motion: reduce) { .a-loader__thread { animation: none; } }
.a-loader--block { display: flex; justify-content: center; padding: 2rem 1rem; }

/* ---- Hinweis-Zeile / Banner ------------------------------------------------------------- */
.a-alert {
  --a-al-c: var(--a-neutral);
  --a-al-fill: var(--a-neutral-fill);
  --a-al-bg: var(--a-surface-2);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: .25rem .85rem;
  padding: .85rem 1rem .9rem;
  border-radius: var(--a-r-card);
  background: var(--a-al-bg);
  box-shadow: inset 3px 0 0 var(--a-al-fill);
  color: var(--fg);
  font-size: var(--a-fs-base);
  line-height: 1.45;
}
.a-alert--attn { --a-al-c: var(--a-attn); --a-al-fill: var(--a-attn-fill); --a-al-bg: var(--a-attn-soft); }
.a-alert--due { --a-al-c: var(--a-due); --a-al-fill: var(--a-due-fill); --a-al-bg: var(--a-due-soft); }
.a-alert--ok { --a-al-c: var(--a-ok); --a-al-fill: var(--a-ok-fill); --a-al-bg: var(--a-ok-soft); }
.a-alert--info { --a-al-c: var(--a-info); --a-al-fill: var(--a-info-fill); --a-al-bg: var(--a-info-soft); }
.a-alert__icon { display: inline-grid; place-items: center; width: 1.375rem; height: 1.375rem; color: var(--a-al-c); }
.a-alert__icon .a-ico { width: 1.25rem; height: 1.25rem; }
.a-alert__body { min-width: 0; display: grid; gap: .15rem; }
.a-alert__title { font-weight: 600; color: var(--fg); }
.a-alert__text { color: var(--fg); opacity: .86; }
.a-alert__text strong { font-weight: 600; opacity: 1; }
.a-alert__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; align-self: center; }
@media (max-width: 599.98px) {
  .a-alert { grid-template-columns: auto minmax(0, 1fr); }
  .a-alert__actions { grid-column: 2; justify-self: start; margin-top: .4rem; }
}
.a-alert--banner { border-radius: 0; padding-inline: var(--a-gutter); box-shadow: inset 0 -1px 0 var(--a-line), inset 0 3px 0 var(--a-al-fill); }
.a-alert--compact { padding: .55rem .75rem; font-size: var(--a-fs-sm); gap: .1rem .6rem; }
.a-alert--compact .a-alert__icon { width: 1.125rem; height: 1.125rem; }
.a-alert--compact .a-alert__icon .a-ico { width: 1.0625rem; height: 1.0625rem; }

/* ---- Fehler-Block (Bereich konnte nicht laden) -------------------------------------------- */
.a-error {
  display: grid;
  justify-items: center;
  gap: .5rem;
  max-width: 30rem;
  margin-inline: auto;
  padding: 2.25rem 1rem;
  text-align: center;
}
.a-error .a-art { width: 8rem; margin-bottom: .5rem; }
.a-error__title {
  font-family: var(--font-display);
  font-weight: 380;
  font-variation-settings: "SOFT" 50, "WONK" 0;
  font-size: var(--a-fs-xl);
  line-height: 1.2;
  color: var(--fg);
}
.a-error__text { color: var(--fg-2); font-size: var(--a-fs-base); line-height: var(--a-lh-text); }
.a-error__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: .75rem; }
.a-error__code { margin-top: .5rem; font-size: var(--a-fs-xs); color: var(--a-fg-3); }

/* ---- Erfolg (Knoten schließt sich) ---------------------------------------------------- */
.a-success {
  display: grid;
  justify-items: center;
  gap: .45rem;
  padding: 2rem 1rem;
  text-align: center;
}
.a-success .a-art { width: 8rem; margin-bottom: .5rem; }
.a-success__title {
  font-family: var(--font-display);
  font-weight: 380;
  font-variation-settings: "SOFT" 50, "WONK" 0;
  font-size: var(--a-fs-2xl);
  line-height: 1.15;
}
.a-success__title em { font-style: italic; color: var(--accent); font-variation-settings: "SOFT" 100, "WONK" 1; }
.a-success__text { color: var(--fg-2); max-width: 30rem; line-height: var(--a-lh-text); }

@media (forced-colors: active) {
  .a-alert { border: 1px solid CanvasText; }
  .a-skel { border: 1px dashed CanvasText; }
}
