.chatflow-chat {
  max-width: 720px;
  margin: 18px auto;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  box-shadow: 0 12px 34px rgba(16, 24, 40, 0.12);
  display: flex;
  flex-direction: column;
}

.chatflow-chat__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
  border-bottom: 1px solid #eee;
}

.chatflow-chat__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.chatflow-chat__agent {
  font-weight: 700;
}

.chatflow-chat__body {
  height: 600px;
  overflow: auto;
  padding: 14px;
  background: radial-gradient(1200px 600px at 50% 0%, #ffffff 0%, #f2f4f7 55%, #eef2f6 100%);
  flex: 1 1 auto;
}

.chatflow-chat__row {
  display: flex;
  margin: 8px 0;
}

.chatflow-chat__row--agent {
  justify-content: flex-start;
}

.chatflow-chat__row--user {
  justify-content: flex-end;
}

.chatflow-chat__row--center {
  justify-content: center;
}

.chatflow-chat__bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.chatflow-chat__bubble--agent {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.06);
}

.chatflow-chat__bubble--user {
  background: #34d399;
  border: 1px solid #10b981;
  color: #05341f;
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.06);
}

.chatflow-chat__options {
  padding: 12px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}

.chatflow-chat__option {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.chatflow-chat__option:hover {
  background: #f9fafb;
  border-color: #cbd5e1;
}

.chatflow-chat__option:active {
  transform: translateY(1px);
}

.chatflow-chat__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 14px;
  border-radius: 10px;
  border: 1px solid #22c55e;
  background: #22c55e;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.chatflow-chat__cta:hover {
  filter: brightness(0.95);
}

.chatflow-chat__ad {
  width: 100%;
  min-height: 420px;
}

@media (max-width: 640px), (pointer: coarse) {
  .chatflow-chat {
    max-width: none;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    height: 100vh;
    height: 100dvh;
    box-shadow: none;
    position: fixed;
    inset: 0;
    z-index: 2147483647 !important;
    --chatflow-footer-offset: 120px;
  }

  .chatflow-chat .chatflow-chat__header {
    position: sticky;
    top: 0;
    z-index: 2147483647 !important;
    min-height: 88px;
    padding: 12px;
    padding-top: calc(12px + env(safe-area-inset-top) + 125px);
    align-items: flex-end;
  }

  .chatflow-chat__body {
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom) + var(--chatflow-footer-offset));
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
  }

  .chatflow-chat__options {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom) + var(--chatflow-footer-offset));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
  }

  .chatflow-chat__bubble {
    font-size: 15px;
    max-width: 92%;
  }

  .chatflow-chat__option,
  .chatflow-chat__cta {
    padding: 14px 14px;
    border-radius: 12px;
  }

  .chatflow-chat__ad {
    min-height: 380px;
  }
}

.chatflow-chat__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
