.cc-chat-root {
  --cc-primary: #2563eb;
  --cc-primary-hover: #1d4ed8;
  --cc-bg: #ffffff;
  --cc-surface: #f8fafc;
  --cc-border: #e2e8f0;
  --cc-text: #0f172a;
  --cc-muted: #64748b;
  --cc-bot: #f1f5f9;
  --cc-user: #dbeafe;
  --cc-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--cc-text);
}

.cc-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: calc(100vw - 24px);
}

.cc-chat-fab {
  position: relative;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 58px;
  height: 58px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: var(--cc-primary);
  color: #fff;
  box-shadow: var(--cc-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.cc-chat-fab:hover {
  transform: translateY(-1px);
  background: var(--cc-primary-hover);
}

.cc-chat-fab.is-avatar {
  background: var(--cc-primary);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
}

.cc-chat-fab.is-avatar:hover {
  background: var(--cc-primary);
}

.cc-chat-fab svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  flex-shrink: 0;
}

.cc-chat-fab.is-avatar svg {
  width: 32px;
  height: 32px;
}

.cc-chat-fab img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border: 0;
  border-radius: inherit;
}

.cc-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 2147483000;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: var(--cc-bg);
  border: 1px solid var(--cc-border);
  box-shadow: var(--cc-shadow);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.cc-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--cc-primary);
  color: #fff;
}

.cc-chat-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.cc-chat-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.cc-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cc-chat-avatar svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  opacity: 0.95;
}

.cc-chat-header-text {
  min-width: 0;
}

.cc-chat-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.95;
}

.cc-chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
  flex-shrink: 0;
}

.cc-chat-status.is-offline .cc-chat-status-dot {
  background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.35);
}

.cc-chat-compose .cc-chat-input:disabled {
  background: #f1f5f9;
  cursor: not-allowed;
}

.cc-chat-close {
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.cc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--cc-surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cc-chat-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  word-break: break-word;
}

.cc-chat-msg-body {
  white-space: pre-wrap;
}

.cc-chat-phone {
  font-weight: 700;
  color: var(--cc-text);
}

.cc-chat-msg.is-bot {
  align-self: flex-start;
  background: var(--cc-bot);
  border-bottom-left-radius: 4px;
}

.cc-chat-msg.is-user {
  align-self: flex-end;
  background: var(--cc-user);
  border-bottom-right-radius: 4px;
}

.cc-chat-msg.is-error {
  align-self: center;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  white-space: pre-wrap;
}

.cc-chat-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.cc-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.cc-chat-btn-call {
  background: var(--cc-primary);
  color: #fff;
}

.cc-chat-btn-call:hover {
  background: var(--cc-primary-hover);
}

.cc-chat-btn-book {
  background: #fff;
  color: var(--cc-primary);
  border: 1px solid color-mix(in srgb, var(--cc-primary) 35%, var(--cc-border));
}

.cc-chat-btn-book:hover {
  background: color-mix(in srgb, var(--cc-primary) 8%, #fff);
}

.cc-chat-typing {
  align-self: flex-start;
  padding: 8px 12px;
  background: var(--cc-bot);
  border-radius: 12px;
  color: var(--cc-muted);
  font-size: 13px;
}

.cc-chat-footer {
  padding: 12px;
  border-top: 1px solid var(--cc-border);
  background: var(--cc-bg);
}

.cc-chat-compose {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.cc-chat-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 88px;
  max-height: 140px;
  resize: none;
  border: 1px solid var(--cc-border);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: var(--cc-text);
  background: #fff;
}

.cc-chat-input:focus {
  outline: 2px solid color-mix(in srgb, var(--cc-primary) 25%, transparent);
  border-color: var(--cc-primary);
}

.cc-chat-send {
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--cc-primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cc-chat-send:hover:not(:disabled) {
  background: var(--cc-primary-hover);
}

.cc-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cc-chat-powered {
  padding: 5px 12px 9px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--cc-muted);
  background: var(--cc-bg);
  border-top: 1px solid rgba(15, 23, 42, 0.04);
}

.cc-chat-powered-link {
  color: inherit;
  text-decoration: none;
  opacity: 0.72;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.cc-chat-powered-link:hover,
.cc-chat-powered-link:focus-visible {
  opacity: 1;
  color: var(--cc-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  outline: none;
}

.cc-chat-nudge {
  position: relative;
  display: flex;
  align-items: flex-end;
  max-width: min(260px, calc(100vw - 100px));
  opacity: 0;
  transform: translate3d(16px, 6px, 0) scale(0.94);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.cc-chat-nudge[hidden] {
  display: none !important;
}

.cc-chat-nudge.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  pointer-events: auto;
}

.cc-chat-nudge-bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 100%;
  padding: 10px 12px 11px;
  border: 1px solid var(--cc-border);
  border-radius: 16px 16px 4px 16px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transform-origin: bottom right;
}

.cc-chat-nudge.is-speaking .cc-chat-nudge-bubble {
  animation: cc-nudge-speak 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

.cc-chat-nudge-bubble::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: 16px;
  width: 11px;
  height: 11px;
  background: #fff;
  border-right: 1px solid var(--cc-border);
  border-bottom: 1px solid var(--cc-border);
  transform: rotate(-45deg);
}

.cc-chat-nudge-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--cc-primary);
  line-height: 1.2;
}

.cc-chat-nudge-text {
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--cc-text);
  white-space: pre-wrap;
}

.cc-chat-nudge-dismiss {
  position: absolute;
  top: -8px;
  left: -8px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: var(--cc-muted);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cc-chat-nudge-dismiss:hover {
  color: var(--cc-text);
}

@keyframes cc-nudge-speak {
  0% {
    opacity: 0.2;
    transform: translateX(22px) scale(0.9);
  }
  55% {
    opacity: 1;
    transform: translateX(-3px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@media (max-width: 480px) {
  .cc-chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 80px;
    height: min(70vh, 520px);
  }

  .cc-chat-launcher {
    right: 16px;
    bottom: 16px;
  }

  .cc-chat-nudge {
    max-width: min(210px, calc(100vw - 96px));
  }
}
