/* app.css - Die Buehne.
   Farben und Typografie sind 1:1 die KUEMMERER-CI (siehe landing-web.js im
   Produkt). Bewusst dieselben Werte statt "aehnlicher" Toene: die Demo soll
   sich anfuehlen wie das Produkt, nicht wie eine Nachbildung. */

:root {
  --papier: #FAF8F3;
  --karte: #ffffff;
  --linie: #E8E2D6;
  --tinte: #1F2429;
  --tinte-2: #4A5259;
  --tinte-3: #8A9199;
  --gold: #A87F2F;
  --gold-hell: #F5EDDD;
  --gold-linie: #E3D3B0;
  --gold-dunkel: #8A6825;
  --ok: #2E7D4F;
  --ok-hell: #E9F5EE;
  --warn-tinte: #B4560F;
  --warn-hell: #FDF1E3;
  --kopf-h: 60px;
  --fuss-h: 68px;
}

* { box-sizing: border-box; }

/* Das hidden-Attribut muss staerker sein als jede display-Regel weiter
   unten - sonst zeigt die Buehne beim Laden alles gleichzeitig (Fund beim
   ersten Durchlauf: beide Dialoge und die Netzflaeche waren sofort da). */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--papier);
  color: var(--tinte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; overflow: hidden; }

/* ---------- Kopf ---------- */
.kopf {
  height: var(--kopf-h); flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--linie);
  background: rgba(250, 248, 243, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
}
.kopf-titel { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.marke { font-weight: 700; letter-spacing: 0.13em; font-size: 0.82rem; }
.marke-zusatz { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tinte-3); }
.kopf-kontext {
  font-size: 0.78rem; color: var(--tinte-2);
  border-left: 1px solid var(--linie); padding-left: 10px; margin-left: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.kopf-knoepfe { display: flex; align-items: center; gap: 8px; flex: none; }

.pille {
  font: inherit; font-size: 0.76rem;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--linie); background: var(--karte); color: var(--tinte-2);
  cursor: pointer; transition: border-color 0.18s, color 0.18s;
}
.pille:hover { border-color: var(--gold-linie); color: var(--tinte); }

.sandbox-pille {
  font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: var(--ok-hell); color: var(--ok); border: 1px solid transparent;
}
.sandbox-pille.offen { background: var(--warn-hell); color: var(--warn-tinte); }

/* ---------- Buehne ---------- */
.buehne { flex: 1; display: flex; min-height: 0; position: relative; }

/* ---------- Ruhe: Kern ---------- */
.ruhe {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 26px;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.ruhe.zurueck { opacity: 0; transform: scale(0.97); pointer-events: none; position: absolute; inset: 0; }

.kern { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kern-ring {
  position: absolute; top: 50%; left: 50%; width: 190px; height: 190px;
  margin: -95px 0 0 -95px; border-radius: 50%;
  border: 1px solid var(--gold-linie); opacity: 0.5;
}
.kern.spricht .kern-ring { animation: atmen 3.4s ease-in-out infinite; }
@keyframes atmen {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.11); opacity: 0.72; }
}
.kern-name { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.15em; }
.kern-status { font-size: 0.86rem; color: var(--tinte-2); }
.kern-dauer { font-variant-numeric: tabular-nums; font-size: 0.86rem; color: var(--tinte-3); letter-spacing: 0.04em; }

.ruhe-hinweis { font-size: 0.82rem; color: var(--tinte-3); max-width: 30rem; text-align: center; line-height: 1.6; margin: 0; }

.knopf-primaer {
  font: inherit; font-size: 0.84rem; font-weight: 600;
  padding: 10px 22px; border-radius: 999px; border: 1px solid var(--gold);
  background: var(--gold); color: #fff; cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.knopf-primaer:hover { background: var(--gold-dunkel); border-color: var(--gold-dunkel); }
.knopf-primaer[disabled] { opacity: 0.45; cursor: default; }
.knopf-ruhig {
  font: inherit; font-size: 0.84rem; padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--linie); background: var(--karte); color: var(--tinte-2); cursor: pointer;
}

