.ebsWebchatLauncher {
  position: fixed;
  right: 18px;
  left: auto;
  bottom: 18px;
  z-index: 2147483000;
  font: 14px/1.35 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  pointer-events: none; /* never block page taps */
}

.ebsWebchatButton,
.ebsWebchatPanel {
  pointer-events: auto;
}

.ebsWebchatButton {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 14px;
  cursor: pointer;
  background: #111827;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  position: relative;
}

.ebsWebchatBadge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid #111827;
  display: none;
}

.ebsWebchatBadge.isVisible {
  display: block;
}

.ebsWebchatPanel {
  position: absolute;
  right: 0;
  bottom: 56px;
  width: min(360px, calc(100vw - 36px));
  height: min(520px, calc(100vh - 120px));
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 16px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  display: none;
}

.ebsWebchatPanel.isOpen {
  display: flex;
  flex-direction: column;
}

.ebsWebchatHeader {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ebsWebchatTitle {
  font-weight: 600;
  color: #111827;
}

.ebsWebchatClose {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 6px 8px;
}

.ebsWebchatBody {
  flex: 1;
  padding: 12px 12px 8px;
  overflow: auto;
  background: #f9fafb;
}

.ebsWebchatMsg {
  max-width: 86%;
  padding: 10px 10px;
  border-radius: 12px;
  margin: 8px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.ebsWebchatMsg--user {
  margin-left: auto;
  background: #111827;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ebsWebchatMsg--ai,
.ebsWebchatMsg--operator,
.ebsWebchatMsg--system {
  margin-right: auto;
  background: #fff;
  color: #111827;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-bottom-left-radius: 4px;
}

.ebsWebchatMeta {
  font-size: 12px;
  color: rgba(17, 24, 39, 0.65);
  margin-top: 2px;
}

.ebsWebchatInlineLink {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.ebsWebchatCards {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.ebsWebchatCard {
  display: block;
  text-decoration: none;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #111827;
}

.ebsWebchatCard:link,
.ebsWebchatCard:visited,
.ebsWebchatCard:hover,
.ebsWebchatCard:active {
  color: #111827 !important;
}

.ebsWebchatCardImage {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  margin-bottom: 8px;
  background: #eef2f7;
}

.ebsWebchatCardHost {
  font-size: 11px;
  color: rgba(17, 24, 39, 0.62);
  margin-bottom: 4px;
}

.ebsWebchatCardTitle {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 6px;
  word-break: break-word;
  color: #111827 !important;
}

.ebsWebchatCardAction {
  font-size: 12px;
  color: #2563eb;
}

.ebsWebchatFooter {
  border-top: 1px solid rgba(17, 24, 39, 0.08);
  padding: 10px;
  display: flex;
  gap: 8px;
  background: #fff;
}

.ebsWebchatInput {
  flex: 1;
  border: 1px solid rgba(17, 24, 39, 0.18);
  border-radius: 12px;
  padding: 10px 10px;
  outline: none;
  background: #ffffff !important;
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
  caret-color: #111827;
  opacity: 1;
}

.ebsWebchatInput::placeholder {
  color: rgba(17, 24, 39, 0.45) !important;
}

.ebsWebchatInput:disabled {
  background: #f3f4f6 !important;
  color: rgba(17, 24, 39, 0.7) !important;
}

.ebsWebchatSend {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
}

.ebsWebchatStatus {
  padding: 0 12px 10px;
  color: rgba(17, 24, 39, 0.65);
  font-size: 12px;
}

.ebsWebchatContactPrompt {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 12px;
  background: #fff;
}

.ebsWebchatContactPromptTitle {
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
}

.ebsWebchatContactPromptNote {
  font-size: 12px;
  color: rgba(17, 24, 39, 0.7);
  margin-bottom: 8px;
}

.ebsWebchatContactInput {
  width: 100%;
  border: 1px solid rgba(17, 24, 39, 0.18);
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 8px;
  outline: none;
  box-sizing: border-box;
}

.ebsWebchatContactActions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.ebsWebchatContactSubmit,
.ebsWebchatContactSkip {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.ebsWebchatContactSubmit {
  background: #2563eb;
  color: #fff;
}

.ebsWebchatContactSkip {
  background: #e5e7eb;
  color: #111827;
}

.ebsWebchatContactError {
  margin-top: 8px;
  font-size: 12px;
  color: #b91c1c;
  min-height: 16px;
}

/* Wave 3.5 — graceful-degradation fallback (inline card inside chat body). */
.ebsWebchatFallback {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 12px;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}

.ebsWebchatFallbackTitle {
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.ebsWebchatFallbackHint {
  font-size: 12px;
  color: rgba(17, 24, 39, 0.72);
  margin-bottom: 10px;
  line-height: 1.4;
}

.ebsWebchatFallbackGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ebsWebchatFallbackBtn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(17, 24, 39, 0.14);
  background: #ffffff;
  color: #111827 !important;
  text-decoration: none;
  min-height: 48px;
  justify-content: center;
}

.ebsWebchatFallbackBtn:hover,
.ebsWebchatFallbackBtn:active {
  border-color: rgba(37, 99, 235, 0.45);
  color: #111827 !important;
}

.ebsWebchatFallbackBtnLabel {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(17, 24, 39, 0.6);
}

.ebsWebchatFallbackBtnValue {
  font-weight: 600;
  font-size: 13px;
  color: #111827;
  word-break: break-all;
}

.ebsWebchatFallbackBtn--phone .ebsWebchatFallbackBtnValue { color: #047857; }
.ebsWebchatFallbackBtn--whatsapp .ebsWebchatFallbackBtnValue { color: #15803d; }
.ebsWebchatFallbackBtn--telegram .ebsWebchatFallbackBtnValue { color: #1d4ed8; }
.ebsWebchatFallbackBtn--email .ebsWebchatFallbackBtnValue { color: #6d28d9; }

/* Wave 3.5 — persistent degraded-mode bar above input. */
.ebsWebchatDegradedBar {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid rgba(220, 38, 38, 0.18);
  background: #fff7ed;
  color: #9a3412;
}

.ebsWebchatDegradedBarTitle {
  font-weight: 700;
  font-size: 13px;
  color: #9a3412;
}

.ebsWebchatDegradedBarNote {
  font-size: 12px;
  color: rgba(154, 52, 18, 0.85);
  margin-bottom: 8px;
}

.ebsWebchatDegradedBarGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.ebsWebchatDegradedBar .ebsWebchatFallbackBtn {
  background: #ffffff;
  border-color: rgba(154, 52, 18, 0.25);
  min-height: 44px;
  padding: 8px 10px;
}

@media (max-width: 480px) {
  .ebsWebchatFallbackGrid,
  .ebsWebchatDegradedBarGrid {
    grid-template-columns: 1fr;
  }
}

body.ebsWebchatNoScroll {
  overflow: hidden;
}

html.ebsWebchatNoScroll {
  overflow: hidden;
}

@media (max-width: 768px) {
  .ebsWebchatLauncher {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483646;
  }

  .ebsWebchatLauncher:not(.isOpen) {
    top: auto;
    left: auto;
    right: 0;
    bottom: 0;
  }

  .ebsWebchatButton {
    position: fixed;
    right: 12px;
    left: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    margin: 0;
    display: inline-flex;
  }

  .ebsWebchatLauncher.isOpen .ebsWebchatButton {
    display: none;
  }

  /* Mobile full-screen overlay (KB-022). Panel uses position:fixed with
     top:0 and a JS-driven translate3d(0, --ebs-vv-top) so iOS Safari's
     "position:fixed shifts up with layoutViewport when the keyboard
     opens" bug never hides the header. The transform is GPU-composited
     and updates synchronously with visualViewport.scroll, so the panel
     no longer lags behind keyboard animation. height is bound to
     --ebs-vv-height so the footer always sits flush against the
     keyboard's top edge — no black gap, no floating window. */
  .ebsWebchatPanel {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    width: 100vw;
    height: var(--ebs-vv-height, 100dvh);
    max-height: var(--ebs-vv-height, 100dvh);
    min-height: 0;
    margin: 0;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    transform: translate3d(0, var(--ebs-vv-top, 0px), 0);
    will-change: transform, height;
    contain: layout size;
  }

  .ebsWebchatPanel.isOpen {
    display: flex;
  }

  .ebsWebchatHeader {
    flex-shrink: 0;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: #fff;
    z-index: 3;
  }

  .ebsWebchatBody {
    flex: 1 1 0;
    min-height: 0;
    height: 0;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .ebsWebchatFooter {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.06);
  }

  .ebsWebchatLauncher.ebsKeyboardOpen .ebsWebchatFooter {
    padding-bottom: 10px;
  }

  .ebsWebchatClose {
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
    padding: 6px 0;
  }
}



/* AI Seller V2 structured product cards. */
.ebsWebchatProductCards {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.ebsWebchatProductCard,
.ebsWebchatProductCard:link,
.ebsWebchatProductCard:visited,
.ebsWebchatProductCard:hover,
.ebsWebchatProductCard:active {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 12px;
  background: #ffffff;
  color: #111827 !important;
  text-decoration: none !important;
}

.ebsWebchatProductCardImage {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: #f3f4f6;
  display: block;
}

.ebsWebchatProductCardInfo { min-width: 0; }

.ebsWebchatProductCardTitle {
  font-weight: 600;
  line-height: 1.25;
  color: #111827 !important;
  overflow-wrap: anywhere;
}

.ebsWebchatProductCardPrice {
  margin-top: 4px;
  font-weight: 700;
  color: #111827 !important;
}

.ebsWebchatProductCardStock {
  margin-top: 2px;
  font-size: 12px;
  color: #047857 !important;
}


.ebsWebchatProductCardBadge {
  display: inline-block;
  margin-bottom: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3 !important;
  font-size: 11px;
  font-weight: 700;
}

.ebsWebchatActions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ebsWebchatActionButton {
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 999px;
  background: #111827;
  color: #fff;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.ebsWebchatActionButton:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* Optimistic UI — typing indicator while AI/operator is working. */
.ebsWebchatTyping {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  min-height: 36px;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  margin-right: auto;
}

.ebsWebchatTypingDot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.45);
  animation: ebsTypingPulse 1.2s infinite ease-in-out;
}

.ebsWebchatTypingDot:nth-child(2) { animation-delay: 0.18s; }
.ebsWebchatTypingDot:nth-child(3) { animation-delay: 0.36s; }

@keyframes ebsTypingPulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Optimistic user bubble shown instantly on send (animates in). */
.ebsWebchatMsg--user.isOptimistic {
  animation: ebsOptimisticIn 140ms ease-out;
}

@keyframes ebsOptimisticIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Inline lead-magnet form (3000₽ strollers / 1500₽ auto). Lives inside an
   AI bubble; matches the existing light theme of the consultant. */
.ebsWebchatInlineForm {
  margin-top: 10px;
  padding: 14px 14px 12px;
  background: #f9fafb;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ebsWebchatInlineForm__title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  color: #111827;
}
.ebsWebchatInlineForm__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ebsWebchatInlineForm__label {
  font-size: 12px;
  color: rgba(17, 24, 39, 0.7);
}
.ebsWebchatInlineForm__input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid rgba(17, 24, 39, 0.18);
  border-radius: 8px;
  background: #fff;
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
  caret-color: #111827;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 120ms ease;
}
.ebsWebchatInlineForm__input::placeholder {
  color: rgba(17, 24, 39, 0.4);
}
.ebsWebchatInlineForm__input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.ebsWebchatInlineForm__input--invalid {
  border-color: #b91c1c;
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.15);
}
.ebsWebchatInlineForm__fieldError {
  font-size: 12px;
  color: #b91c1c;
  min-height: 0;
}
.ebsWebchatInlineForm__fieldError:empty { display: none; }
.ebsWebchatInlineForm__status {
  font-size: 13px;
  color: rgba(17, 24, 39, 0.7);
  min-height: 0;
}
.ebsWebchatInlineForm__status:empty { display: none; }
.ebsWebchatInlineForm__status--err { color: #b91c1c; }
.ebsWebchatInlineForm__submit {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: #111827;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: opacity 120ms ease;
}
.ebsWebchatInlineForm__submit:hover { opacity: 0.92; }
.ebsWebchatInlineForm__submit:disabled { opacity: 0.55; cursor: progress; }
.ebsWebchatInlineForm__consent {
  font-size: 11px;
  line-height: 1.45;
  color: rgba(17, 24, 39, 0.6);
}
.ebsWebchatInlineForm__consent a {
  color: #2563eb;
  text-decoration: underline;
}
.ebsWebchatInlineForm__success {
  padding: 12px;
  background: #ecfdf5;
  border: 1px solid rgba(5, 150, 105, 0.3);
  border-radius: 10px;
  color: #065f46;
  font-size: 14px;
  line-height: 1.45;
}
.ebsWebchatInlineForm__promo {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.06em;
  text-align: center;
}
