.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: auto;
    left: auto;
    right: 0;
    bottom: 0;
    z-index: 2147483646;
  }

  .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;
  }

  .ebsWebchatPanel {
    position: fixed;
    top: var(--ebs-vv-top, 0px);
    left: 0;
    right: 0;
    width: 100vw;
    height: var(--ebs-vv-height, 100dvh);
    max-height: var(--ebs-vv-height, 100dvh);
    min-height: 260px;
    border-radius: 0;
    border: 0;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
  }

  .ebsWebchatPanel.isOpen {
    display: flex;
  }

  .ebsWebchatHeader {
    flex-shrink: 0;
    padding-top: calc(12px + env(safe-area-inset-top));
  }

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

  .ebsWebchatFooter {
    flex-shrink: 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

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

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