/* ---------- Netz ---------- */
.netz-flaeche { flex: 1; position: relative; min-width: 0; overflow: hidden; }
.netz { position: absolute; inset: 0; width: 100%; height: 100%; }
.knoten-schicht { position: absolute; inset: 0; pointer-events: none; }

.knoten {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  pointer-events: auto;
  animation: knoten-auf 0.62s cubic-bezier(0.16, 1, 0.3, 1) both;
  /* Kommt ein Beteiligter dazu, rueckt der Kreis enger - die vorhandenen
     Knoten wandern dann ruhig mit, statt zu springen. */
  transition: left 0.55s cubic-bezier(0.22, 1, 0.36, 1), top 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes knoten-auf {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.86); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.knoten-scheibe {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--karte); border: 1px solid var(--linie);
  box-shadow: 0 1px 2px rgba(31,36,41,0.05), 0 6px 18px rgba(31,36,41,0.045);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}
.knoten.kuemmerer .knoten-scheibe {
  width: 84px; height: 84px;
  border-color: var(--gold-linie); background: #fff;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; color: var(--tinte);
  box-shadow: 0 2px 4px rgba(31,36,41,0.06), 0 14px 40px rgba(168,127,47,0.13);
}
.knoten-name { font-size: 0.74rem; color: var(--tinte-2); max-width: 130px; text-align: center; line-height: 1.3; }
.knoten-rolle { font-size: 0.63rem; color: var(--tinte-3); letter-spacing: 0.04em; text-transform: uppercase; }

.knoten.wartet .knoten-scheibe { animation: warten 2.9s ease-in-out infinite; }
@keyframes warten {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168,127,47,0.0), 0 6px 18px rgba(31,36,41,0.045); }
  50%      { box-shadow: 0 0 0 7px rgba(168,127,47,0.10), 0 6px 18px rgba(31,36,41,0.045); }
}

.kante { stroke: var(--gold-linie); stroke-width: 1; fill: none; opacity: 0.85; }
.kante.leise { stroke: var(--linie); }
.kante-zeichnen { stroke-dasharray: var(--laenge); stroke-dashoffset: var(--laenge); animation: zeichnen 0.75s cubic-bezier(0.22,1,0.36,1) forwards; }
@keyframes zeichnen { to { stroke-dashoffset: 0; } }
.impuls { fill: var(--gold); }

/* ---------- Verlauf ---------- */
.spur {
  width: 340px; flex: none; border-left: 1px solid var(--linie);
  background: rgba(255,255,255,0.55);
  display: flex; flex-direction: column; min-height: 0;
}
.spur-kopf { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 18px 10px; }
.spur-kopf h2 { margin: 0; font-size: 0.7rem; letter-spacing: 0.11em; text-transform: uppercase; color: var(--tinte-3); font-weight: 700; }
.spur-zahl { font-size: 0.7rem; color: var(--tinte-3); }
.spur-liste { list-style: none; margin: 0; padding: 0 12px 18px; overflow-y: auto; flex: 1; }

