/* Basis-Styling. Bewusst schlank gehalten -- hier ist Platz fuer dein Design. */

/* Markenfarben, direkt aus dem Logo ausgelesen.
 *
 * Wichtig zum Blau: #4086ec erreicht auf Weiss nur 3,60:1. Das genuegt fuer
 * Grafik und grosse Flaechen (WCAG verlangt dort 3:1), aber NICHT fuer Text
 * oder Buttons mit weisser Schrift -- dafuer sind 4,5:1 noetig.
 *
 * Deshalb zwei Ebenen: --brand-blue bleibt die Logofarbe fuer Flaechen und
 * Akzente, --accent ist die abgedunkelte Variante fuer alles Anklickbare.
 * Beide stammen aus demselben Farbton, der Unterschied faellt kaum auf.
 */

:root {
  /* Original aus dem Logo */
  --brand-blue: #4086ec;   /* 3,60:1 -- nur Flaeche und Grafik */
  --brand-green: #3b7d23;  /* 5,07:1 -- auch fuer Text nutzbar */
  --brand-ink: #042433;    /* 16,09:1 -- das blaustichige Schwarz des Logos */

  /* Abgeleitet fuer Interaktion */
  --accent: #3064b1;       /* 5,86:1 in beide Richtungen */
  --accent-hover: #295799; /* 7,20:1 */

  --bg: #ffffff;
  --fg: var(--brand-ink);
  --muted: #5a6672;
  --line: #dfe4ea;
  --accent-fg: #ffffff;
  --warn-bg: #fdf3e3;
  --err-bg: #fdeaea;
  --ok-bg: #eef5e9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* --- Kopf- und Fusszeile --- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
/* Das Logo ist mit 1,93:1 vergleichsweise hoch -- der Schriftzug nimmt nur
   die mittlere Zone ein, oben und unten sitzt das Knotenmotiv. Unter etwa
   150 px Breite wird "Automation" unleserlich, deshalb diese Groesse. */
.brand img {
  display: block;
  width: 168px;
  height: auto;
}

@media (max-width: 560px) {
  .brand img { width: 132px; }
}

/* --- Customer branding (customer area only) --- */

.brand-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
/* Logos come in any aspect ratio, so constrain both sides. */
.customer-brand {
  display: inline-flex;
  align-items: center;
  padding-left: 1.25rem;
  border-left: 1px solid var(--line);
}
.customer-brand img {
  display: block;
  max-height: 56px;
  max-width: 200px;
  width: auto;
  height: auto;
}
.customer-theme .site-header {
  border-top: 4px solid var(--brand-blue);
}

@media (max-width: 560px) {
  .brand-group { gap: 0.75rem; }
  .customer-brand { padding-left: 0.75rem; }
  .customer-brand img { max-height: 40px; max-width: 120px; }
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}
/* :not(.btn) ist wichtig -- ohne die Einschraenkung gewinnt diese Regel
   gegen .btn (hoehere Spezifitaet) und faerbt den Button-Text dunkel
   statt weiss. Das ergaebe auf dem blauen Grund nur 2,75:1. */
.site-header nav a:not(.btn) {
  color: var(--fg);
  text-decoration: none;
}
.site-header nav a:not(.btn):hover { text-decoration: underline; }

/* Der Kundenbereich ist kein Werbeziel, sondern eine Funktion fuer
   bestehende Kunden -- abgesetzt, aber ohne Button-Flaeche. */
.site-header nav .nav-login {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.site-header nav .nav-login:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 1.25rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer a { color: var(--muted); }

.inline-form { display: inline; margin: 0; }
.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* --- Schaltflaechen --- */

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
  border: 1px solid var(--accent);
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 1.05rem; }
.btn-ghost { background: transparent; color: var(--accent); }

/* --- Inhalte --- */

.lead { color: var(--muted); font-size: 1.1rem; max-width: 46rem; }
.empty { color: var(--muted); }
.muted-note { color: var(--muted); font-size: 0.95rem; }

.eyebrow,
.section-label {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Die Startseite laeuft ueber die volle Breite; der Innenabstand liegt
   deshalb an den Abschnitten, nicht an <main>. */
body.home main { max-width: none; padding: 0; }

body.home .hero,
body.home .section > * {
  max-width: 68rem;
  margin-inline: auto;
}

.section { padding: 4rem 1.25rem; }
.section + .section { border-top: 1px solid var(--line); }
.section h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  line-height: 1.2;
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
}

/* Getoenter Abschnitt zur Gliederung. Sehr hell gehalten, damit der
   Textkontrast unveraendert bei 16:1 bleibt. */
.section-tinted {
  background: #f6f8fb;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* ------------------------------------------------------------- Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
  padding: 4.5rem 1.25rem 4rem;
}

/* Die Ueberschrift ist derzeit ein vollstaendiger Satz, kein kurzer
   Slogan. Deshalb kleiner und mit etwas mehr Zeilenabstand als eine
   Schlagzeile -- sonst erschlaegt sie die Seite und wird schwer lesbar. */
.hero h1 {
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  line-height: 1.25;
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 2rem; }

.hero-visual svg { width: 100%; height: auto; display: block; }
.net-edges line {
  stroke: var(--brand-ink);
  stroke-width: 5;
  stroke-linecap: round;
}
.net-nodes circle { stroke: var(--brand-ink); stroke-width: 6; }
.node-blue { fill: var(--brand-blue); }
.node-hollow { fill: #fff; stroke: var(--brand-green); stroke-width: 5; }

/* Unter 54rem steht die Grafik dem Text im Weg -- dann weglassen.
   Sie traegt keine Information, also geht dabei nichts verloren. */
@media (max-width: 54rem) {
  .hero { grid-template-columns: 1fr; gap: 0; }
  .hero-visual { display: none; }
}

/* ------------------------------------------- Themenbereiche (Bubbles) */

.bubble-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.75rem;
  margin-top: 3rem;
}

.bubble {
  text-align: center;
  padding: 0 0.5rem;
}

.bubble-icon {
  display: grid;
  place-items: center;
  width: 7.5rem;
  height: 7.5rem;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: #eef4fd;
  border: 2px solid var(--brand-blue);
  transition: transform 0.15s ease, background 0.15s ease;
}
.bubble:hover .bubble-icon {
  transform: translateY(-3px);
  background: #e3edfc;
}

.bubble-icon svg { width: 3.4rem; height: 3.4rem; }

/* Die Icons sind reine Grafik: Fuer sie gilt die 3:1-Grenze, nicht 4,5:1.
   Das Markenblau liegt mit 3,60:1 darueber. */
.ic-line {
  fill: none;
  stroke: var(--brand-ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-fill { fill: var(--brand-blue); }

.bubble h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  line-height: 1.3;
}
.bubble p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Hinweis, solange die Inhalte noch nicht ausgearbeitet sind.
   Bewusst zurueckhaltend: Er soll die Beschreibung ergaenzen, nicht
   mit ihr konkurrieren. */
.bubble-soon {
  margin-top: 0.75rem !important;
  font-size: 0.85rem !important;
  font-style: italic;
  color: var(--accent) !important;
}

/* ------------------------------------------------------ Kontaktformular */

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 3rem;
  align-items: start;
}

@media (max-width: 54rem) {
  .contact-layout { grid-template-columns: 1fr; gap: 2rem; }
}

.contact-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.75rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
@media (max-width: 34rem) {
  .field-row { grid-template-columns: 1fr; }
}

.contact-form .field { margin: 0 0 1.1rem; }
.contact-form label { font-size: 0.92rem; }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form select,
.contact-form textarea {
  width: 100%;
  max-width: none;
}

.field-consent label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: start;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--muted);
}
.field-consent input[type="checkbox"] { margin-top: 0.25rem; }

