.cr-chat-widget,
.cr-chat-widget * {
  box-sizing: border-box;
}

.cr-chat-widget {
  position: fixed;
  right: clamp(1rem, 2vw, 1.6rem);
  bottom: clamp(1rem, 2vw, 1.6rem);
  z-index: 180;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.cr-chat-panel {
  width: min(380px, calc(100vw - 1.6rem));
  padding: 1rem;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(247, 245, 242, 0.95)),
    #ffffff;
  box-shadow:
    0 34px 80px -30px rgba(11, 17, 28, 0.26),
    0 20px 44px -28px rgba(211, 19, 38, 0.2);
  backdrop-filter: blur(28px) saturate(1.08);
  -webkit-backdrop-filter: blur(28px) saturate(1.08);
  position: relative;
  overflow: hidden;
  transform-origin: calc(100% - 2rem) calc(100% + 1rem);
  opacity: 0;
  transform: translateY(18px) scale(0.92);
  filter: blur(10px);
  pointer-events: none;
  transition:
    opacity 320ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 420ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 320ms ease;
}

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

.cr-chat-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.78), transparent 34%),
    radial-gradient(circle at 18% 0%, rgba(211, 19, 38, 0.06), transparent 32%);
  pointer-events: none;
}

.cr-chat-panel::after {
  content: '';
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  top: 0.95rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(211, 19, 38, 0.14), rgba(17, 17, 17, 0.05));
  border-radius: 999px;
  pointer-events: none;
}

.cr-chat-head,
.cr-chat-window,
.cr-chat-compose {
  position: relative;
  z-index: 1;
}

.cr-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.3rem 0.8rem;
}

.cr-chat-head-copy {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.cr-chat-kicker {
  margin: 0;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(17, 17, 17, 0.46);
}

.cr-chat-title {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1;
  color: #111;
}

.cr-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: rgba(17, 17, 17, 0.62);
}

.cr-chat-status-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: #d31326;
  box-shadow: 0 0 0 6px rgba(211, 19, 38, 0.08);
}

.cr-chat-close {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.7);
  color: rgba(17, 17, 17, 0.68);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.cr-chat-close:hover {
  background: rgba(211, 19, 38, 0.08);
  color: #d31326;
  transform: translateY(-1px);
}

.cr-chat-window {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.cr-chat-card {
  padding: 1rem 1rem 0.95rem;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(252, 249, 246, 0.92)),
    #fff;
  border: 1px solid rgba(17, 17, 17, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 14px 30px -26px rgba(17, 17, 17, 0.34);
}

.cr-chat-card-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.04);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  color: rgba(17, 17, 17, 0.56);
}

.cr-chat-card-label::before {
  content: '';
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 999px;
  background: #d31326;
}

.cr-chat-card-copy {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.55;
  color: rgba(17, 17, 17, 0.78);
}

.cr-chat-bubble-row {
  display: flex;
}

.cr-chat-bubble-row.is-outgoing {
  justify-content: flex-end;
}

.cr-chat-bubble {
  max-width: 88%;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  font-size: 0.86rem;
  line-height: 1.5;
  box-shadow: 0 12px 20px -18px rgba(11, 17, 28, 0.28);
}

.cr-chat-bubble-row.is-incoming .cr-chat-bubble {
  border-top-left-radius: 8px;
  background: rgba(17, 17, 17, 0.05);
  color: rgba(17, 17, 17, 0.72);
}

.cr-chat-bubble-row.is-outgoing .cr-chat-bubble {
  border-top-right-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 248, 0.96));
  border: 1px solid rgba(211, 19, 38, 0.12);
  color: #111;
}

.cr-chat-compose {
  margin-top: 0.2rem;
  padding: 0.28rem;
  border-radius: 22px;
  background: rgba(17, 17, 17, 0.04);
  border: 1px solid rgba(17, 17, 17, 0.06);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.cr-chat-compose-input {
  flex: 1;
  min-height: 3rem;
  display: flex;
  align-items: center;
  padding: 0 0.95rem;
  color: rgba(17, 17, 17, 0.4);
  font-size: 0.9rem;
}

.cr-chat-compose-send {
  min-width: 3rem;
  height: 3rem;
  border-radius: 18px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #d31326;
  box-shadow: 0 14px 22px -18px rgba(211, 19, 38, 0.45);
}

.cr-chat-note {
  margin: 0.85rem 0 0;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(17, 17, 17, 0.46);
}

.cr-chat-fab {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.84);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.98), rgba(244, 243, 240, 0.96)),
    #ffffff;
  color: #111;
  min-width: 4.2rem;
  height: 4.2rem;
  padding: 0 1.28rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.72rem;
  position: relative;
  cursor: pointer;
  box-shadow:
    0 20px 48px -20px rgba(11, 17, 28, 0.34),
    0 10px 20px -18px rgba(255, 255, 255, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition:
    transform 260ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 260ms ease,
    background-color 220ms ease;
  overflow: visible;
}

.cr-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow:
    0 24px 58px -22px rgba(11, 17, 28, 0.38),
    0 12px 22px -18px rgba(255, 255, 255, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.cr-chat-widget.is-open .cr-chat-fab {
  transform: translateY(-1px) scale(0.985);
}

.cr-chat-fab-orbit {
  position: absolute;
  inset: -0.55rem;
  border-radius: inherit;
  animation: cr-chat-orbit 4.8s linear infinite;
  pointer-events: none;
}

.cr-chat-fab-orbit::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1.25rem;
  height: 1.25rem;
  transform: translate(-50%, -40%);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.22) 55%, transparent 72%);
  filter: blur(1.2px);
}

.cr-chat-fab-icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cr-chat-fab-icon svg {
  width: 0.96rem;
  height: 0.96rem;
}

.cr-chat-fab-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  white-space: nowrap;
}

@keyframes cr-chat-orbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  .cr-chat-widget {
    right: 0.9rem;
    bottom: 0.9rem;
    left: 0.9rem;
    align-items: stretch;
  }

  .cr-chat-panel {
    width: 100%;
  }

  .cr-chat-fab {
    align-self: flex-end;
  }
}
