/*! KI-Agent-Pro Chat 1.0.0 */
.kapc, .kapc *, .kapc *::before, .kapc *::after { box-sizing: border-box; }
.kapc { --kapc-bg: #FFFFFF; --kapc-ink: #151B2C; --kapc-muted: #5B6476; --kapc-line: rgba(20, 27, 44, .12); --kapc-soft: #F2F3F7;
  --kapc-r: 18px; position: fixed; bottom: 20px; z-index: 2147482500; font-family: inherit; font-size: 15px; line-height: 1.5; color: var(--kapc-ink);
  -webkit-font-smoothing: antialiased; }
.kapc-right { right: 20px; }
.kapc-left { left: 20px; }
.kapc :where(p) { margin: 0; padding: 0; }
.kapc :where(ul) { margin: 6px 0; padding: 0 0 0 1.15em; }
.kapc :where(li) { margin: 2px 0; padding: 0; }
.kapc :where(button, input, textarea, select) { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.kapc [hidden] { display: none !important; }
.kapc-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.kapc svg { width: 22px; height: 22px; flex: none; }

/* Startknopf */
.kapc-launch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 58px; margin: 0; padding: 0 22px 0 18px; border: 0; border-radius: 999px;
  background: var(--kapc-accent); color: var(--kapc-accent-text); font-weight: 700; font-size: 1rem; line-height: 1; cursor: pointer;
  box-shadow: 0 16px 34px -12px rgba(9, 14, 30, .55); transition: transform .2s ease, box-shadow .2s ease; }
.kapc-launch:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -12px rgba(9, 14, 30, .6); }
.kapc-launch svg { width: 26px; height: 26px; }
.kapc-open .kapc-launch-text { display: none; }
.kapc-open .kapc-launch { width: 58px; padding: 0; justify-content: center; }
.kapc-open .kapc-launch svg { display: none; }
.kapc-open .kapc-launch::before, .kapc-open .kapc-launch::after { content: ""; position: absolute; width: 20px; height: 2.4px; border-radius: 2px; background: currentColor; transform: rotate(45deg); }
.kapc-open .kapc-launch::after { transform: rotate(-45deg); }
.kapc-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--kapc-head); color: #fff;
  font-size: .75rem; line-height: 22px; text-align: center; box-shadow: 0 0 0 2px #fff; }
/* Solange das Cookie-Fenster (KI-Agent-Pro Consent) offen ist, den Chat-Knopf ausblenden */
html.kac-shown .kapc:not(.kapc-open) { display: none; }

/* Hinweis-Sprechblase */
.kapc-teaser { position: absolute; bottom: 72px; width: max-content; max-width: min(280px, calc(100vw - 40px)); display: flex; align-items: flex-start; gap: 4px;
  padding: 12px 8px 12px 16px; border-radius: 16px; background: #fff; color: var(--kapc-ink); box-shadow: 0 14px 40px -12px rgba(9, 14, 30, .45), 0 0 0 1px var(--kapc-line);
  animation: kapc-pop .35s cubic-bezier(.2, .8, .2, 1); }
.kapc-right .kapc-teaser { right: 0; }
.kapc-left .kapc-teaser { left: 0; }
.kapc-teaser-text { margin: 0; padding: 0; border: 0; background: transparent; text-align: left; font-weight: 600; font-size: .92rem; cursor: pointer; }
.kapc-teaser-x { flex: none; width: 28px; height: 28px; margin: -4px 0 0; padding: 0; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--kapc-muted); }
.kapc-teaser-x svg { width: 16px; height: 16px; }
@keyframes kapc-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

/* Fenster */
.kapc-panel { position: absolute; bottom: 74px; width: 390px; height: min(640px, calc(100vh - 120px)); height: min(640px, calc(100dvh - 120px)); display: flex; flex-direction: column;
  overflow: hidden; border-radius: var(--kapc-r); background: var(--kapc-bg); box-shadow: 0 30px 70px -20px rgba(9, 14, 30, .55), 0 0 0 1px var(--kapc-line);
  animation: kapc-pop .28s cubic-bezier(.2, .8, .2, 1); }