.form-errors { color: #b3261e; margin-bottom: 1rem; }

/* Honeypot: fuer Menschen unsichtbar, fuer Bots aber ein normales Feld
   im DOM. display:none wuerde von manchen Bots erkannt und uebersprungen,
   deshalb aus dem Sichtbereich geschoben statt ausgeblendet. */
.hp-wrap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------------------------------------------------- Themenbereiche (alt) */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.topic {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.75rem;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.topic:hover {
  border-color: var(--brand-blue);
  box-shadow: 0 2px 16px rgba(4, 36, 51, 0.07);
}

.topic header { display: flex; gap: 1rem; align-items: flex-start; }
.topic h3 { margin: 0 0 0.3rem; font-size: 1.2rem; line-height: 1.25; }
.topic-sub { margin: 0; color: var(--muted); font-size: 0.95rem; }

.topic-num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.topic-items {
  list-style: none;
  counter-reset: topicitem;
  margin: 1.5rem 0 0;
  padding: 0;
}
.topic-items li {
  counter-increment: topicitem;
  position: relative;
  padding: 0.65rem 0 0.65rem 2.6rem;
  border-top: 1px solid var(--line);
}
.topic-items li::before {
  content: counter(topicitem, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.65rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--brand-green);
}

/* -------------------------------------------------------- Vorgehen */

.flow {
  list-style: none;
  counter-reset: flowstep;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
}

/* Sechs Schritte verteilen sich mit auto-fit sonst auf 4+2 -- eine
   angebrochene Reihe wirkt unruhig. Ab drei Spalten wird daraus 3+3. */
@media (min-width: 56rem) {
  .flow { grid-template-columns: repeat(3, 1fr); }
}

.flow li {
  position: relative;
  padding: 1.5rem 1.25rem 1.25rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.flow-num {
  position: absolute;
  top: -0.9rem;
  left: 1.25rem;
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--brand-green);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.flow h3 { margin: 0.35rem 0 0.4rem; font-size: 1.02rem; }
.flow p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* --------------------------------------------------------- Kontakt */

.contact-box {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  justify-content: space-between;
  padding: 2.5rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-blue);
  border-radius: 12px;
  background: #f6f8fb;
}
.contact-box h2 { margin-bottom: 0.5rem; }
.contact-action { display: grid; gap: 0.75rem; justify-items: start; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.data-table th { font-size: 0.85rem; text-transform: uppercase; color: var(--muted); }

.chart-wrap {
  position: relative;
  height: 420px;
  margin-top: 1.5rem;
}

/* --- Konto-Seiten (Login, Registrierung, Passwort, 2FA) ---
   Schmale, zentrierte Spalte: Auf diesen Seiten gibt es genau eine
   Aufgabe, und eine ueber die volle Breite gezogene Formularzeile
   erschwert das Lesen nur. */

body.auth main {
  max-width: 30rem;
  padding-top: 3rem;
}

body.auth main h1 {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
}

body.auth main > p:first-of-type {
  color: var(--muted);
}

body.auth form {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

body.auth input[type="text"],
body.auth input[type="email"],
body.auth input[type="password"] {
  max-width: 100%;
}

/* Die Passwortregeln von Django kommen als <ul> aus dem Formular. */
body.auth form ul {
  color: var(--muted);
  font-size: 0.85rem;
  padding-left: 1.1rem;
  margin: 0 0 1rem;
}
body.auth form ul.errorlist {
  color: #b3261e;
  font-size: 0.9rem;
}

/* --- Rechtstexte (Impressum, Datenschutz) ---
   Schmale Spalte: Fliesstext ueber die volle Fensterbreite ist bei diesen
   Textmengen kaum lesbar. Rund 70 Zeichen pro Zeile ist die uebliche
   Obergrenze. */

body.legal main { max-width: 44rem; }

body.legal h1 { font-size: 1.9rem; margin-bottom: 0.25rem; }

body.legal h2 {
  margin: 2.75rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 1.3rem;
}
body.legal h2:first-of-type { border-top: 0; padding-top: 0; }

body.legal h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.05rem;
}

body.legal p { margin: 0 0 1rem; }
body.legal ul { margin: 0 0 1.25rem; padding-left: 1.3rem; }
body.legal li { margin-bottom: 0.5rem; }

/* Die Server-Log-Aufzaehlungen sind kurze Stichpunkte, die als
   zweispaltige Liste deutlich kompakter sitzen. */
body.legal .log-list {
  columns: 2;
  column-gap: 2rem;
}
@media (max-width: 40rem) {
  body.legal .log-list { columns: 1; }
}

body.legal address {
  font-style: normal;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--brand-blue);
  background: #f7f9fc;
  border-radius: 0 6px 6px 0;
}

body.legal .stand {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Der Widerspruchs-Hinweis muss sich nach Art. 21 Abs. 4 DSGVO vom
   uebrigen Text abheben. Im Ausgangstext stand er in Grossbuchstaben --
   das erfuellt zwar die Hervorhebung, ist aber deutlich schlechter
   lesbar (Grossbuchstaben nehmen dem Wort seine Silhouette) und wird von
   Screenreadern teils buchstabiert. Fettung plus farbige Kante hebt
   genauso deutlich hervor. */
body.legal .emphasis-block {
  font-weight: 600;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--brand-green);
  background: #f4f8f1;
  border-radius: 0 6px 6px 0;
}

/* Offene Stellen im Rechtstext -- unuebersehbar, damit sie nicht
   versehentlich live gehen. */
body.legal .todo {
  background: #fff3bf;
  color: #6b4e00;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-weight: 600;
}

/* --- Meldungen --- */

.messages {
  list-style: none;
  max-width: 68rem;
  margin: 1rem auto 0;
  padding: 0 1.25rem;
}
.msg {
  padding: 0.7rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: var(--ok-bg);
}
.msg.warning { background: var(--warn-bg); }
.msg.error { background: var(--err-bg); }

/* --- Formulare (allauth nutzt schlichtes HTML) --- */

form p { margin: 0 0 1rem; }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  max-width: 26rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
.helptext { display: block; color: var(--muted); font-size: 0.85rem; }
.errorlist { color: #b3261e; padding-left: 1.1rem; }

button[type="submit"] {
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  cursor: pointer;
}

/* --- Wiki --- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wiki-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}
@media (max-width: 760px) {
  .wiki-layout { grid-template-columns: 1fr; gap: 1.5rem; }
}

.wiki-sidebar {
  position: sticky;
  top: 1rem;
  border-right: 1px solid var(--line);
  padding-right: 1.5rem;
}
@media (max-width: 760px) {
  .wiki-sidebar {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 1rem;
  }
}

.wiki-search input {
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  margin-bottom: 1rem;
}
.wiki-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.wiki-tree { list-style: none; margin: 0; padding: 0; }
.wiki-tree .wiki-tree { padding-left: 0.9rem; border-left: 1px solid var(--line); margin-left: 0.4rem; }
.wiki-tree a {
  display: block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: var(--fg);
  text-decoration: none;
}
.wiki-tree a:hover { background: var(--ok-bg); }
.wiki-tree a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-blue);
}

.wiki-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  background: var(--warn-bg);
  color: var(--fg);
  vertical-align: middle;
}

.wiki-breadcrumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.5rem; }
.wiki-breadcrumbs a { color: var(--muted); }

.wiki-meta { color: var(--muted); font-size: 0.9rem; }
.wiki-meta a { color: var(--accent); }

.wiki-body { max-width: 48rem; }
.wiki-body a { color: var(--accent); }
.wiki-body img { max-width: 100%; height: auto; border-radius: 4px; }
.wiki-body h2 { margin-top: 2rem; }
.wiki-body blockquote {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 4px solid var(--brand-blue);
  color: var(--muted);
}
.wiki-body pre {
  background: #f4f6f8;
  padding: 0.9rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
}
.wiki-body code { font-size: 0.92em; }
.wiki-body table { border-collapse: collapse; display: block; overflow-x: auto; }
.wiki-body th, .wiki-body td { border: 1px solid var(--line); padding: 0.4rem 0.7rem; text-align: left; }

.wiki-attachments { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.wiki-attachments h2 { font-size: 1.1rem; }
.wiki-attachments a { color: var(--accent); }

.wiki-results { list-style: none; padding: 0; }
.wiki-results li { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.wiki-results a { color: var(--accent); font-weight: 600; }
.wiki-results p { margin: 0.25rem 0 0; color: var(--muted); }

/* --- Calendar ---
 * Type colours come from the admin (Termin-Arten). Chips use a light tint
 * with dark text, so contrast does not depend on the colour.
 */

.calendar-page main { max-width: 76rem; }

/* Each entry sets --kind inline from its type's colour (see EventType). */

.cal-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 85% -20%, color-mix(in srgb, var(--brand-blue) 70%, transparent) 0, transparent 55%),
    radial-gradient(circle at 0% 120%, color-mix(in srgb, var(--brand-blue) 45%, transparent) 0, transparent 50%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 80%, black), var(--accent));
  box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--accent) 80%, black);
}
.cal-hero::after {
  /* subtle dot texture */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(to left, #000, transparent 70%);
  pointer-events: none;
}
.cal-hero > * { position: relative; z-index: 1; }
.cal-hero h1 { margin: 0.1rem 0 0.25rem; font-size: 2.4rem; letter-spacing: -0.02em; line-height: 1.1; }
.cal-eyebrow {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}
.cal-hero-sub { margin: 0; opacity: 0.9; }

.cal-stats { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.cal-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 7.5rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
}
.cal-stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.cal-stat-label { font-size: 0.8rem; opacity: 0.9; }
.cal-stat-title { font-weight: 600; line-height: 1.3; }

/* The three banner boxes are steps: status -> agreed -> proposed. */
a.cal-stat { color: #fff; text-decoration: none; transition: background 0.15s, transform 0.15s; }
a.cal-stat:hover { background: rgba(255, 255, 255, 0.24); transform: translateY(-1px); }
.cal-stat-step { position: relative; width: 13rem; }
.cal-stat-step + .cal-stat-step { margin-left: 0.6rem; }
.cal-stat-step + .cal-stat-step::before {
  /* small arrow between two steps */
  content: "";
  position: absolute;
  left: -0.95rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-top: 2px solid rgba(255, 255, 255, 0.7);
  border-right: 2px solid rgba(255, 255, 255, 0.7);
  transform: translateY(-50%) rotate(45deg);
}
.cal-stat-step.is-proposal { background: transparent; border-style: dashed; border-color: rgba(255, 255, 255, 0.55); }
@media (max-width: 760px) {
  .cal-stats { flex-direction: column; width: 100%; }
  .cal-stat-step { width: 100%; }
  .cal-stat-step + .cal-stat-step { margin-left: 0; margin-top: 0.4rem; }
  .cal-stat-step + .cal-stat-step::before { left: 1rem; top: -0.55rem; transform: rotate(135deg); }
}

/* Timeline on top at full width, the month view collapsed below it. */
.cal-timeline + .cal-month { margin-top: 1.5rem; }

.cal-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 1px 2px rgba(4, 36, 51, 0.04), 0 12px 32px -20px rgba(4, 36, 51, 0.25);
}
.cal-card h2 { margin: 0; font-size: 1.25rem; }

.cal-month { padding-block: 0; }
.cal-month[open] { padding-bottom: 1.5rem; }
.cal-month-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}
.cal-month-toggle::-webkit-details-marker { display: none; }
/* Chevron that turns when the panel opens. */
.cal-month-toggle::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.cal-month[open] .cal-month-toggle::before { transform: rotate(45deg); }
.cal-month-hint { margin-left: auto; font-size: 0.85rem; font-weight: 400; color: var(--muted); }
.cal-month-toggle:hover .cal-month-hint { color: var(--accent); }
.cal-month[open] .cal-month-toggle { border-bottom: 1px solid var(--line); margin-bottom: 1rem; }

