/* Klikon Chat — widget styles. BEM, scoped to .kbc-*. */

:root {
  --kbc-accent: #FDE047;
  --kbc-dark:   #0F2D5C;
  --kbc-blue:   #1E5BA8;
  --kbc-bg:     #f6f7f9;
  --kbc-text:   #1f2937;
  --kbc-muted:  #6b7280;
}

.kbc-widget {
  position: fixed;
  bottom: 20px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--kbc-text);
}
.kbc-widget--right { right: 20px; }
.kbc-widget--left  { left: 20px; }

/* BUBBLE */
.kbc-bubble {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--kbc-accent);
  color: var(--kbc-dark);
  border: 0;
  cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(15, 45, 92, 0.4), 0 4px 12px -2px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}
.kbc-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px -8px rgba(15, 45, 92, 0.5), 0 6px 16px -2px rgba(0, 0, 0, 0.2);
}
.kbc-bubble:active { transform: scale(0.96); }

.kbc-bubble__pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--kbc-accent);
  opacity: 0.5;
  animation: kbc-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes kbc-pulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0;   }
}

.kbc-bubble__icon { position: relative; z-index: 1; transition: transform 0.2s ease, opacity 0.2s ease; }

/* UNREAD BADGE */
.kbc-bubble__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
  animation: kbc-badge-pop 0.3s ease;
}
@keyframes kbc-badge-pop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* TEASER (preview ostatniej wiadomości bota gdy chat zamknięty) */
.kbc-teaser {
  position: absolute;
  right: calc(100% + 14px);
  bottom: 8px;
  width: 280px;
  max-width: calc(100vw - 100px);
  background: #fff;
  padding: 14px 32px 14px 16px;
  border-radius: 22px 22px 4px 22px;
  box-shadow: 0 12px 30px -10px rgba(15, 45, 92, 0.3), 0 6px 12px -4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  animation: kbc-teaser-slide 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.kbc-widget--left .kbc-teaser {
  right: auto;
  left: calc(100% + 14px);
  border-radius: 22px 22px 22px 4px;
}
@keyframes kbc-teaser-slide {
  0%   { transform: translateX(20px) scale(0.92); opacity: 0; }
  100% { transform: translateX(0)    scale(1);    opacity: 1; }
}
@media (max-width: 640px) {
  .kbc-teaser {
    right: 0;
    bottom: calc(100% + 12px);
    border-radius: 22px 22px 4px 22px;
    animation: kbc-teaser-slide-mobile 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .kbc-widget--left .kbc-teaser {
    right: auto;
    left: 0;
    border-radius: 22px 22px 22px 4px;
  }
  @keyframes kbc-teaser-slide-mobile {
    0%   { transform: translateY(15px); opacity: 0; }
    100% { transform: translateY(0);    opacity: 1; }
  }
}
.kbc-teaser:hover { background: #fafafa; }
.kbc-teaser__body {
  font-size: 13px;
  line-height: 1.45;
  color: var(--kbc-text);
  margin-bottom: 6px;
}
.kbc-teaser__cta {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kbc-blue);
}
.kbc-teaser__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 0;
  color: var(--kbc-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kbc-teaser__close:hover { background: var(--kbc-bg); color: var(--kbc-dark); }

/* HEAD ACTIONS (Wyczyść + Zamknij) */
.kbc-panel__head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.kbc-panel__head-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}
.kbc-panel__head-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--kbc-accent);
}

