/* SAP-Prozess einfach gezeigt: Kopf, Bühne (Zeichnung + 3D), Tafel mit dem aktuellen Schritt */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: block;
  src: url(vendor/fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: block;
  src: url(vendor/fonts/manrope-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --tinte: #16202e;
  --grau: #667385;
  --linie: #dde3ec;
  --akzent: #1f6dff;
  --stau: #d9480f;   /* Engpass: Turm und Balken */
  --ruhig: #8090a6;  /* alle anderen Türme und Balken */
  --flaeche: #ffffff;
  --welt: 0; /* 0 = Zeichnung, 1 = 3D-Welt (setzt app.js) */
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--tinte); background: var(--flaeche);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ── Kopf ── */
#kopf { display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--linie); }
#titel { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schalter { display: flex; padding: 3px; border-radius: 11px; background: #eef2f7; }
.schalter button { border: 0; background: none; padding: 7px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--grau); }
.schalter button[aria-pressed="true"] { background: #fff; color: var(--tinte); box-shadow: 0 1px 3px rgba(20, 40, 80, 0.16); }
.still { border: 1px solid var(--linie); background: #fff; padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: #3d4a5c; }
.still:hover { border-color: #b9c4d2; }
.haupt { border: 0; background: var(--akzent); color: #fff; padding: 12px 26px; border-radius: 10px; font-size: 16px; font-weight: 700; }
.haupt:hover { background: #1558e0; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
body.ohne-kopf #kopf { display: none; }
body.ohne-kopf { grid-template-rows: minmax(0, 1fr); }

/* ── Bühne ── */
main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
#buehne { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #fff; }
#kiAnalyse { position: absolute; left: 18px; top: 16px; z-index: 6; padding: 10px 18px; border: 1.5px solid var(--akzent); border-radius: 10px; background: #fff; font-size: 15px; font-weight: 700; color: var(--akzent); box-shadow: 0 4px 14px rgba(31, 109, 255, 0.16); }
#kiAnalyse:hover { background: var(--akzent); color: #fff; }
#buehne::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #f6f9fd 0%, #e7eef7 100%); opacity: var(--welt); }
#leinwand, #zeichnung, #etiketten { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#etiketten { pointer-events: none; overflow: hidden; }

/* Zeichnung: bewusst nüchtern, wie im Modellierer */
.m-text { font: 12px Arial, Helvetica, sans-serif; fill: #222; }
.m-fett { font-weight: bold; }
.m-klein { font-size: 11px; }
.m-bahn { fill: #fff; stroke: #333; stroke-width: 1.3; }
.m-linie { stroke: #333; stroke-width: 1.3; }
.m-form { fill: #fff; stroke: #222; stroke-width: 1.6; }
.m-form.dick { stroke-width: 4; }
.m-form.innen { fill: none; stroke-width: 1.2; }
.m-zeichen { fill: none; stroke: #222; stroke-width: 2.6; stroke-linecap: round; }
.m-fluss path { fill: none; stroke: #222; stroke-width: 1.5; }
.m-fluss.nachricht path { stroke-dasharray: 6 4; }
.m-pfeil { fill: #222; }
.m-pfeil.an { fill: var(--akzent); }
.m-pfeil.offen { fill: #fff; stroke: #222; stroke-width: 1.2; }
.m-symbol { fill: none; stroke: #222; stroke-width: 1.1; stroke-linejoin: round; }
.m-symbol.dick { stroke-width: 2.4; }
.m-knoten.besucht .m-form { fill: #f1f6ff; stroke: #5b8fe8; }
.m-knoten.aktiv .m-form { fill: #e4eeff; stroke: var(--akzent); stroke-width: 3; }
.m-fluss.gegangen path { stroke: var(--akzent); stroke-width: 2.2; }
.m-knoten { cursor: pointer; }
.m-knoten.gezeigt .m-form { stroke: var(--akzent); stroke-width: 2.6; }

/* Schilder über der 3D-Welt */
.etikett { position: absolute; left: 0; top: 0; max-width: 176px; padding: 3px 9px; border-radius: 7px; background: rgba(255, 255, 255, 0.93);
  font-size: 13px; font-weight: 600; line-height: 1.25; text-align: center; color: #4a5669; box-shadow: 0 1px 3px rgba(20, 40, 80, 0.13); will-change: transform; }
.etikett.besucht { color: var(--tinte); }
.etikett.aktiv { background: var(--akzent); color: #fff; font-weight: 700; z-index: 2; box-shadow: 0 3px 10px rgba(31, 109, 255, 0.35); }
.etikett.gezeigt { color: var(--tinte); box-shadow: 0 0 0 2px var(--akzent), 0 3px 10px rgba(31, 109, 255, 0.25); z-index: 3; }
.etikett.aktiv.gezeigt { color: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--akzent); }
.etikett.zeit { max-width: none; padding: 2px 8px; font-size: 12.5px; font-weight: 700; color: var(--tinte); background: rgba(255, 255, 255, 0.95); white-space: nowrap; font-variant-numeric: tabular-nums; }
.etikett.zeit.aussen { font-weight: 600; color: var(--grau); }
.etikett.zeit.engpass { padding: 3px 10px; font-size: 14.5px; font-weight: 800; color: #fff; background: var(--stau); box-shadow: 0 3px 10px rgba(217, 72, 15, 0.35); z-index: 2; }
.etikett.stau { background: #fff; color: var(--tinte); font-weight: 700; box-shadow: 0 0 0 2px var(--stau); z-index: 2; }
.etikett.stau::before { content: none !important; }
.etikett.erledigt::before { content: "✓ "; color: #1c9a54; font-weight: 800; }
.etikett.aktiv.erledigt::before { color: #b9f3d0; }
.etikett.weg { padding: 1px 7px; font-size: 12px; color: #5a6677; background: rgba(255, 255, 255, 0.86); box-shadow: none; }
.etikett.weg.nachricht { color: #5d6b7e; font-style: italic; }
.etikett.weg.wahl { padding: 2px 9px; font-size: 13px; font-weight: 700; color: var(--akzent); background: #fff; box-shadow: 0 0 0 2px var(--akzent); z-index: 2; }
.bahnname { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff, 0 0 10px #fff; will-change: transform; }

/* ── Tafel: der aktuelle Schritt in einfachen Worten ── */
#tafel { display: flex; flex-direction: column; gap: 0; padding: 30px 28px 20px; border-left: 1px solid var(--linie); background: #fff; min-height: 0; overflow: auto; }
#tafel .wo { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--grau); }
#tafel .was { margin: 0 0 14px; font-size: 30px; line-height: 1.14; font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; }
#tafel .satz { margin: 0 0 18px; font-size: 18px; line-height: 1.45; color: #2c3848; }
#tafel .stand { display: flex; align-items: center; gap: 9px; min-height: 24px; margin: 0 0 18px; font-size: 16px; line-height: 1.35; font-weight: 700; color: var(--akzent); }
#tafel .stand.laeuft::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid #c9dbff; border-top-color: var(--akzent); animation: dreh 0.8s linear infinite; }
#tafel .stand.gut { color: #1c7c45; }
#tafel .stand.gut::before { content: "✓"; flex: none; font-weight: 800; }
@keyframes dreh { to { transform: rotate(360deg); } }
#tafel .bilanz { margin: 0 0 18px; font-size: 16px; font-weight: 700; color: var(--tinte); }
#tafel .sap { display: flex; align-items: baseline; gap: 10px; margin: 0 0 18px; padding-top: 14px; border-top: 1px solid var(--linie); }
.sap-vor { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--grau); }
.sap-code { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sap-link { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--akzent); text-decoration: none; }
.sap-link::after { content: " ↗"; }
.sap-link:hover { text-decoration: underline; }
#tafel .wahl { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
#tafel .wahl button { flex: 1 1 0; min-width: 96px; }
#tafel .knoepfe { display: flex; gap: 10px; align-items: center; margin-top: auto; padding-top: 10px; }
#tafel .knoepfe .haupt { margin-left: auto; }
#tafel .tasten { margin: 14px 0 0; font-size: 12px; color: #8a95a5; }
[hidden] { display: none !important; }

/* ── Engpass-Ansicht: die Tafel zeigt, wo die Zeit bleibt ── */
body.engpass #tafel > :not(#engpass) { display: none !important; }
#engpass { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#engpass .e-summe { margin: 0 0 12px; padding-top: 14px; border-top: 1px solid var(--linie); font-size: 16px; line-height: 1.4; font-weight: 700; }
#engpass .e-titel { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--grau); }
.e-liste { list-style: none; margin: 0 -8px; padding: 0; }
.e-reihe { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 4px 8px 6px; border-radius: 8px; cursor: default; }
.e-reihe { visibility: hidden; opacity: 0; transition: opacity 0.3s; }
.e-reihe.da { visibility: visible; opacity: 1; }
.e-reihe:hover, .e-reihe.gezeigt { background: #f2f5f9; }
.e-name { font-size: 14px; line-height: 1.3; font-weight: 600; color: var(--tinte); }
.e-name small { margin-left: 7px; font-size: 12px; font-weight: 600; color: var(--grau); white-space: nowrap; }
.e-reihe.stau .e-name small { display: none; }
#engpass.fund .e-reihe.stau .e-name { font-weight: 800; }
#engpass.fund .e-reihe.stau .e-name small { display: inline; font-weight: 800; color: var(--tinte); }
.e-wert { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.e-spur { grid-column: 1 / -1; height: 8px; }
.e-balken { display: block; height: 8px; width: 0; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--ruhig); transition: width 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.4s; }
.e-reihe.da .e-balken { width: var(--w); }
#engpass.fund .e-reihe.stau .e-balken { background: var(--stau); }
.e-reihe.aussen .e-balken { background: repeating-linear-gradient(135deg, #a9b5c4 0 3px, #dbe2ea 3px 6px); }
#engpass .e-fuss { margin: 10px 0 0; font-size: 12px; line-height: 1.35; color: #8a95a5; }
#engpass .knoepfe .still + .still { margin-left: auto; }
#engpass .e-leer { font-size: 15px; line-height: 1.45; color: #2c3848; }

/* ── Karte beim Drüberfahren: wo der Schritt in SAP liegt, welche Daten dort stehen ── */
#karte { position: fixed; left: 0; top: 0; z-index: 20; width: 340px; max-width: calc(100vw - 20px); padding: 16px 18px 14px; border-radius: 14px; background: #fff; color: var(--tinte);
  box-shadow: 0 14px 44px rgba(15, 30, 60, 0.24), 0 0 0 1px rgba(20, 40, 80, 0.07); pointer-events: none; will-change: transform; }
#karte.fest { pointer-events: auto; box-shadow: 0 14px 44px rgba(15, 30, 60, 0.24), 0 0 0 2px var(--akzent); }
#karte .k-kopf { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--grau); }
#karte .k-stand { flex: none; color: #8a95a5; }
#karte .k-stand.hier { color: var(--akzent); }
#karte .k-stand.erledigt { color: #1c7c45; }
#karte .k-stand.stau { color: #b53a09; }
#karte .k-was { margin: 0 0 6px; font-size: 19px; line-height: 1.2; font-weight: 800; }
#karte .k-satz { margin: 0; font-size: 14px; line-height: 1.4; color: #2c3848; }
#karte .k-titel { margin: 12px 0 6px; padding-top: 10px; border-top: 1px solid var(--linie); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--grau); }
#karte dl { display: grid; grid-template-columns: fit-content(44%) minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 14px; line-height: 1.35; }
#karte dt { color: var(--grau); }
#karte dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
#karte dd.code { font-weight: 800; font-variant-numeric: tabular-nums; }
#karte .k-fuss { margin: 12px 0 0; font-size: 12px; line-height: 1.35; color: #8a95a5; }
#karte .k-link { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 700; color: var(--akzent); text-decoration: none; }
#karte .k-link::after { content: " ↗"; }
#karte .k-link:hover { text-decoration: underline; }

/* ── Blatt „Modell und Anbindung“ ── */
#blatt { width: min(560px, calc(100vw - 32px)); padding: 26px 28px 22px; border: 0; border-radius: 16px; color: var(--tinte); box-shadow: 0 24px 70px rgba(15, 30, 60, 0.28); }
#blatt::backdrop { background: rgba(20, 32, 52, 0.32); }
#blatt h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
#blatt h3 { margin: 22px 0 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--grau); }
#blatt p { margin: 0 0 10px; font-size: 15px; line-height: 1.5; }
#blatt .zu { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--grau); padding: 4px 8px; }
#blatt .reihe { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
#blatt .datei { cursor: pointer; }
#blatt .datei input { position: absolute; width: 1px; height: 1px; opacity: 0; }
#blatt .datei:focus-within { outline: 2px solid var(--akzent); outline-offset: 2px; }
#blatt .meldung { margin-top: 8px; color: #b3261e; font-weight: 600; }
#blatt .meldung.gut { color: #1c7c45; }
#sapAdresse { width: 100%; padding: 10px 12px; border: 1px solid #c7d0dc; border-radius: 9px; font-size: 15px; }
#blatt .fuss { margin: 20px 0 0; padding-top: 12px; border-top: 1px solid var(--linie); font-size: 13px; color: var(--grau); }

/* ── Hochformat und schmale Fenster: Tafel unter die Bühne ── */
@media (max-aspect-ratio: 1/1), (max-width: 820px) {
  main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  #tafel { border-left: 0; border-top: 1px solid var(--linie); padding: 20px 20px 16px; min-height: 250px; }
  #tafel .was { font-size: 26px; margin-bottom: 10px; }
  #tafel .satz { font-size: 17px; margin-bottom: 12px; }
  #tafel .tasten { display: none; }
  body.engpass #tafel { max-height: 50vh; }
  #kiAnalyse { left: 10px; top: 10px; padding: 7px 12px; font-size: 13.5px; }
  #kopf { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  #titel { flex-basis: 100%; }
  #oeffneBlatt { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