.cal-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cal-month-nav { display: flex; align-items: center; gap: 0.4rem; }
.cal-nav-btn,
.cal-today-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cal-nav-btn { width: 2.1rem; font-size: 1.35rem; line-height: 1; }
.cal-today-btn { padding: 0 0.9rem; font-size: 0.85rem; font-weight: 600; }
.cal-nav-btn:hover,
.cal-today-btn:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, white); }

.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.35rem; }
.cal-row + .cal-row { margin-top: 0.35rem; }
.cal-weekday {
  padding: 0 0.4rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.cal-day {
  min-height: 6.25rem;
  padding: 0.4rem;
  border-radius: 10px;
  background: #f7f9fb;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: background 0.15s, box-shadow 0.15s;
}
.cal-day:hover { background: #eef2f6; }
.cal-day.is-outside { background: transparent; }
.cal-day.is-outside .cal-day-num { color: #b3bcc5; }
.cal-day.has-events { background: color-mix(in srgb, var(--brand-blue) 7%, white); }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--accent); background: var(--bg); }
.cal-day-num {
  align-self: flex-start;
  min-width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.cal-day.is-today .cal-day-num { background: var(--accent); color: #fff; }

.cal-chip {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border-left: 3px solid var(--kind);
  background: color-mix(in srgb, var(--kind) 13%, white);
  color: var(--fg);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}
.cal-chip span {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
}
.cal-chip svg { flex: none; width: 0.85rem; height: 0.85rem; margin-top: 0.05rem; fill: var(--kind); }
.cal-chip.is-proposed { background: var(--bg); border: 1px dashed var(--kind); border-left-width: 3px; }
.cal-span.is-proposed { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--kind) 18%, white) 0 6px, var(--bg) 6px 12px); border-top-style: dashed; }
.cal-chip:hover { transform: translateY(-1px); box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--kind) 60%, transparent); }