/* GREETING BUBBLE (pierwsze wejście, zachęta do kliknięcia) */
.kbc-greeting {
  position: absolute;
  right: calc(100% + 14px);
  bottom: 8px;
  width: 290px;
  max-width: calc(100vw - 100px);
  background: #fff;
  padding: 14px 32px 14px 14px;
  border-radius: 22px 22px 4px 22px;
  box-shadow: 0 12px 30px -10px rgba(15, 45, 92, 0.3), 0 6px 12px -4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: kbc-greeting-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.kbc-widget--left .kbc-greeting {
  right: auto;
  left: calc(100% + 14px);
  border-radius: 22px 22px 22px 4px;
}

@keyframes kbc-greeting-pop {
  0%   { transform: translateX(20px) scale(0.85); opacity: 0; }
  60%  { transform: translateX(-3px) scale(1.03); opacity: 1; }
  100% { transform: translateX(0)    scale(1);    opacity: 1; }
}

.kbc-greeting:hover {
  background: #fafafa;
  transform: translateX(-3px);
  transition: transform 0.2s ease, background 0.2s ease;
}

@media (max-width: 640px) {
  .kbc-greeting {
    right: 0;
    bottom: calc(100% + 12px);
    left: auto;
    border-radius: 22px 22px 4px 22px;
    animation: kbc-greeting-pop-mobile 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .kbc-widget--left .kbc-greeting {
    right: auto;
    left: 0;
    border-radius: 22px 22px 22px 4px;
  }
  @keyframes kbc-greeting-pop-mobile {
    0%   { transform: translateY(20px) scale(0.85); opacity: 0; }
    60%  { transform: translateY(-3px) scale(1.03); opacity: 1; }
    100% { transform: translateY(0)    scale(1);    opacity: 1; }
  }
  .kbc-greeting:hover { transform: translateY(-2px); }
}

.kbc-greeting__avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--kbc-accent);
  color: var(--kbc-dark);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}
.kbc-greeting__avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  box-sizing: border-box;
}

.kbc-greeting__body { min-width: 0; }
.kbc-greeting__name {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--kbc-blue);
  margin-bottom: 2px;
}
.kbc-greeting__text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--kbc-text);
}

.kbc-greeting__close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 0;
  color: var(--kbc-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kbc-greeting__close:hover { background: var(--kbc-bg); color: var(--kbc-dark); }

/* RESTORED MESSAGES — subtelne wejście */
.kbc-msg.is-restored .kbc-msg__bubble {
  animation: kbc-restored-fade 0.3s ease;
}
@keyframes kbc-restored-fade {
  0%   { opacity: 0.3; }
  100% { opacity: 1; }
}
.kbc-bubble__icon--close { position: absolute; opacity: 0; transform: rotate(-90deg) scale(0.7); }
.kbc-widget.is-open .kbc-bubble__icon--chat  { opacity: 0; transform: rotate(90deg) scale(0.7); }
.kbc-widget.is-open .kbc-bubble__icon--close { opacity: 1; transform: rotate(0) scale(1); }
.kbc-widget.is-open .kbc-bubble__pulse       { animation: none; opacity: 0; }

/* PANEL */
.kbc-panel {
  position: absolute;
  bottom: calc(100% + 16px);
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: #fff;
  box-shadow: 0 20px 60px -20px rgba(15, 45, 92, 0.35), 0 10px 24px -8px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.kbc-widget--left .kbc-panel { transform-origin: bottom left; left: 0; }
.kbc-widget--right .kbc-panel { right: 0; }

.kbc-widget.is-open .kbc-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* HEADER */
.kbc-panel__header {
  background: linear-gradient(135deg, var(--kbc-dark) 0%, var(--kbc-blue) 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}
.kbc-panel__header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 3px;
  background: var(--kbc-accent);
}

.kbc-panel__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.kbc-panel__avatar,
.kbc-panel__avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--kbc-accent);
  color: var(--kbc-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  overflow: hidden;
}
.kbc-panel__avatar {
  object-fit: contain;
  padding: 4px;
  box-sizing: border-box;
}
.kbc-panel__title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 2px;
}
.kbc-panel__subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}
.kbc-panel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.kbc-panel__close {
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.kbc-panel__close:hover { background: rgba(255, 255, 255, 0.2); }

/* MESSAGES */
.kbc-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--kbc-bg);
}

