/*
 * Besucher-Chat auf partner.letzdine.eu (views/letzdine/partner/chat.php, chat.js). Farben aus partner.css (hell/dunkel).
 * Flach: das Fenster ist die einzige Fläche, darin nur Linien; nur die eigenen Nachrichten haben eine blaue Sprechblase.
 * Handy: ganzer Bildschirm; ab 640 px Fenster unten rechts. Ohne Verläufe.
 */
.pc { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 80; font-family: var(--font); }
.pc[hidden], .pc [hidden] { display: none !important; }

.pc-open {
    position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px 0 14px;
    border: 0; border-radius: 999px; background: var(--btn); color: #ffffff; font: 600 15px/1 var(--font); cursor: pointer;
    box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .45); transition: transform .16s var(--ease-out);
}
.pc-open svg { width: 22px; height: 22px; }
.pc-open:active { transform: scale(.96); }
.pc-dot { position: absolute; top: 6px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: #ff3b30; box-shadow: 0 0 0 2px var(--btn); }
.pc.is-open .pc-open { display: none; }

.pc-panel {
    position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--text);
    padding-bottom: env(safe-area-inset-bottom);
}
.pc-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.pc-head > div { flex: 1 1 auto; min-width: 0; }
.pc-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.pc-head p { margin-top: 4px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.pc-lang select {
    max-width: 112px; min-height: 34px; margin-top: -2px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 10px;
    background: transparent; color: var(--text); font: 500 13px/1 var(--font);
}
.pc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pc-orig { justify-self: start; padding: 2px 0; border: 0; background: none; color: var(--muted); font: 500 12px/1.2 var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.pc-msg.is-me .pc-orig { justify-self: end; }
.pc-x { display: grid; place-items: center; width: 40px; height: 40px; flex: none; margin: -6px -6px 0 0; border: 0; border-radius: 50%;
    background: transparent; color: var(--muted); cursor: pointer; }
.pc-x svg { width: 20px; height: 20px; }
.pc-x:hover { color: var(--text); }

/* Formular */
.pc-form { display: grid; gap: 14px; padding: 18px 16px 20px; overflow-y: auto; }
.pc-lead { font-size: 15px; color: var(--muted); }
.pc-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pc-form input:not([type="checkbox"]) {
    width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: transparent;
    color: var(--text); font: 400 16px/1.2 var(--font);
}
.pc-form input:focus-visible, .pc-compose textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pc-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pc-consent { grid-template-columns: auto 1fr; align-items: start; gap: 10px !important; font-weight: 400 !important; line-height: 1.4; }
.pc-consent input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); }
.pc-consent a { color: var(--accent); }
.pc-error { font-size: 14px; color: #d70015; }
:root[data-theme="dark"] .pc-error { color: #ff6961; }
.pc-start { width: 100%; min-height: 50px; font-size: 16px; }

/* Verlauf */
.pc-chat { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.pc-log { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.pc-msg { display: grid; gap: 4px; max-width: 86%; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; }
.pc-who { font-size: 12px; font-weight: 600; color: var(--muted); }
.pc-msg.is-ai .pc-who, .pc-msg.is-staff .pc-who { color: var(--accent); }
.pc-msg.is-me { align-self: flex-end; }
.pc-msg.is-me .pc-text { padding: 9px 14px; border-radius: 18px 18px 6px 18px; background: var(--btn); color: #ffffff; }
.pc-msg.is-me .pc-who { justify-self: end; }
.pc-msg.is-pending { opacity: .6; }
.pc-msg.is-system { align-self: center; max-width: 92%; text-align: center; font-size: 13px; color: var(--muted); }
.pc-typing { padding: 0 16px 8px; font-size: 13px; color: var(--muted); }
.pc-tools { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 6px 16px; border-top: 1px solid var(--line); }
.pc-link { padding: 6px 0; border: 0; background: none; color: var(--accent); font: 500 13px/1.2 var(--font); cursor: pointer; }
.pc-link.pc-muted { color: var(--muted); }
.pc-link:disabled { opacity: .5; cursor: default; }
.pc-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px 16px; border-top: 1px solid var(--line); }
.pc-compose textarea {
    flex: 1 1 auto; min-height: 44px; max-height: 140px; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 14px; resize: none;
    background: transparent; color: var(--text); font: 400 16px/1.35 var(--font);
}
.pc-compose button { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%;
    background: var(--btn); color: #ffffff; cursor: pointer; }
.pc-compose button svg { width: 20px; height: 20px; }
.pc-compose button:disabled { opacity: .5; cursor: default; }
.pc-chat > .pc-error { padding: 0 16px 10px; }

@media (min-width: 640px) {
    .pc { right: 20px; bottom: 20px; }
    .pc-panel {
        inset: auto 20px 20px auto; width: 380px; height: min(640px, calc(100vh - 40px)); border-radius: 20px; overflow: hidden;
        background: var(--tile); box-shadow: 0 0 0 1px var(--line), 0 30px 60px -20px rgba(0, 0, 0, .35);
    }
}
@media (prefers-reduced-motion: reduce) {
    .pc-open { transition: none; }
    .pc-open:active { transform: none; }
}