.kapc-right .kapc-panel { right: 0; }
.kapc-left .kapc-panel { left: 0; }
.kapc-reduce .kapc-panel, .kapc-reduce .kapc-teaser { animation: none; }

.kapc-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 10px 14px 16px; background: var(--kapc-head); color: #fff; }
.kapc-ava { flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--kapc-accent); color: var(--kapc-accent-text); font-weight: 700; font-size: .9rem; }
.kapc-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kapc-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kapc-titles h2 { margin: 0; padding: 0; font-size: 1rem; line-height: 1.3; font-weight: 700; color: #fff; font-family: inherit; letter-spacing: 0; }
.kapc-status { font-size: .8rem; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kapc-status::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #3DD68C; vertical-align: 1px; }
.kapc-icon { flex: none; width: 40px; height: 40px; margin: 0; padding: 0; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; }
.kapc-icon:hover { background: rgba(255, 255, 255, .12); }
.kapc-icon svg { width: 20px; height: 20px; }
.kapc-menu { position: absolute; top: 58px; right: 10px; z-index: 3; min-width: 230px; padding: 6px; border-radius: 12px; background: #fff; color: var(--kapc-ink); box-shadow: 0 16px 40px -10px rgba(9, 14, 30, .45), 0 0 0 1px var(--kapc-line); }
.kapc-menu button { display: block; width: 100%; margin: 0; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; font-size: .92rem; }
.kapc-menu button:hover, .kapc-menu button:focus-visible { background: var(--kapc-soft); }

.kapc-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 8px; background: #FAFAFC; -webkit-overflow-scrolling: touch; }
.kapc-log { display: flex; flex-direction: column; gap: 10px; }

/* Begrüßung vor dem Start */
.kapc-hello { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 6px 8px; text-align: center; }
.kapc-ava-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.kapc-hello-title { font-weight: 700; font-size: 1.15rem; }
.kapc-hello-text { font-size: .86rem; color: var(--kapc-muted); max-width: 320px; }
.kapc-hello-text a, .kapc-muted a { color: var(--kapc-accent); text-decoration: underline; text-underline-offset: 2px; }
.kapc-hello .kapc-btn { width: 100%; max-width: 300px; }

/* Nachrichten */
.kapc-msg { display: flex; flex-direction: column; max-width: 86%; }
.kapc-bot, .kapc-owner { align-self: flex-start; }
.kapc-visitor { align-self: flex-end; align-items: flex-end; }
.kapc-system { align-self: center; max-width: 92%; }
.kapc-bubble { padding: 10px 14px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px var(--kapc-line); word-wrap: break-word; overflow-wrap: anywhere; font-size: .94rem; }
.kapc-bot .kapc-bubble { border-bottom-left-radius: 6px; }
.kapc-owner .kapc-bubble { border-bottom-left-radius: 6px; background: #EEF1F8; box-shadow: 0 0 0 1px rgba(14, 23, 48, .16); }
.kapc-visitor .kapc-bubble { border-bottom-right-radius: 6px; background: var(--kapc-accent); color: var(--kapc-accent-text); box-shadow: none; }
.kapc-system .kapc-bubble { padding: 8px 12px; background: transparent; box-shadow: none; color: var(--kapc-muted); font-size: .82rem; text-align: center; }
.kapc-error .kapc-bubble { color: #A3271F; }
.kapc-temp { opacity: .75; }
.kapc-who { margin: 0 0 3px 4px; font-size: .74rem; font-weight: 700; color: var(--kapc-muted); }
.kapc-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.kapc-bot .kapc-bubble a, .kapc-owner .kapc-bubble a { color: var(--kapc-accent); }

.kapc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kapc-system .kapc-actions { justify-content: center; }
.kapc-chip { min-height: 36px; margin: 0; padding: 7px 13px; border: 1.5px solid var(--kapc-accent); border-radius: 999px; background: #fff; color: var(--kapc-accent);
  font-weight: 600; font-size: .86rem; line-height: 1.2; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.kapc-chip:hover:not(:disabled) { background: var(--kapc-accent); color: var(--kapc-accent-text); }
.kapc-chip:disabled { opacity: .5; cursor: default; }

.kapc-typing { display: inline-flex; gap: 4px; margin: 10px 0 4px; padding: 12px 14px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px var(--kapc-line); }
.kapc-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--kapc-muted); opacity: .4; animation: kapc-dot 1.2s infinite ease-in-out; }
.kapc-typing i:nth-of-type(2) { animation-delay: .15s; }
.kapc-typing i:nth-of-type(3) { animation-delay: .3s; }
@keyframes kapc-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
.kapc-reduce .kapc-typing i { animation: none; opacity: .7; }

/* Karten */
.kapc-card { margin-top: 8px; padding: 14px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px var(--kapc-line); width: 100%; min-width: 260px; }
.kapc-card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-weight: 700; font-size: .95rem; }
.kapc-card-title svg { width: 20px; height: 20px; color: var(--kapc-accent); }
.kapc-card-ok { display: flex; align-items: center; gap: 12px; background: #EEF8F1; box-shadow: 0 0 0 1px rgba(22, 120, 60, .2); }
.kapc-ok-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #1F8A4C; color: #fff; }
.kapc-ok-ico svg { width: 20px; height: 20px; }
.kapc-muted { color: var(--kapc-muted); font-size: .88rem; }
.kapc-small { margin: 10px 0 6px !important; font-size: .8rem; }

.kapc-form { display: flex; flex-direction: column; gap: 10px; }
.kapc-field { display: flex; flex-direction: column; gap: 4px; }
.kapc-field label { font-size: .82rem; font-weight: 600; color: var(--kapc-muted); }
.kapc-field input, .kapc-field textarea { width: 100%; margin: 0; padding: 10px 12px; border: 1.5px solid rgba(20, 27, 44, .2); border-radius: 10px; background: #fff; font-size: 16px; line-height: 1.4; box-shadow: none; }
.kapc-field textarea { resize: vertical; min-height: 64px; }
.kapc-field input:focus, .kapc-field textarea:focus { outline: none; border-color: var(--kapc-accent); box-shadow: 0 0 0 3px rgba(192, 69, 31, .18); }
.kapc-field [aria-invalid="true"] { border-color: #C62828; }
.kapc-check { display: flex; gap: 8px; align-items: flex-start; font-size: .8rem; color: var(--kapc-muted); }
.kapc-check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--kapc-accent); }
.kapc-check a { color: var(--kapc-accent); }
.kapc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.kapc-form-err { margin: 0; padding: 8px 10px; border-radius: 8px; background: #FDECEA; color: #8E1F16; font-size: .85rem; }
.kapc-picked { font-size: .88rem; }
.kapc-link { margin: 0; padding: 0 2px; border: 0; background: transparent; color: var(--kapc-accent); text-decoration: underline; cursor: pointer; font-size: inherit; }

.kapc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; margin: 0; padding: 11px 18px; border: 1.5px solid transparent; border-radius: 12px;
  font-weight: 700; font-size: .95rem; line-height: 1.2; text-decoration: none; cursor: pointer; transition: filter .15s ease; }
.kapc-btn:hover { filter: brightness(1.07); }
.kapc-btn:disabled { opacity: .65; cursor: wait; }
.kapc-btn-primary { background: var(--kapc-accent); color: var(--kapc-accent-text); }
.kapc-btn-ghost { background: #fff; color: var(--kapc-ink); border-color: rgba(20, 27, 44, .2); }
.kapc-btn-wa { width: 100%; background: #1A7F4B; color: #fff; }
.kapc-btn-wa svg, .kapc-btn-ghost svg { width: 20px; height: 20px; }

/* Termine */
.kapc-seg { display: flex; gap: 4px; padding: 4px; margin-bottom: 10px; border-radius: 12px; background: var(--kapc-soft); }
.kapc-seg-b { flex: 1; min-height: 38px; margin: 0; padding: 6px 8px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: .85rem; cursor: pointer; }
.kapc-seg-b[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 4px rgba(9, 14, 30, .15); color: var(--kapc-accent); }
.kapc-days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.kapc-day { flex: none; min-height: 40px; margin: 0; padding: 7px 12px; border: 1.5px solid rgba(20, 27, 44, .18); border-radius: 10px; background: #fff; font-weight: 600; font-size: .84rem; cursor: pointer; white-space: nowrap; }
.kapc-day[aria-pressed="true"] { border-color: var(--kapc-accent); background: var(--kapc-accent); color: var(--kapc-accent-text); }
.kapc-more { border-style: dashed; color: var(--kapc-muted); }
.kapc-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.kapc-time { min-height: 40px; margin: 0; padding: 6px; border: 1.5px solid rgba(20, 27, 44, .18); border-radius: 10px; background: #fff; font-weight: 600; font-size: .88rem; cursor: pointer; }
.kapc-time:hover, .kapc-day:hover:not([aria-pressed="true"]) { border-color: var(--kapc-accent); color: var(--kapc-accent); }

/* Eingabe */
.kapc-input { display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 12px; border-top: 1px solid var(--kapc-line); background: #fff; }
.kapc-input textarea { flex: 1; min-height: 44px; max-height: 132px; margin: 0; padding: 11px 14px; border: 1.5px solid rgba(20, 27, 44, .16); border-radius: 22px; background: var(--kapc-soft);
  font-size: 16px; line-height: 1.35; resize: none; box-shadow: none; }
.kapc-input textarea:focus { outline: none; border-color: var(--kapc-accent); background: #fff; }
.kapc-send { flex: none; width: 44px; height: 44px; margin: 0; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--kapc-accent); color: var(--kapc-accent-text); cursor: pointer; }
.kapc-send svg { width: 20px; height: 20px; }
.kapc-foot { padding: 0 12px 10px; background: #fff; text-align: center; font-size: .72rem !important; color: var(--kapc-muted); }
.kapc-foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Fokus */
.kapc :focus-visible { outline: 3px solid var(--kapc-accent); outline-offset: 2px; }
.kapc-head :focus-visible { outline-color: #fff; }

/* Button aus dem Shortcode [kapchat_oeffnen] */
.kapc-open-btn { display: inline-flex; align-items: center; min-height: 46px; padding: 11px 20px; border: 0; border-radius: 12px; background: var(--kapc-accent, #C0451F); color: var(--kapc-accent-text, #fff); font: inherit; font-weight: 700; cursor: pointer; }

/* Handy: Vollbild */
@media (max-width: 600px) {
  .kapc { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .kapc-right { right: 14px; }
  .kapc-left { left: 14px; }
  .kapc-launch-text { display: none; }
  .kapc-launch { width: 58px; padding: 0; justify-content: center; }
  .kapc-open .kapc-launch { display: none; }
  .kapc-panel { position: fixed; inset: 0; width: auto; height: 100%; height: 100dvh; border-radius: 0; animation: none;
    padding-bottom: env(safe-area-inset-bottom, 0px); }
  .kapc-head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .kapc-msg { max-width: 92%; }
  .kapc-card { min-width: 0; }
  .kapc-chip { min-height: 40px; }
}
html.kapc-lock, html.kapc-lock body { overflow: hidden !important; }
@media (prefers-reduced-motion: reduce) {
  .kapc-panel, .kapc-teaser, .kapc-typing i, .kapc-launch { animation: none !important; transition: none !important; }
}
@media print { .kapc { display: none !important; } }