.kbc-msg { display: flex; max-width: 100%; }
.kbc-msg--bot  { justify-content: flex-start; }
.kbc-msg--user { justify-content: flex-end; }

.kbc-msg__bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.kbc-msg--bot .kbc-msg__bubble {
  background: #fff;
  color: var(--kbc-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px -4px rgba(15, 45, 92, 0.15);
}
.kbc-msg--user .kbc-msg__bubble {
  background: var(--kbc-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.kbc-msg__bubble p { margin: 0 0 8px; }
.kbc-msg__bubble p:last-child { margin: 0; }

.kbc-answer__title {
  display: block;
  font-weight: 700;
  font-size: 15px;
  color: var(--kbc-dark);
  margin-bottom: 6px;
}
.kbc-answer__body { font-size: 14px; }
.kbc-answer__cta {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 14px;
  background: var(--kbc-accent);
  color: var(--kbc-dark);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.kbc-answer__cta:hover { opacity: 0.85; }
.kbc-answer__link {
  display: inline-block;
  margin-top: 8px;
  color: var(--kbc-blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.kbc-answer__link:hover { text-decoration: underline; }
.kbc-answer__related {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(15, 45, 92, 0.08);
  font-size: 12px;
}
.kbc-answer__related span { color: var(--kbc-muted); }
.kbc-answer__related ul { margin: 6px 0 0; padding: 0; list-style: none; }
.kbc-answer__related li { margin: 4px 0; }
.kbc-answer__related a {
  color: var(--kbc-blue);
  text-decoration: none;
  font-weight: 600;
}
.kbc-answer__related a:hover { text-decoration: underline; }

/* FEEDBACK BUTTONS */
.kbc-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 0 0;
  font-size: 12px;
  color: var(--kbc-muted);
}
.kbc-feedback button {
  background: #fff;
  border: 1px solid rgba(15, 45, 92, 0.1);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  border-radius: 14px;
  transition: background 0.2s ease, transform 0.2s ease;
}
.kbc-feedback button:hover {
  background: var(--kbc-accent);
  transform: scale(1.05);
}
.kbc-feedback__human {
  margin-left: 4px;
  font-size: 12px !important;
  font-weight: 600;
  color: var(--kbc-blue);
}

.kbc-cta-lead {
  display: flex;
  justify-content: flex-start;
}
.kbc-cta-lead button {
  background: var(--kbc-accent);
  color: var(--kbc-dark);
  border: 0;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.kbc-cta-lead button:hover { opacity: 0.85; }

/* FALLBACK CHIPS (gdy bot nie znalazł odpowiedzi) */
.kbc-fallback-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.kbc-fallback-chip {
  background: #fff;
  border: 1px solid rgba(15, 45, 92, 0.15);
  color: var(--kbc-dark);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: 14px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.kbc-fallback-chip:hover {
  background: var(--kbc-accent);
  border-color: var(--kbc-accent);
}

/* TYPING */
.kbc-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  padding: 12px 14px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 2px 8px -4px rgba(15, 45, 92, 0.15);
}
.kbc-typing span {
  width: 8px;
  height: 8px;
  background: var(--kbc-blue);
  border-radius: 50%;
  opacity: 0.4;
  animation: kbc-typing 1.2s infinite ease-in-out;
}
.kbc-typing span:nth-child(2) { animation-delay: 0.15s; }
.kbc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes kbc-typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1;   }
}

/* SUGGESTIONS */
.kbc-panel__suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 8px;
  background: var(--kbc-bg);
}
.kbc-panel__suggestions:empty { display: none; }

.kbc-suggestions-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: transparent;
  border: 1px dashed rgba(15, 45, 92, 0.25);
  color: var(--kbc-dark);
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  font-family: inherit;
}
.kbc-suggestions-toggle:hover {
  background: var(--kbc-accent);
  border-color: var(--kbc-accent);
  border-style: solid;
}
.kbc-suggestions-toggle svg {
  transition: transform 0.25s ease;
}
.kbc-suggestions-toggle.is-open svg {
  transform: rotate(45deg);
}

.kbc-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
}
.kbc-suggestions-list[hidden] { display: none !important; }

.kbc-suggestion {
  background: #fff;
  border: 1px solid rgba(15, 45, 92, 0.12);
  color: var(--kbc-dark);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 14px;
  transition: background 0.2s ease, border-color 0.2s ease;
  font-family: inherit;
}
.kbc-suggestion:hover {
  background: var(--kbc-accent);
  border-color: var(--kbc-accent);
}

/* INPUT */
.kbc-panel__input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid rgba(15, 45, 92, 0.08);
}
.kbc-panel__field {
  flex: 1;
  border: 1px solid rgba(15, 45, 92, 0.15);
  padding: 10px 14px;
  font-size: 14px;
  background: #fff;
  color: var(--kbc-text);
  outline: 0;
  border-radius: 20px;
  font-family: inherit;
  transition: border-color 0.2s ease;
  min-width: 0;
}
.kbc-panel__field:focus { border-color: var(--kbc-blue); }
.kbc-panel__send {
  background: var(--kbc-accent);
  color: var(--kbc-dark);
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.kbc-panel__send:hover { transform: scale(1.08); }
.kbc-panel__send:active { transform: scale(0.96); }

/* LEAD FORM */
.kbc-lead-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  position: relative;
}
.kbc-lead-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kbc-muted);
}
.kbc-lead-form input[type="text"],
.kbc-lead-form input[type="email"],
.kbc-lead-form input[type="tel"],
.kbc-lead-form textarea {
  border: 1px solid rgba(15, 45, 92, 0.15);
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--kbc-text);
  outline: 0;
  border-radius: 8px;
  text-transform: none;
  letter-spacing: 0;
}
.kbc-lead-form input:focus,
.kbc-lead-form textarea:focus { border-color: var(--kbc-blue); }
.kbc-lead-form__gdpr {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 8px !important;
  font-size: 11px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--kbc-text) !important;
  line-height: 1.4;
}
.kbc-lead-form__gdpr input { margin-top: 2px; flex-shrink: 0; }
.kbc-lead-form button[type="submit"] {
  background: var(--kbc-accent);
  color: var(--kbc-dark);
  border: 0;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: 8px;
  transition: opacity 0.2s ease;
}
.kbc-lead-form button[type="submit"]:hover { opacity: 0.85; }
.kbc-lead-form__error {
  color: #b91c1c;
  font-size: 12px;
  margin: 0;
}

