/* ProcessLens — warmes, zugängliches Designsystem.
   Prinzipien: Ruhe, Wärme, klare Sprache, sichtbarer Fortschritt, dezente Freude.
   Keine Fachbegriffe nach außen. WCAG-bewusst, prefers-reduced-motion respektiert. */

:root {
  --bg:        #faf7f2;   /* warmes Creme statt klinisch-weiß */
  --bg-soft:   #f3eee5;
  --surface:   #ffffff;
  --ink:       #23201c;   /* warmes Fast-Schwarz */
  --ink-soft:  #6b6356;
  --ink-mute:  #9a9082;
  --line:      #e9e2d6;

  --brand:     #5b6cf0;   /* freundliches Indigo */
  --brand-ink: #3f4cc9;
  --brand-bg:  #eef0fe;
  --go:        #16a34a;   /* Fortschritt/erledigt */
  --go-bg:     #e8f7ee;
  --celebrate: #ff7a4d;   /* Coral — Belohnungsmomente */
  --warn:      #b45309;

  --r-sm: 8px; --r: 14px; --r-lg: 22px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(35,32,28,.04), 0 8px 24px rgba(35,32,28,.06);
  --shadow-lg: 0 12px 40px rgba(35,32,28,.14);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --maxw: 760px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: var(--r-sm); }

/* ---------- Layout ---------- */
.shell { max-width: var(--maxw); margin: 0 auto; padding: 0 20px 96px; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  max-width: var(--maxw); margin: 0 auto; padding: 18px 20px;
}
.brandmark { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--brand) 40%, var(--brand-ink)); }
.topbar .who { margin-left: auto; color: var(--ink-soft); font-size: .92rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 12px 20px; border-radius: var(--r-pill); font-weight: 600;
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn-celebrate { background: var(--celebrate); border-color: var(--celebrate); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 16px 28px; font-size: 1.05rem; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 24px; }

/* ---------- Welcome ---------- */
.hero { text-align: center; padding: 56px 0 24px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 12px; }
.hero p { color: var(--ink-soft); font-size: 1.12rem; max-width: 30em; margin: 0 auto 28px; }
.name-field { display: flex; gap: 10px; max-width: 440px; margin: 0 auto; }
.name-field input {
  flex: 1; padding: 14px 18px; border: 1px solid var(--line);
  border-radius: var(--r-pill); background: var(--surface); font-size: 1.05rem;
}
.fineprint { color: var(--ink-mute); font-size: .86rem; margin-top: 18px; }

/* ---------- Katalog ---------- */
.proc-grid { display: grid; gap: 14px; margin-top: 22px; }
.proc-card { text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.proc-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.proc-card .t { font-weight: 700; font-size: 1.08rem; }
.proc-card .d { color: var(--ink-soft); font-size: .95rem; }
.proc-new { border-style: dashed; color: var(--brand-ink); align-items: center; justify-content: center;
  display: flex; gap: 8px; font-weight: 600; }

/* ---------- Journey / Fortschritt (Gamification, an echte Ziele gekoppelt) ---------- */
.journey { display: flex; align-items: center; gap: 10px; padding: 14px 0 6px; flex-wrap: wrap; }
.score-ring { --p: 0; position: relative; width: 56px; height: 56px; flex: 0 0 auto; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .val { position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: .92rem; color: var(--brand-ink); }
.steps { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.step { flex: 1; height: 8px; border-radius: var(--r-pill); background: var(--bg-soft);
  position: relative; overflow: hidden; }
.step .fill { position: absolute; inset: 0; width: 0; background: var(--go);
  transition: width .5s cubic-bezier(.2,.8,.2,1); }
.step.done .fill { width: 100%; }
.step-label { font-size: .76rem; color: var(--ink-mute); text-align: center; margin-top: 4px; }
.step.pop { animation: pop .5s ease; }
@keyframes pop { 0%{transform:scale(1)} 40%{transform:scale(1.08)} 100%{transform:scale(1)} }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; gap: 14px; padding: 18px 0; }
.bubble { max-width: 84%; padding: 13px 17px; border-radius: 18px; font-size: 1.04rem;
  animation: fadeUp .35s ease; }
.bubble.assistant { background: var(--surface); border: 1px solid var(--line);
  border-bottom-left-radius: 6px; align-self: flex-start; box-shadow: var(--shadow); }
.bubble.user { background: var(--brand); color: #fff; border-bottom-right-radius: 6px;
  align-self: flex-end; }
.bubble.hint { background: var(--brand-bg); color: var(--brand-ink); border: none;
  font-size: .92rem; align-self: flex-start; border-radius: var(--r); }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-mute);
  animation: blink 1.2s infinite; }
.typing i:nth-child(2){ animation-delay:.2s } .typing i:nth-child(3){ animation-delay:.4s }
@keyframes blink { 0%,60%,100%{opacity:.3} 30%{opacity:1} }
@keyframes fadeUp { from{opacity:0; transform: translateY(8px)} to{opacity:1; transform:none} }

/* ---------- Composer ---------- */
.composer { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 28%);
  padding: 14px 0 18px; display: flex; gap: 10px; }
.composer textarea {
  flex: 1; resize: none; padding: 14px 18px; border: 1px solid var(--line);
  border-radius: var(--r-lg); background: var(--surface); font-size: 1.05rem; min-height: 52px;
  max-height: 140px; box-shadow: var(--shadow);
}

/* ---------- Live-Vorschau ---------- */
.preview { margin-top: 8px; }
.preview-head { display: flex; align-items: center; gap: 8px; color: var(--ink-soft);
  font-size: .9rem; margin-bottom: 8px; }
.diagram { overflow: auto; border-radius: var(--r); background: var(--bg-soft); padding: 12px; }
.diagram svg { max-width: 100%; height: auto; }
.bpmn-canvas { height: 480px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); margin: 10px 0; overflow: hidden; }

/* ---------- Reveal / Celebration ---------- */
.reveal { text-align: center; padding: 40px 0; animation: fadeUp .5s ease; }
.reveal h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); margin: 8px 0; }
.reveal .sub { color: var(--ink-soft); font-size: 1.12rem; margin-bottom: 24px; }
.reveal .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-pill);
  font-size: .92rem; box-shadow: var(--shadow-lg); animation: fadeUp .3s ease; }
.toast.warn { background: var(--warn); }

/* ---------- Utility ---------- */
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.spacer { height: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #confetti { display: none; }
}