/* Multi-day entries: one bar per week row. The negative margins bridge the
   padding and gap between cells so the bar reads as continuous. */
.cal-span {
  display: block;
  height: 1.35rem;
  margin: 0 calc(-0.4rem - 0.18rem);
  padding: 0 0.5rem;
  background: color-mix(in srgb, var(--kind) 22%, white);
  border-top: 2px solid var(--kind);
  color: var(--fg);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: visible;
  position: relative;
}
/* The title may run on into the next days of the bar; keep it on top. */
.cal-span.starts { z-index: 1; }
.cal-span.starts { margin-left: 0; border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.cal-span.ends { margin-right: 0; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.cal-span:hover { background: color-mix(in srgb, var(--kind) 32%, white); }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}
.cal-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.cal-legend svg { width: 0.95rem; height: 0.95rem; fill: var(--kind); }

/* Timeline */
.cal-timeline h2 { margin-bottom: 1.1rem; }
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(to bottom, var(--line), color-mix(in srgb, var(--brand-blue) 40%, var(--line)));
}
.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 2.1rem 3.4rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.6rem 0;
  scroll-margin-top: 1.5rem;
}
.tl-dot {
  z-index: 1;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--kind);
  box-shadow: 0 0 0 4px var(--bg), 0 6px 14px -6px var(--kind);
}
.tl-dot svg { width: 1.05rem; height: 1.05rem; fill: #fff; }
.tl-date { display: flex; flex-direction: column; align-items: center; padding-top: 0.1rem; }
.tl-day { font-size: 1.45rem; font-weight: 700; line-height: 1; }
.tl-mon { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.tl-body {
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tl-item:target .tl-body,
.tl-body:hover { border-color: var(--kind); box-shadow: 0 8px 22px -14px var(--kind); }
.tl-top { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.75rem; }
.tl-kind { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: color-mix(in srgb, var(--kind) 75%, black); }
.tl-rel { color: var(--muted); }
.tl-body h3 { margin: 0.15rem 0 0; font-size: 1rem; line-height: 1.35; }
.tl-desc, .tl-admin { margin: 0.3rem 0 0; font-size: 0.88rem; color: var(--muted); }
.tl-desc { color: var(--fg); }
.tl-admin a { color: var(--accent); }

.tl-doc {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.55rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.tl-doc::before {
  content: "PDF";
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: var(--kind);
  color: #fff;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}
.tl-doc:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, white); }

.tl-range { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--muted); }
.tl-progress {
  height: 6px;
  margin-top: 0.5rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.tl-progress span { display: block; height: 100%; border-radius: inherit; background: var(--kind); }
.tl-item.is-running .tl-dot { box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px color-mix(in srgb, var(--kind) 30%, white); }
.tl-item.is-running .tl-rel { color: color-mix(in srgb, var(--kind) 75%, black); font-weight: 600; }

/* Proposals: not agreed yet, so drawn as outlines instead of solid. */
.tl-item.is-proposed .tl-dot { background: var(--bg); border: 2px dashed var(--kind); box-shadow: 0 0 0 4px var(--bg); }
.tl-item.is-proposed .tl-dot svg { fill: var(--kind); }
.tl-item.is-proposed .tl-body { border-style: dashed; background: var(--bg); }
.tl-badge {
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border: 1px dashed currentColor;
  border-radius: 999px;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}
.tl-group {
  margin: 1.2rem 0 0.3rem 2.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  scroll-margin-top: 1.5rem;
}

/* Completed: small green check on the dot. */
.tl-item.is-completed .tl-dot { position: relative; }
.tl-item.is-completed .tl-dot::after {
  content: "\2713";
  position: absolute;
  right: -0.3rem;
  bottom: -0.25rem;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: #2f7d32;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.tl-badge.is-done { border: 0; background: #e6f2e7; color: #23602a; }
.tl-progress.is-done span { background: #2f7d32; }

.tl-item.is-past .tl-dot { box-shadow: 0 0 0 4px var(--bg); }
.tl-item.is-past .tl-body { background: #fafbfc; }

.tl-today {
  position: relative;
  margin: 0.4rem 0 0.4rem 2.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.tl-today::after { content: ""; flex: 1; height: 2px; background: linear-gradient(to right, var(--accent), transparent); }
.tl-today::before {
  content: "";
  position: absolute;
  left: -2.15rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, white);
}

/* On phones the month grid gets too cramped; the timeline carries the content. */
@media (max-width: 640px) {
  .cal-hero { padding: 1.5rem; }
  .cal-hero h1 { font-size: 1.9rem; }
  .cal-day { min-height: 3rem; padding: 0.25rem; }
  .cal-chip { padding: 0; height: 0.4rem; border: 0; background: var(--kind); }
  .cal-chip span, .cal-chip svg { display: none; }
  .cal-span { height: 0.4rem; padding: 0; border-top: 0; background: var(--kind); }
  .cal-span span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cal-chip, .cal-day, .tl-body, .tl-doc, .cal-nav-btn, .cal-today-btn, .cal-month-toggle::before, a.cal-stat { transition: none; }
  .cal-chip:hover, a.cal-stat:hover { transform: none; }
}

/* --- Maturity assessment (Auswertungen) ---
 * One table per category: subcategories as rows, levels 1-7 as columns.
 * The rated range is a single cell spanning its levels, so it reads as one
 * bar; border-spacing keeps the columns aligned across all rows.
 */

.maturity { margin-bottom: 3rem; }
.maturity-group { margin-top: 2rem; }

/* Collapsible section: the heading row with the intro line is the toggle;
   the arrow sits left of the heading and turns when the section opens. */
.maturity-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}
/* Hide the browser's own small disclosure triangle in every browser
   (Safari uses -webkit-details-marker, Chrome/Firefox ::marker). */
.maturity-summary::-webkit-details-marker { display: none; }
.maturity-summary::marker { content: ""; }
.maturity-summary h2 { margin: 0 0 0.2rem; }
.maturity-summary .lead { display: block; margin: 0; }
.maturity-summary:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: 6px; }
.maturity-chevron {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border: 2px solid var(--panel-line);
  border-radius: 999px;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.maturity-chevron::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.1rem;
  height: 1.1rem;
  border-right: 4px solid var(--fg);
  border-bottom: 4px solid var(--fg);
  border-radius: 0 0 2px 0;
  /* Open: arrow down. Folded: arrow right. */
  transform: translate(-50%, -70%) rotate(45deg);
  transition: transform 0.15s;
}
.maturity-collapse:not([open]) .maturity-chevron::before { transform: translate(-70%, -50%) rotate(-45deg); }
.maturity-summary:hover .maturity-chevron { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, white); }

/* Assessment tabs (e.g. SIEMENS / Beckhoff) attached to the panel below:
   the active tab shares the panel's background and covers its top border.
   Tabs and panel share a slightly darker frame so they read as one unit. */
.maturity { --panel-line: #c9d2db; }
/* Tabs on the left, the PDF download on the right, on the same line. */
.maturity-tabbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
}
.maturity-pdf {
  margin: 0 0.25rem 0.45rem auto;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.maturity-pdf::before { content: "PDF"; margin-right: 0.45rem; padding: 0.05rem 0.3rem; border-radius: 4px; background: var(--accent); color: #fff; font-size: 0.62rem; }
.maturity-pdf:hover { background: color-mix(in srgb, var(--accent) 8%, white); }

.maturity-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.3rem;
  margin: 1.25rem 0 0;
  padding-left: 0.75rem;
  position: relative;
  z-index: 1;
}
.maturity-tabs a {
  padding: 0.65rem 1.5rem;
  border: 1px solid var(--panel-line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: #e9edf1;
  color: var(--muted);
  font-size: 1.02rem;
  font-weight: 600;
  text-decoration: none;
}
.maturity-tabs a:hover { color: var(--fg); background: color-mix(in srgb, var(--accent) 8%, white); }
.maturity-tabs a[aria-current="page"] {
  background: var(--bg);
  color: var(--fg);
  box-shadow: inset 0 4px 0 var(--accent);
  margin-bottom: -1px;
  padding-bottom: calc(0.65rem + 1px);
}
.maturity-tabs a:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.maturity-panel {
  padding: 0.25rem 1.25rem 1.25rem;
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 10px 30px -24px rgba(4, 36, 51, 0.35);
}
.maturity-panel > .maturity-group:first-child,
.maturity-panel > .maturity-assessment-desc + .maturity-group { margin-top: 1rem; }
.maturity-assessment-desc { margin: 1rem 0 0; color: var(--muted); max-width: 46rem; }
@media (max-width: 640px) {
  .maturity-tabs { padding-left: 0.4rem; }
  .maturity-tabs a { padding: 0.5rem 0.9rem; font-size: 0.95rem; }
  .maturity-chevron { width: 3rem; height: 3rem; }
  .maturity-chevron::before { width: 0.9rem; height: 0.9rem; border-width: 0 3px 3px 0; }
  .maturity-panel { padding: 0.25rem 0.75rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .maturity-chevron, .maturity-chevron::before { transition: none; }
}
.maturity-group > h3 {
  margin: 0;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--brand-blue);
  font-size: 1.2rem;
}
.maturity-group-desc { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.92rem; }

.maturity-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 4px 6px;
  margin-top: 0.5rem;
}
.maturity-col-name { width: 34%; }
/* The header row stays in the markup (screen readers get "Stufe 1..7" and
   the fixed table layout takes its column widths from it) but is not shown;
   the numbers are already in the cells. */
.maturity-table thead th {
  height: 0;
  padding: 0;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
}

/* Indented, with a guide line on the left, so the rows read as children
   of the category heading above. */
.maturity-name {
  padding: 0.35rem 0.75rem 0.35rem 1.1rem;
  text-align: left;
  font-weight: 400;
  vertical-align: middle;
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--brand-blue) 35%, white);
}
.maturity-sub { display: block; font-weight: 600; line-height: 1.3; }
.maturity-meta,
.maturity-note,
.maturity-next { display: block; margin-top: 0.1rem; font-size: 0.8rem; color: var(--muted); }
.maturity-note { color: var(--fg); }
.maturity-trend { font-weight: 700; }
.maturity-trend.is-up { color: #2f7d32; }
.maturity-trend.is-down { color: #c0392b; }

.maturity-seg { padding: 0; vertical-align: middle; }
.maturity-bar {
  display: flex;
  height: 2.3rem;
  border-radius: 7px;
  background: var(--line);
}
/* Reached: light tint, dark numbers. Current: full accent (>= 4.5:1 against
   white, enforced on the customer's colour) with white numbers. */
.maturity-seg.is-reached .maturity-bar { background: color-mix(in srgb, var(--accent) 22%, white); }
.maturity-seg.is-current .maturity-bar {
  background: var(--accent);
  box-shadow: 0 4px 12px -6px var(--accent);
}
.maturity-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.maturity-seg.is-reached .maturity-step { color: var(--fg); }
.maturity-seg.is-current .maturity-step { color: #fff; }
/* Faint dividers between the levels inside a range. */
.maturity-seg.is-current .maturity-step + .maturity-step { border-left: 1px solid rgba(255, 255, 255, 0.3); border-radius: 0; }
.maturity-step.is-target { box-shadow: inset 0 0 0 2px var(--fg); }
.maturity-seg.is-current .maturity-step.is-target { box-shadow: inset 0 0 0 2px #fff; }

/* "Abgeleitete Empfehlungen für diese Kategorie", below a category's table. */
.maturity-recommendation {
  margin: 0.75rem 0 0 0.25rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--accent) 6%, white);
}
.maturity-recommendation h4 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.maturity-recommendation p { margin: 0.3rem 0 0; font-size: 0.95rem; }
.maturity-recommendation p:first-of-type { margin-top: 0; }

.maturity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}
.maturity-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.maturity-legend .swatch { width: 1.1rem; height: 0.8rem; border-radius: 3px; background: var(--line); }
.maturity-legend .swatch.is-current { background: var(--accent); }
.maturity-legend .swatch.is-reached { background: color-mix(in srgb, var(--accent) 22%, white); }
.maturity-legend .swatch.is-target { background: transparent; box-shadow: inset 0 0 0 2px var(--fg); }

/* Tooltips with the meaning of a level, on each level cell and on
   "Nächste Stufe". Cells 1-3 open to the right, 4 centred, 5-7 to the left,
   so the box stays on screen. */
.has-tip { position: relative; cursor: help; }
.has-tip:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.maturity-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: 16rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: var(--fg);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  box-shadow: 0 8px 24px -10px rgba(4, 36, 51, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s, visibility 0.12s;
  pointer-events: none;
}
.maturity-tip strong { display: block; font-weight: 600; }
.maturity-tip span { display: block; margin-top: 0.2rem; opacity: 0.85; }
.maturity-step.tip-left .maturity-tip { left: auto; right: 0; }
.maturity-step.tip-center .maturity-tip { left: 50%; transform: translateX(-50%); }
.maturity-next { position: relative; }
.maturity-next .has-tip { position: static; }
.maturity-next-level {
  font-weight: 600;
  color: var(--fg);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.has-tip:hover .maturity-tip,
.has-tip:focus .maturity-tip { opacity: 1; visibility: visible; }

@media (max-width: 640px) {
  .maturity-table { border-spacing: 3px 5px; }
  .maturity-col-name { width: 38%; }
  .maturity-name { padding-left: 0.7rem; }
  .maturity-bar { height: 2rem; }
  .maturity-step { font-size: 0.68rem; }
  /* Narrow screens: centre the first cells' tooltips too, and keep them small. */
  .maturity-tip { max-width: 13rem; }
  .maturity-step:not(.tip-left) .maturity-tip { left: 50%; transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .maturity-tip { transition: none; }
}

/* --- Umfragen --- */

.survey-list { list-style: none; padding: 0; max-width: 46rem; }
.survey-list li { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.survey-list a { font-weight: 600; }
.survey-list p { margin: 0.2rem 0 0; }
.survey-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  background: var(--ok-bg);
  color: var(--fg);
  vertical-align: middle;
}

.survey-form { max-width: 46rem; }
.survey-question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 0 0 1.25rem;
}
.survey-question legend { font-weight: 600; padding: 0 0.3rem; }
.survey-question label { font-weight: 400; }
.survey-question input[type="radio"],
.survey-question input[type="checkbox"] { margin-right: 0.4rem; }
.survey-question textarea,
.survey-question input[type="text"] { max-width: none; }
.survey-scale { display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* --- Trajektorie ---
 * Auswertungen as a left-to-right trajectory. The Einstufung is the first
 * blob; the Randbedingungen sit above it as cards, and arrows (SVG, drawn by
 * static/js/trajectory.js) run from each card into the blob, coloured by
 * effect. A moving arrow track leads on to the right towards the next,
 * still empty station. The blob opens the matrix below. */

.trajectory {
  --effect-supporting: var(--brand-green);
  --effect-neutral: var(--accent);
  --effect-limiting: #b3261e;
  position: relative;
  padding: 0.5rem 0 1.5rem;
}

.trajectory-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.trajectory-conditions,
.trajectory-path { position: relative; z-index: 1; }

/* Randbedingungen */
.trajectory-conditions {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 5rem;
  padding: 0;
}
.trajectory-condition {
  --effect: var(--effect-neutral);
  position: relative;
  display: grid;
  padding: 0.5rem 0.9rem 0.55rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--effect);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 8px 20px -16px rgba(4, 36, 51, 0.45);
  cursor: default;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.trajectory-condition.is-supporting { --effect: var(--effect-supporting); }
.trajectory-condition.is-limiting { --effect: var(--effect-limiting); }
.trajectory-condition:hover,
.trajectory-condition:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 14px 26px -16px rgba(4, 36, 51, 0.55);
  outline: none;
}
.trajectory-condition:focus-visible { box-shadow: 0 0 0 2px var(--fg); }
.trajectory.is-focusing .trajectory-condition:not(:hover):not(:focus-visible) { opacity: 0.55; }
.trajectory-condition-effect {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--effect);
}
.trajectory-condition-title { font-weight: 600; line-height: 1.25; }
.trajectory-condition-desc {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 16rem;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  background: var(--fg);
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  z-index: 3;
}
.trajectory-condition:hover .trajectory-condition-desc,
.trajectory-condition:focus .trajectory-condition-desc { opacity: 1; visibility: visible; transform: none; }

/* Arrows from the cards into the blob */
.trajectory-link { --effect: var(--effect-neutral); transition: opacity 0.2s; }
.trajectory-link.is-supporting { --effect: var(--effect-supporting); }
.trajectory-link.is-limiting { --effect: var(--effect-limiting); }
.trajectory-link path { fill: none; stroke: var(--effect); stroke-linecap: round; }
.trajectory-link-base { stroke-width: 2; opacity: 0.18; }
.trajectory-link-flow {
  stroke-width: 2.5;
  stroke-dasharray: 2 9;
  animation: trajectory-flow 1.4s linear infinite;
}
.trajectory-link.is-active .trajectory-link-base { opacity: 0.35; stroke-width: 4; }
.trajectory-link.is-active .trajectory-link-flow { stroke-width: 3.5; animation-duration: 0.7s; }
.trajectory.is-focusing .trajectory-link:not(.is-active) { opacity: 0.25; }
.trajectory-links marker path { fill: var(--effect-neutral); }
.trajectory-links marker.is-supporting path { fill: var(--effect-supporting); }
.trajectory-links marker.is-limiting path { fill: var(--effect-limiting); }
@keyframes trajectory-flow {
  to { stroke-dashoffset: -11; }
}

/* The path: Einstufung blob, moving track, next station */
.trajectory-path { display: flex; align-items: center; }

.trajectory-node {
  flex: none;
  width: 11rem;
  height: 11rem;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.1rem;
  padding: 1rem;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--brand-blue) 85%, white), var(--accent) 70%);
  color: #fff;
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 14%, white), 0 18px 34px -18px rgba(4, 36, 51, 0.7);
  animation: trajectory-pulse 3.2s ease-in-out infinite;
  transition: transform 0.2s;
}
.trajectory-node:hover { transform: scale(1.04); }
.trajectory-node:focus-visible { outline: 3px solid var(--fg); outline-offset: 10px; }
.trajectory.is-focusing .trajectory-node { transform: scale(1.05); }
.trajectory-node-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
}
.trajectory-node-title { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.trajectory-node-meta { font-size: 0.8rem; opacity: 0.9; }
.trajectory-node-hint {
  margin-top: 0.3rem;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.trajectory-node[aria-expanded="true"] .trajectory-node-hint { transform: rotate(-135deg); }
@keyframes trajectory-pulse {
  0%, 100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 14%, white), 0 18px 34px -18px rgba(4, 36, 51, 0.7); }
  50% { box-shadow: 0 0 0 16px color-mix(in srgb, var(--accent) 7%, white), 0 18px 34px -18px rgba(4, 36, 51, 0.7); }
}

