/* Praxis Chat: Chatfenster unten rechts. Farben und Schriften aus dem Theme (Variante A). */
#pmc-btn, #pmc-box {
  --pmc-strong: var(--strong, #0F766E);
  --pmc-brand: var(--brand, #26ABA3);
  --pmc-deep: var(--deep, #12403C);
  --pmc-soft: var(--soft, #EEF8F6);
  --pmc-accent: var(--accent, #F7AB1E);
  --pmc-ink: var(--ink, #293039);
  --pmc-muted: var(--muted, #51565D);
  --pmc-line: var(--line, rgba(18,64,60,.10));
  --pmc-font: var(--font-body, 'Figtree', system-ui, -apple-system, sans-serif);
  --pmc-head: var(--font-head, 'Manrope', system-ui, -apple-system, sans-serif);
  font-family: var(--pmc-font);
  box-sizing: border-box;
}
#pmc-btn *, #pmc-box * { box-sizing: border-box; }

/* Knopf */
#pmc-btn {
  position: fixed; right: 22px; bottom: 22px; z-index: 99999;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--pmc-strong); color: #fff;
  box-shadow: 0 10px 28px rgba(18,64,60,.28);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, background .2s;
}
#pmc-btn:hover { background: var(--pmc-deep); transform: translateY(-2px); }
#pmc-btn svg { width: 26px; height: 26px; fill: currentColor; }
#pmc-btn .pmc-ico-close { display: none; }
#pmc-btn.is-open .pmc-ico-chat { display: none; }
#pmc-btn.is-open .pmc-ico-close { display: block; }
#pmc-badge {
  position: absolute; top: -2px; right: -2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--pmc-accent); color: var(--pmc-ink); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
#pmc-badge[hidden] { display: none; }

/* Fenster */
#pmc-box {
  position: fixed; right: 22px; bottom: 96px; z-index: 99998;
  width: 380px; max-width: calc(100vw - 24px); height: 600px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #FBFDFC; border-radius: 22px;
  box-shadow: 0 18px 60px rgba(18,64,60,.22), 0 0 0 1px var(--pmc-line);
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .22s ease, transform .22s ease;
  color: var(--pmc-ink); font-size: 14px; line-height: 1.55;
}
#pmc-box[hidden] { display: none; }
#pmc-box.is-in { opacity: 1; transform: none; }

#pmc-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px;
  background: var(--pmc-deep); color: #fff; flex-shrink: 0;
}
.pmc-ava {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--pmc-brand); color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.pmc-ava img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.pmc-ava-s { width: 28px; height: 28px; font-size: 10px; margin-top: 2px; }
.pmc-head-text { flex: 1; min-width: 0; }
.pmc-name { font-family: var(--pmc-head); font-weight: 600; font-size: 15px; }
.pmc-sub { font-size: 12px; opacity: .8; display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.pmc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pmc-brand); box-shadow: 0 0 0 3px rgba(38,171,163,.25); }
#pmc-close {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#pmc-close:hover { background: rgba(255,255,255,.22); }
#pmc-close svg { width: 18px; height: 18px; }

#pmc-msgs {
  flex: 1; overflow-y: auto; padding: 16px 14px 10px;
  display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth;
}
#pmc-msgs > * { flex-shrink: 0; }
#pmc-msgs::-webkit-scrollbar { width: 4px; }
#pmc-msgs::-webkit-scrollbar-thumb { background: rgba(18,64,60,.18); border-radius: 2px; }

