.lead-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: "Segoe UI", Tahoma, sans-serif;
}

.lead-chat__toast {
  max-width: min(86vw, 280px);
  border: 0;
  border-radius: 18px;
  padding: 10px 14px;
  background: rgba(17, 24, 39, 0.96);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 24px 50px -34px rgba(17, 24, 39, 0.8);
}

.lead-chat__panel {
  width: min(92vw, 396px);
  height: min(78vh, 668px);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background:
    radial-gradient(circle at top right, rgba(255, 228, 120, 0.3), transparent 22%),
    linear-gradient(180deg, rgba(255, 253, 244, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow: 0 34px 84px rgba(15, 23, 42, 0.22);
  display: none;
  flex-direction: column;
}

.lead-chat.is-open .lead-chat__panel {
  display: flex;
}

.lead-chat__head {
  padding: 12px 16px 10px;
  background: linear-gradient(180deg, #fff3b3 0%, #ffd84c 100%);
  color: #0f172a;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.lead-chat__head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lead-chat__title {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.15;
}

.lead-chat__close {
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: #0f172a;
  font-size: 20px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.lead-chat__status {
  padding: 8px 14px;
  font-size: 12px;
  line-height: 1.35;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  background: rgba(255, 255, 255, 0.9);
  color: #755e18;
}

.lead-chat__status[data-tone="error"] {
  color: #b42318;
  background: rgba(254, 242, 242, 0.96);
}

.lead-chat__messages-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.lead-chat__messages {
  height: 100%;
  overflow-y: auto;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255, 250, 236, 0.82), rgba(255, 255, 255, 0.98));
}

.lead-chat__empty {
  margin: auto 0;
  padding: 22px 18px;
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(255, 255, 255, 0.96);
  color: #475467;
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
  box-shadow: 0 20px 40px -34px rgba(15, 23, 42, 0.26);
}

.lead-chat__message {
  display: flex;
}

.lead-chat__message--visitor {
  justify-content: flex-end;
}

.lead-chat__message--operator,
.lead-chat__message--system {
  justify-content: flex-start;
}

.lead-chat__bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 22px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 20px 34px -32px rgba(15, 23, 42, 0.28);
}

.lead-chat__bubble--visitor {
  background: linear-gradient(180deg, #ffe36c, #ffcf2f);
  color: #111827;
  border-bottom-right-radius: 8px;
}

.lead-chat__bubble--operator,
.lead-chat__bubble--system {
  background: rgba(255, 255, 255, 0.98);
  color: #111827;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-bottom-left-radius: 8px;
}

.lead-chat__bubble--system {
  background: rgba(255, 247, 204, 0.96);
  color: #6f5810;
}

.lead-chat__sender-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #475467;
}

.lead-chat__sender-badge--system {
  color: #7c6214;
}

.lead-chat__sender-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  flex: 0 0 auto;
}

.lead-chat__meta {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.68;
}

.lead-chat__photo-link {
  display: block;
  margin-top: 8px;
}

.lead-chat__photo {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 16px;
  background: #fff;
}

.lead-chat__scroll-bottom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 20px 34px -28px rgba(15, 23, 42, 0.38);
}

.lead-chat__scroll-count:empty {
  display: none;
}

.lead-chat__scroll-icon {
  font-size: 18px;
  line-height: 1;
}

.lead-chat__composer {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.05);
  background: rgba(255, 255, 255, 0.94);
}

.lead-chat__preview-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 8px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.lead-chat__preview-list::-webkit-scrollbar {
  display: none;
}

.lead-chat__draft {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: 0 18px 28px -24px rgba(15, 23, 42, 0.34);
}

.lead-chat__draft-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lead-chat__draft-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.86);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.lead-chat__composer-card {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px;
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 38px -34px rgba(15, 23, 42, 0.28);
}

.lead-chat__attach {
  position: relative;
  width: 46px;
  height: 46px;
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
}

.lead-chat__attach-icon {
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
}

.lead-chat__file-input {
  display: block;
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: transparent;
  font-size: 0;
  cursor: pointer;
  z-index: 2;
  overflow: hidden;
}

.lead-chat__file-input::file-selector-button {
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 214, 67, 0.42);
  border-radius: 16px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 243, 179, 0.9);
  color: transparent;
  cursor: pointer;
}

.lead-chat__file-input::-webkit-file-upload-button {
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 214, 67, 0.42);
  border-radius: 16px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 243, 179, 0.9);
  color: transparent;
  cursor: pointer;
}

.lead-chat__attach-icon svg,
.lead-chat__send svg {
  width: 100%;
  height: 100%;
}

.lead-chat__field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.lead-chat__input {
  width: 100%;
  min-height: 42px;
  max-height: 124px;
  resize: none;
  border: 0;
  background: transparent;
  padding: 9px 0 7px;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: #111827;
}

.lead-chat__input::placeholder {
  color: #667085;
}

.lead-chat__input:focus {
  outline: none;
}

.lead-chat__send {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 18px;
  background: #0f172a;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 18px 28px -24px rgba(15, 23, 42, 0.6);
}

.lead-chat__picker-help {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 214, 67, 0.34);
  background: rgba(255, 248, 214, 0.98);
  color: #6b5510;
  font-size: 12px;
  line-height: 1.45;
}

.lead-chat__picker-help-copy {
  margin-bottom: 8px;
}

.lead-chat__picker-help-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lead-chat__picker-help-link,
.lead-chat__picker-help-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: #111827;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.lead-chat__picker-help-dismiss {
  background: transparent;
}

.lead-chat__attach.is-disabled,
.lead-chat__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.lead-chat__attach.is-disabled .lead-chat__file-input {
  pointer-events: none;
}

.lead-chat__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe370, #ffcb24);
  color: #101828;
  padding: 14px 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 24px 48px rgba(194, 145, 0, 0.28);
}

.lead-chat__toggle-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.14);
  flex: 0 0 auto;
}

.lead-chat__toggle-copy small {
  display: block;
  margin-top: 2px;
  font-weight: 600;
  color: rgba(16, 24, 40, 0.72);
}

.lead-chat__toggle-close {
  display: none;
  font-size: 28px;
  line-height: 1;
}

.lead-chat__toggle-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 24px -18px rgba(15, 23, 42, 0.7);
}

.lead-chat.is-open .lead-chat__toggle {
  width: 64px;
  height: 64px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.lead-chat.is-open .lead-chat__toggle-dot,
.lead-chat.is-open .lead-chat__toggle-copy,
.lead-chat.is-open .lead-chat__toggle-badge {
  display: none;
}

.lead-chat.is-open .lead-chat__toggle-close {
  display: inline-block;
}

@media (max-width: 720px) {
  .lead-chat {
    right: 12px;
    bottom: 12px;
  }

  .lead-chat__panel {
    width: min(96vw, 404px);
    height: min(82vh, 676px);
  }
}

@media (max-width: 480px) {
  .lead-chat__panel {
    width: min(97vw, 388px);
    height: min(84vh, 684px);
    border-radius: 26px;
  }

  .lead-chat__title {
    font-size: 18px;
  }

  .lead-chat__toggle {
    padding: 12px 16px;
  }

  .lead-chat__scroll-bottom {
    right: 12px;
    bottom: 12px;
  }
}