/* FOOTER */
.kbc-panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  background: #f9fafb;
  font-size: 11px;
  color: var(--kbc-muted);
  border-top: 1px solid rgba(15, 45, 92, 0.06);
}
.kbc-panel__footer a {
  color: var(--kbc-muted);
  text-decoration: underline;
}
.kbc-panel__footer a:hover { color: var(--kbc-blue); }

.kbc-panel__powered {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none !important;
  color: var(--kbc-muted) !important;
}
.kbc-panel__powered:hover { color: var(--kbc-dark) !important; }
.kbc-panel__powered strong {
  font-weight: 700;
  color: var(--kbc-dark);
}
.kbc-panel__agency-logo {
  height: 18px;
  max-width: 100px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   MOBILE — wersja pełnoekranowa do 768px
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 768px) {
  .kbc-widget { bottom: 16px; }
  .kbc-widget--right { right: 16px; }
  .kbc-widget--left  { left: 16px; }

  /* Panel full-screen — granat tła wypełnia safe-area pod notchem iOS */
  .kbc-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    transform-origin: bottom right;
    border-radius: 0;
    background: #0F2D5C;
    padding-top: env(safe-area-inset-top);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }
  .kbc-widget--left .kbc-panel { transform-origin: bottom left; }

  .kbc-panel__header {
    padding: 14px 16px;
    flex-shrink: 0;
  }
  .kbc-panel__messages {
    flex: 1 1 auto;
    min-height: 0;
  }
  .kbc-panel__title { font-size: 16px; }
  .kbc-panel__subtitle { font-size: 11px; }
  .kbc-panel__avatar,
  .kbc-panel__avatar-fallback { width: 36px; height: 36px; }

  /* Messages — większa lista, więcej oddechu */
  .kbc-panel__messages {
    padding: 14px;
    gap: 12px;
  }
  .kbc-msg__bubble {
    max-width: 88%;
    font-size: 15px; /* iOS minimum żeby nie zoomować */
    padding: 11px 15px;
  }

  /* Input — większy żeby iOS nie zoomowało (font 16px+) */
  .kbc-panel__input {
    padding: 12px 14px calc(env(safe-area-inset-bottom) + 12px);
    gap: 10px;
  }
  .kbc-panel__field {
    font-size: 16px; /* anti-zoom iOS */
    padding: 12px 16px;
    border-radius: 24px;
  }
  .kbc-panel__send {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
  .kbc-panel__field:focus { font-size: 16px; }

  /* Bubble większy do tapowania */
  .kbc-bubble {
    width: 64px;
    height: 64px;
  }
  .kbc-bubble__icon { width: 30px; height: 30px; }
  .kbc-bubble__badge {
    min-width: 24px;
    height: 24px;
    font-size: 12px;
    top: -6px;
    right: -6px;
  }

  /* Greeting/Teaser na mobile — pełna szerokość minus marginesy */
  .kbc-greeting,
  .kbc-teaser {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    right: 0;
    left: auto;
    bottom: calc(100% + 12px);
  }
  .kbc-widget--left .kbc-greeting,
  .kbc-widget--left .kbc-teaser {
    right: auto;
    left: 0;
  }

  /* Suggestions — mniej padding, większa lista */
  .kbc-panel__suggestions {
    padding: 0 14px 10px;
  }
  .kbc-suggestion {
    font-size: 13px;
    padding: 8px 14px;
  }

  /* Footer — kompaktowy */
  .kbc-panel__footer {
    padding: 6px 14px calc(env(safe-area-inset-bottom) + 4px);
    font-size: 10px;
  }

  /* Lead form — większe inputy, mobile-friendly */
  .kbc-lead-form input[type="text"],
  .kbc-lead-form input[type="email"],
  .kbc-lead-form input[type="tel"],
  .kbc-lead-form textarea {
    font-size: 16px; /* anti-zoom */
    padding: 12px 14px;
  }
  .kbc-lead-form button[type="submit"] {
    padding: 14px;
    font-size: 14px;
  }

  /* Close button większy */
  .kbc-panel__close {
    width: 40px;
    height: 40px;
  }

  /* Search overlay — pełnoekran (jeśli używany) */
  .kbc-feedback button {
    font-size: 15px;
    padding: 6px 10px;
  }
  .kbc-feedback__human {
    font-size: 13px !important;
    padding: 6px 12px;
  }
}

/* Bardzo małe telefony */
@media (max-width: 380px) {
  .kbc-bubble { width: 58px; height: 58px; }
  .kbc-bubble__icon { width: 26px; height: 26px; }
  .kbc-widget { bottom: 12px; }
  .kbc-widget--right { right: 12px; }
}

/* Landscape — ekran szeroki ale niski (np. telefon poziomo) */
@media (max-height: 500px) and (orientation: landscape) {
  .kbc-panel { height: 100dvh; }
  .kbc-panel__header { padding: 8px 16px; }
  .kbc-panel__messages { padding: 8px 14px; }
  .kbc-panel__avatar,
  .kbc-panel__avatar-fallback { width: 32px; height: 32px; }
}

/* Legacy bardzo małe ekrany — fallback */
@media (max-width: 320px) {
  .kbc-widget { bottom: 10px; }
  .kbc-widget--right { right: 10px; }
  .kbc-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 92px);
    max-height: none;
  }
}