.pmc-row { display: flex; gap: 8px; animation: pmcIn .22s ease; max-width: 100%; }
.pmc-row.is-user { flex-direction: row-reverse; }
@keyframes pmcIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pmc-body { display: flex; flex-direction: column; gap: 3px; max-width: 86%; }
.pmc-row.is-user .pmc-body { align-items: flex-end; }
.pmc-bbl {
  padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.55; word-wrap: break-word; overflow-wrap: anywhere;
  background: #fff; border: 1px solid var(--pmc-line); border-bottom-left-radius: 6px; color: var(--pmc-ink);
}
.pmc-row.is-user .pmc-bbl { background: var(--pmc-strong); color: #fff; border-color: transparent; border-radius: 18px; border-bottom-right-radius: 6px; }
.pmc-bbl a { color: var(--pmc-strong); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.pmc-row.is-user .pmc-bbl a { color: #fff; }
.pmc-t { font-size: 11px; color: var(--pmc-muted); padding: 0 4px; }

.pmc-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.pmc-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--pmc-brand); opacity: .4; animation: pmcBnc 1.2s infinite ease-in-out; }
.pmc-dots i:nth-child(2) { animation-delay: .2s; }
.pmc-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes pmcBnc { 0%, 80%, 100% { opacity: .3; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* Vorschlagsfragen */
.pmc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 36px; animation: pmcIn .3s ease; }
.pmc-chip {
  font: inherit; font-size: 12.5px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--pmc-brand); background: #fff; color: var(--pmc-strong); transition: background .15s, color .15s;
}
.pmc-chip:hover { background: var(--pmc-soft); }

/* Karten (Team, Bücher) */
.pmc-cards { display: flex; gap: 8px; padding: 2px 0 4px 36px; overflow-x: auto; scrollbar-width: thin; animation: pmcIn .3s ease; }
.pmc-card {
  flex: 0 0 108px; width: 108px; border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--pmc-ink);
  background: #fff; border: 1px solid var(--pmc-line); box-shadow: 0 2px 8px rgba(18,64,60,.06); transition: transform .15s;
}
.pmc-card:hover { transform: translateY(-2px); }
.pmc-card img { width: 100%; height: 108px; object-fit: cover; object-position: top; display: block; }
.pmc-card-ph { height: 108px; display: flex; align-items: center; justify-content: center; background: var(--pmc-soft); color: var(--pmc-strong); font-weight: 700; }
.pmc-card-txt { padding: 8px 9px 10px; }
.pmc-card-name { font-size: 11.5px; font-weight: 600; line-height: 1.3; }
.pmc-card-role { font-size: 10.5px; color: var(--pmc-muted); line-height: 1.3; margin-top: 2px; }
.pmc-book { flex-basis: 124px; width: 124px; }
.pmc-book img { height: 150px; }
.pmc-card-btn { display: block; margin-top: 6px; text-align: center; background: var(--pmc-strong); color: #fff; border-radius: 8px; font-size: 11px; font-weight: 600; padding: 5px 0; }

/* Eingabe */
#pmc-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 6px; background: #fff; border-top: 1px solid var(--pmc-line); flex-shrink: 0; }
#pmc-input {
  flex: 1; resize: none; font: inherit; font-size: 14px; line-height: 1.5; color: var(--pmc-ink);
  border: 1px solid rgba(18,64,60,.22); border-radius: 18px; padding: 9px 14px; min-height: 40px; max-height: 110px;
  background: #FBFDFC; outline: none; transition: border-color .2s, box-shadow .2s;
}
#pmc-input:focus { border-color: var(--pmc-brand); box-shadow: 0 0 0 3px rgba(38,171,163,.18); }
#pmc-input::placeholder { color: var(--pmc-muted); }
#pmc-send {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; flex-shrink: 0;
  background: var(--pmc-strong); color: #fff; display: flex; align-items: center; justify-content: center; transition: background .2s;
}
#pmc-send:hover { background: var(--pmc-deep); }
#pmc-send:disabled { background: #C7D2CF; cursor: default; }
#pmc-send svg { width: 17px; height: 17px; fill: currentColor; }
#pmc-note { text-align: center; font-size: 10.5px; color: var(--pmc-muted); padding: 2px 10px 8px; background: #fff; flex-shrink: 0; }
#pmc-note a { color: var(--pmc-muted); }

/* Handy */
@media (max-width: 480px) {
  #pmc-btn { right: 14px; bottom: 14px; width: 56px; height: 56px; }
  #pmc-box { right: 8px; left: 8px; bottom: 80px; width: auto; max-width: none; height: min(600px, calc(100vh - 96px)); border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #pmc-box, #pmc-btn, .pmc-row, .pmc-chips, .pmc-cards { transition: none; animation: none; }
}