.eintrag {
  border: 1px solid var(--linie); border-radius: 11px; background: var(--karte);
  padding: 10px 12px; margin-bottom: 8px;
  animation: eintrag-auf 0.5s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes eintrag-auf { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.eintrag.klickbar { cursor: pointer; }
.eintrag.klickbar:hover { border-color: var(--gold-linie); }
.eintrag.ein { border-left: 2px solid var(--ok); }
.eintrag.aus { border-left: 2px solid var(--gold); }
.eintrag-kopf { display: flex; align-items: center; gap: 7px; font-size: 0.73rem; color: var(--tinte-2); }
.eintrag-kanal { font-size: 0.85rem; }
.eintrag-zeit { margin-left: auto; color: var(--tinte-3); font-variant-numeric: tabular-nums; font-size: 0.68rem; }
.eintrag-text { font-size: 0.79rem; color: var(--tinte); margin-top: 5px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.marker { font-size: 0.6rem; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; }
.marker.sim { background: var(--gold-hell); color: var(--gold-dunkel); }
.marker.fehl { background: var(--warn-hell); color: var(--warn-tinte); }
.marker.wartet { background: var(--warn-hell); color: var(--warn-tinte); }
.marker.eskal { background: var(--warn-tinte); color: #fff; }

/* Echter technischer Zustand waehrend der Nachbearbeitung. */
.eintrag.verarbeitung { border-left: 2px solid var(--gold-linie); background: rgba(255,255,255,0.6); }
.punkte { display: inline-flex; gap: 3px; align-items: center; margin-right: 2px; }
.punkte i { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); display: block; animation: punkt 1.3s ease-in-out infinite; }
.punkte i:nth-child(2) { animation-delay: 0.18s; }
.punkte i:nth-child(3) { animation-delay: 0.36s; }
@keyframes punkt { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
/* Die Eskalation ist der Schritt, bei dem KUEMMERER einen Menschen holt -
   sie darf im Verlauf nicht wie eine Statuszeile aussehen. */
.eintrag.eskalation { border-left: 2px solid var(--warn-tinte); background: var(--warn-hell); }

/* ---------- Fuss / Rollen ---------- */
.fuss {
  flex: none; min-height: var(--fuss-h);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 22px; border-top: 1px solid var(--linie);
  background: rgba(255,255,255,0.7);
}
.rollen { display: flex; gap: 7px; flex-wrap: wrap; }
.rolle {
  font: inherit; font-size: 0.76rem; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--linie); background: var(--karte); color: var(--tinte-2); cursor: pointer;
  animation: knoten-auf 0.5s cubic-bezier(0.16,1,0.3,1) both;
}
.rolle:hover { border-color: var(--gold-linie); }
.rolle.aktiv { background: var(--gold-hell); border-color: var(--gold-linie); color: var(--gold-dunkel); font-weight: 600; }
.fuss-eingabe { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 260px; }
.fuss-label { font-size: 0.72rem; color: var(--tinte-3); white-space: nowrap; }
#antwort-text {
  flex: 1; font: inherit; font-size: 0.82rem; padding: 9px 13px;
  border: 1px solid var(--linie); border-radius: 10px; background: var(--karte); color: var(--tinte);
}
#antwort-text:focus { outline: none; border-color: var(--gold-linie); box-shadow: 0 0 0 3px rgba(168,127,47,0.09); }
.fuss-rechts { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Abschluss ---------- */
.abschluss { border: 1px solid var(--gold-linie); background: var(--gold-hell); border-radius: 13px; padding: 14px 16px; margin: 0 0 10px; }
.abschluss h3 { margin: 0 0 8px; font-size: 0.86rem; color: var(--gold-dunkel); }
.abschluss-zahlen { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.75rem; color: var(--tinte-2); }
.abschluss-zeile { margin: 9px 0 0; font-size: 0.79rem; color: var(--tinte); font-style: italic; }

/* ---------- Blaetter ---------- */
.schleier { position: fixed; inset: 0; background: rgba(31,36,41,0.26); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 24px; }
.blatt { background: var(--karte); border-radius: 15px; width: min(620px, 94vw); max-height: 84vh; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(31,36,41,0.2); }
.blatt-schmal { width: min(500px, 94vw); }
.blatt-kopf { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--linie); }
.blatt-kopf h2 { margin: 0; font-size: 0.92rem; }
.blatt-zu { border: none; background: none; font-size: 1.4rem; line-height: 1; color: var(--tinte-3); cursor: pointer; padding: 0 4px; }
.blatt-inhalt { padding: 16px 18px; overflow-y: auto; font-size: 0.83rem; line-height: 1.6; }
.blatt-inhalt h4 { margin: 15px 0 6px; font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tinte-3); }
.blatt-inhalt h4:first-child { margin-top: 0; }
.daten-zeile { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; border-bottom: 1px solid var(--papier); }
.daten-zeile span:first-child { color: var(--tinte-3); }
.blatt-notiz { font-size: 0.74rem; color: var(--tinte-3); background: var(--papier); border-radius: 9px; padding: 9px 11px; margin-top: 14px; }
.nachricht-koerper { white-space: pre-wrap; background: var(--papier); border-radius: 11px; padding: 13px 15px; font-size: 0.84rem; line-height: 1.6; }

.formular { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.formular input { font: inherit; font-size: 0.79rem; padding: 7px 10px; border: 1px solid var(--linie); border-radius: 8px; flex: 1; min-width: 110px; }

/* ---------- Meldungen ---------- */
.meldung-schiene { position: fixed; bottom: 84px; right: 20px; display: flex; flex-direction: column; gap: 7px; z-index: 50; }
.meldung {
  background: var(--karte); border: 1px solid var(--linie); border-left: 2px solid var(--tinte-3);
  border-radius: 10px; padding: 9px 13px; font-size: 0.76rem; color: var(--tinte-2);
  max-width: 330px; box-shadow: 0 6px 22px rgba(31,36,41,0.09);
  animation: knoten-auf 0.4s ease both;
}
.meldung.fehler { border-left-color: var(--warn-tinte); }
.meldung.warnung { border-left-color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

@media (max-width: 900px) {
  .spur { display: none; }
  .kopf-kontext { display: none; }
}

/* ---------- Geteilter Sales-Raum ---------- */
.raum-status {
  font-size: 0.7rem; color: var(--tinte-3);
  border: 1px solid var(--linie); border-radius: 999px; padding: 4px 11px;
  white-space: nowrap;
}
.raum-status.verbunden { color: var(--ok); border-color: var(--ok-hell); background: var(--ok-hell); }

/* Der Gast schaut zu und spricht - er steuert die Vorfuehrung nicht.
   Was er nicht ausloesen soll, ist fuer ihn gar nicht erst da. */
body.gast #knopf-neu,
body.gast #knopf-zeit,
body.gast .rollen,
body.gast .fuss-eingabe { display: none !important; }

/* ---------- Vorraum ---------- */
.vorraum {
  position: fixed; inset: 0; z-index: 60;
  background: var(--papier);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.vorraum-karte {
  background: var(--karte); border: 1px solid var(--linie); border-radius: 16px;
  padding: 34px 38px; width: min(420px, 94vw); text-align: center;
  box-shadow: 0 2px 4px rgba(31,36,41,0.04), 0 18px 50px rgba(31,36,41,0.07);
}
.vorraum-marke { font-size: 0.68rem; letter-spacing: 0.16em; font-weight: 700; color: var(--tinte-3); }
.vorraum-titel { margin: 10px 0 4px; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.vorraum-wer { margin: 0 0 22px; font-size: 0.84rem; color: var(--tinte-2); }
/* Die Liste zentriert als Block - sonst legt sich der Beitreten-Knopf
   daneben statt darunter (Fund beim ersten Rendern). */
.checks { list-style: none; margin: 0 auto 24px; padding: 0; text-align: left; width: max-content; }
#knopf-beitreten { display: block; margin: 0 auto; }
.checks li { display: flex; align-items: center; gap: 9px; font-size: 0.79rem; color: var(--tinte-3); padding: 3px 0; }
.checks li .punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--linie); flex: none; }
.checks li.ok { color: var(--tinte-2); }
.checks li.ok .punkt { background: var(--ok); }
.checks li.fehlt .punkt { background: var(--warn-tinte); }
.checks li.laeuft .punkt { background: var(--gold); animation: punkt 1.2s ease-in-out infinite; }
.vorraum-fuss { margin: 16px 0 0; font-size: 0.72rem; color: var(--tinte-3); }
#knopf-mikro.aus { background: var(--warn-hell); border-color: var(--warn-hell); color: var(--warn-tinte); }
