.pf-chat, .pf-chat * { box-sizing: border-box; }
.pf-chat {
  position: fixed; right: 26px; bottom: 26px; z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px; line-height: 1.45; color: #1f2937;
}
.pf-chat__bubble {
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer;
  /* Biały pierścień + mocniejszy cień: bez tego niebieski bąbelek ginie na niebieskim
     hero (np. kredytowyprzewodnik.pl) — „niebieskie kółko na niebieskim tle". */
  border: 3px solid #fff;
  background: var(--pf-accent, #0b5ed7); color: #fff; box-shadow: 0 6px 22px rgba(0,0,0,.38);
  display: flex; align-items: center; justify-content: center; position: relative;
  transition: transform .12s ease;
}
.pf-chat__bubble:hover { transform: scale(1.06); }
/* Jawny fill na SVG i na <path> z !important — inaczej motyw strony (np. Astra na
   kredytowyprzewodnik.pl z regułą `.entry-content svg path { fill:… }`) przejmuje
   kolor ikonki i biały dymek znika (zostaje samo niebieskie kółko). */
/* flex: none — SVG jest dzieckiem flexa; motyw kredytowego ściskał je na osi
   głównej do width:0 (path się rysował, ale viewport miał 0px → ikonka znikała).
   flex:none blokuje shrink i utrzymuje 26px niezależnie od motywu. */
.pf-chat__bubble svg { width: 26px; height: 26px; fill: #fff !important; display: block; flex: none; }
.pf-chat__bubble svg path { fill: #fff !important; }
.pf-chat__dot {
  position: absolute; top: 2px; right: 2px; width: 14px; height: 14px;
  background: #dc3545; border: 2px solid #fff; border-radius: 50%; display: none;
}
.pf-chat__dot--on { display: block; }
/* Proaktywna zaczepka — dymek nad bąbelkiem po X s na stronie. Znika po otwarciu
   panelu, po starcie rozmowy albo po kliknięciu „x" (zapamiętane w localStorage). */
.pf-chat__teaser {
  position: absolute; right: 2px; bottom: 70px; width: 244px; display: none;
  background: #fff; color: #1f2937; border: 1px solid #e5e9f0; border-radius: 12px;
  padding: 12px 30px 12px 14px; font-size: 13.5px; line-height: 1.4; cursor: pointer;
  box-shadow: 0 8px 28px rgba(0,0,0,.22); animation: pfTeaserIn .25s ease;
}
.pf-chat__teaser--on { display: block; }
.pf-chat--open .pf-chat__teaser { display: none; }
.pf-chat__teaser strong { display: block; color: var(--pf-accent, #0b5ed7) !important; margin-bottom: 2px; }
.pf-chat__teaser::after {
  content: ""; position: absolute; right: 22px; bottom: -7px; width: 14px; height: 14px;
  background: #fff; border-right: 1px solid #e5e9f0; border-bottom: 1px solid #e5e9f0;
  transform: rotate(45deg);
}
.pf-chat__teaser-close {
  position: absolute; top: 4px; right: 6px; background: transparent; border: none;
  font-size: 17px; line-height: 1; color: #98a2b3; cursor: pointer; padding: 2px 4px;
}
@keyframes pfTeaserIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pf-chat__panel {
  display: none; flex-direction: column; width: 344px; height: 500px;
  max-height: calc(100vh - 40px); background: #fff; border-radius: 14px;
  overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.pf-chat--open .pf-chat__panel { display: flex; }
.pf-chat--open .pf-chat__bubble { display: none; }
.pf-chat__header {
  background: var(--pf-accent, #0b5ed7); color: #fff; padding: 14px 16px; display: flex;
  align-items: center; justify-content: space-between; flex: 0 0 auto;
}
/* Jawny kolor + !important — inaczej motyw WP potrafi przejąć h3/h4/small
   swoim globalnym stylem (np. h3 { color:#333 !important }) i nagłówek znika. */
.pf-chat__header h3 { margin: 0; font-size: 15px; font-weight: 600; color: #fff !important; }
.pf-chat__header small { display: block; font-weight: 400; opacity: .85; font-size: 12px; margin-top: 2px; color: #fff !important; }
.pf-chat__close {
  background: transparent; border: none; color: #fff; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0 4px;
}
.pf-chat__offline {
  background: #fff8e1; color: #7a5b00; font-size: 12.5px; padding: 8px 14px;
  border-bottom: 1px solid #f0e2b6; flex: 0 0 auto;
}
.pf-chat__body {
  /* min-height:0 pozwala tej sekcji się skurczyć, gdy pojawia się karta kontaktu —
     inaczej karta + stopka wypychały „Wyślij" i strzałkę poza panel (overflow:hidden). */
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px; background: #f6f8fb;
  display: flex; flex-direction: column; gap: 8px;
}
.pf-chat__msg { max-width: 82%; padding: 8px 11px; border-radius: 12px; word-wrap: break-word; white-space: pre-wrap; }
.pf-chat__msg--visitor { align-self: flex-end; background: var(--pf-accent, #0b5ed7); color: #fff; border-bottom-right-radius: 3px; }
.pf-chat__msg--agent { align-self: flex-start; background: #fff; border: 1px solid #e5e9f0; border-bottom-left-radius: 3px; }
.pf-chat__msg--system { align-self: center; background: #eef1f6; color: #667085; font-size: 12px; text-align: center; max-width: 92%; }
.pf-chat__meta { font-size: 10.5px; opacity: .7; margin-top: 3px; }
/* Guziki-podpowiedzi (quick starters) w pustym panelu — klik startuje rozmowę. */
.pf-chat__starters {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 7px;
  padding: 10px 14px; background: #f6f8fb;
}
.pf-chat__starter {
  border: 1px solid #c9d8f5; border-radius: 10px; background: #fff; color: var(--pf-accent, #0b5ed7);
  font-size: 13px; font-family: inherit; text-align: left; padding: 9px 12px;
  cursor: pointer; transition: background .12s ease;
}
.pf-chat__starter:hover { background: #eef4ff; }
.pf-chat__contact {
  /* Karta kontaktu może się skurczyć i przewinąć wewnętrznie, gdy panel jest ciasny
     (np. tryb offline: nagłówek + baner + karta + stopka). Dzięki temu stopka z
     przyciskiem „Wyślij"/strzałką zostaje przypięta i widoczna. */
  flex: 0 1 auto; min-height: 0; overflow-y: auto;
  border-top: 1px solid #e5e9f0; background: #fff; padding: 12px 14px;
}
.pf-chat__label {
  display: block; font-size: 11.5px; font-weight: 600; color: #475467;
  margin: 0 0 3px; text-align: left;
}
.pf-chat__contact h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: #1f2937 !important; }
.pf-chat__contact-note {
  margin: 0 0 9px; font-size: 12px; line-height: 1.4; color: #475467;
  background: #eef4ff; border: 1px solid #d3e2ff; border-radius: 8px; padding: 8px 10px;
}
.pf-chat__contact input[type=text],
.pf-chat__contact input[type=tel],
.pf-chat__contact input[type=email] {
  width: 100%; padding: 7px 9px; margin-bottom: 6px; border: 1px solid #ccd3de;
  border-radius: 7px; font-size: 13px;
}
.pf-chat__consent { display: flex; gap: 7px; align-items: flex-start; font-size: 11px; color: #667085; margin: 4px 0 8px; }
.pf-chat__consent a { color: var(--pf-accent, #0b5ed7); }
.pf-chat__contact-actions { display: flex; gap: 8px; }
.pf-chat__btn {
  border: none; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: var(--pf-accent, #0b5ed7); color: #fff;
}
.pf-chat__btn:disabled { opacity: .5; cursor: not-allowed; }
.pf-chat__btn--ghost { background: #eef1f6; color: #475467; }
.pf-chat__footer { flex: 0 0 auto; border-top: 1px solid #e5e9f0; padding: 10px 12px; background: #fff; }
.pf-chat__inputrow { display: flex; gap: 8px; align-items: flex-end; }
.pf-chat__footer textarea {
  flex: 1 1 auto; resize: none; border: 1px solid #ccd3de; border-radius: 9px;
  padding: 8px 10px; font-size: 13px; font-family: inherit; max-height: 90px; min-height: 38px;
}
.pf-chat__send {
  flex: 0 0 auto; width: 40px; height: 38px; border: none; border-radius: 9px;
  background: var(--pf-accent, #0b5ed7); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.pf-chat__send:disabled { opacity: .5; cursor: not-allowed; }
.pf-chat__send svg { width: 18px; height: 18px; fill: #fff !important; display: block; flex: none; }
.pf-chat__send svg path { fill: #fff !important; }
.pf-chat__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 480px) {
  .pf-chat { right: 0; bottom: 0; }
  .pf-chat__panel { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  /* Odsuń sam bąbelek od krawędzi, żeby przy scrollu nie zachodził na bok/dół.
     Panel po otwarciu i tak zajmuje cały ekran (a bąbelek jest wtedy ukryty). */
  .pf-chat__bubble { margin: 0 14px calc(14px + env(safe-area-inset-bottom, 0px)) 0; }
  .pf-chat__teaser { right: 14px; }
}