.trajectory-track {
  flex: 1 1 auto;
  min-width: 4rem;
  height: 3rem;
  margin-left: 1.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.trajectory-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent), color-mix(in srgb, var(--accent) 15%, white));
}
.trajectory-arrow {
  width: 0.9rem;
  height: 0.9rem;
  border-right: 4px solid var(--accent);
  border-top: 4px solid var(--accent);
  border-radius: 0 2px 0 0;
  transform: rotate(45deg);
  animation: trajectory-march 2s ease-in-out infinite;
}
.trajectory-arrow:nth-child(2) { animation-delay: 0.2s; }
.trajectory-arrow:nth-child(3) { animation-delay: 0.4s; }
.trajectory-arrow:nth-child(4) { animation-delay: 0.6s; }
.trajectory-arrow:nth-child(5) { animation-delay: 0.8s; }
@keyframes trajectory-march {
  0%, 100% { opacity: 0.25; translate: 0 0; }
  30% { opacity: 1; translate: 0.35rem 0; }
}

.trajectory-ghost {
  flex: none;
  width: 5rem;
  height: 5rem;
  margin-left: 0.75rem;
  border: 2px dashed color-mix(in srgb, var(--accent) 35%, white);
  border-radius: 50%;
}

/* With JavaScript the blob is the toggle; the heading only heads the open matrix. */
.trajectory[data-js] + .maturity-collapse:not([open]) > .maturity-summary { display: none; }
.trajectory + .maturity-collapse[open] { margin-top: 0.5rem; }

/* Narrow screens: the cards become one row to swipe through, so no arrow
   runs behind another card; descriptions show in the card, not on hover. */
@media (max-width: 640px) {
  .trajectory-conditions {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 -1.25rem 4rem;
    padding: 0.25rem 1.25rem 0.75rem;
    gap: 0.6rem;
    scrollbar-width: none;
  }
  .trajectory-condition { flex: 0 0 auto; width: 13rem; scroll-snap-align: start; }
  .trajectory-condition:hover,
  .trajectory-condition:focus-visible { transform: none; }
  .trajectory-condition-desc {
    position: static;
    width: auto;
    max-width: none;
    margin-top: 0.25rem;
    padding: 0;
    background: none;
    color: var(--muted);
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .trajectory-node-meta { font-size: 0.72rem; white-space: nowrap; }
  .trajectory-node { width: 8.5rem; height: 8.5rem; }
  .trajectory-node-title { font-size: 1rem; }
  .trajectory-track { margin-left: 1rem; }
  .trajectory-arrow:nth-child(n+4) { display: none; }
  .trajectory-ghost { width: 3rem; height: 3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .trajectory-node,
  .trajectory-arrow,
  .trajectory-link-flow { animation: none; }
  .trajectory-condition,
  .trajectory-node { transition: none; }
}
