.lead-widget {
  position: relative;
  z-index: 1090;
}

.lead-widget__trigger {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: var(--app-primary, #1f5b95);
  box-shadow: 0 14px 34px rgba(15, 32, 58, 0.22);
  color: #fff;
  font-weight: 700;
}

.lead-widget__trigger:hover {
  background: #1a4f7f;
}

.lead-widget__trigger:focus-visible,
.lead-widget__close:focus-visible,
.lead-widget__submit:focus-visible {
  outline: 3px solid rgba(200, 162, 77, 0.55);
  outline-offset: 2px;
}

.lead-widget__dialog {
  width: min(440px, 100%);
  height: 100svh;
  max-height: 100svh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--app-border, #e5e9f2);
  border-radius: 16px 0 0 16px;
  background: #fff;
  box-shadow: -18px 0 60px rgba(15, 32, 58, 0.24);
  color: #182433;
}

.lead-widget__dialog::backdrop {
  background: rgba(15, 32, 58, 0.46);
}

.lead-widget__panel {
  display: flex;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.lead-widget__form,
.lead-widget__chat {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  overflow-y: auto;
}

.lead-widget__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--app-border, #e5e9f2);
}

.lead-widget__eyebrow {
  margin: 0 0 0.25rem;
  color: var(--app-primary, #1f5b95);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.lead-widget__header h2 {
  margin: 0;
  color: var(--app-text, #182433);
  font-size: 1.5rem;
  line-height: 1.2;
}

.lead-widget__close {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--app-border, #e5e9f2);
  border-radius: 50%;
  background: #fff;
  color: var(--app-primary, #1f5b95);
}

.lead-widget__field {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  color: var(--app-text, #182433);
  font-size: 0.9rem;
  font-weight: 700;
}

.lead-widget__field input,
.lead-widget__field textarea {
  width: 100%;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--app-border, #e5e9f2);
  border-radius: 6px;
  background: #fff;
  color: #182433;
  font: inherit;
  font-weight: 400;
}

.lead-widget__field input:focus,
.lead-widget__field textarea:focus {
  border-color: var(--app-primary, #1f5b95);
  outline: 3px solid rgba(31, 91, 149, 0.16);
}

.lead-widget__field textarea {
  resize: vertical;
}

.lead-widget__contacts {
  padding: 0.8rem;
  border: 1px solid var(--app-border, #e5e9f2);
  border-radius: 8px;
  background: var(--app-primary-soft, #e8f1fb);
}

.lead-widget__contacts summary {
  cursor: pointer;
  color: var(--app-text, #182433);
  font-size: 0.9rem;
  font-weight: 700;
}

.lead-widget__contacts summary span {
  color: var(--app-muted, #5f6d80);
  font-size: 0.76rem;
  font-weight: 400;
}

.lead-widget__contacts[open] {
  display: grid;
  gap: 0.8rem;
}

.lead-widget__contacts p {
  margin: 0;
  color: var(--app-muted, #5f6d80);
  font-size: 0.8rem;
  line-height: 1.45;
}

.lead-widget__honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.lead-widget__consent {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0;
  color: #5f6d80;
  font-size: 0.82rem;
  line-height: 1.4;
}

.lead-widget__consent input {
  width: 18px;
  height: 18px;
  margin-top: 0.05rem;
  accent-color: var(--app-primary, #1f5b95);
}

.lead-widget__consent a,
.lead-widget__telegram {
  color: var(--app-primary, #1f5b95);
  font-weight: 700;
}

.lead-widget__status {
  display: none;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.lead-widget__status.is-visible {
  display: block;
  background: #edf5ef;
  color: #244a31;
}

.lead-widget__status.is-error {
  background: #fff0f0;
  color: #8a2424;
}

.lead-widget__submit {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--app-primary, #1f5b95);
  color: #fff;
  font-weight: 700;
}

.lead-widget__submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.lead-widget__telegram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  text-decoration: none;
}

body:has([data-cookie-consent]:not([hidden])) .lead-widget__trigger {
  display: none;
}

.lead-widget__intro,
.lead-widget__poll-note {
  margin: 0;
  color: var(--app-muted, #5f6d80);
  font-size: 0.88rem;
  line-height: 1.5;
}

.lead-widget__chat[hidden],
.lead-widget__form[hidden] {
  display: none;
}

.lead-widget__chat {
  min-height: 0;
  flex: 1;
  grid-template-rows: minmax(180px, 1fr) auto auto auto;
}

.lead-widget__messages {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  gap: 0.7rem;
  overflow-y: auto;
  padding: 0.2rem;
}

.lead-widget__message {
  max-width: 86%;
  padding: 0.7rem 0.85rem;
  border-radius: 14px 14px 14px 4px;
  background: var(--app-primary-soft, #e8f1fb);
  color: var(--app-text, #182433);
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lead-widget__message--visitor {
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
  background: var(--app-primary, #1f5b95);
  color: #fff;
}

.lead-widget__message-meta {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.7rem;
  opacity: 0.7;
}

.lead-widget__composer {
  display: grid;
  gap: 0.65rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--app-border, #e5e9f2);
}

.lead-widget__composer textarea {
  resize: none;
}

.lead-widget__unread {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #d14343;
}

@media (max-width: 768px) {
  .lead-widget__trigger {
    right: 0.75rem;
    bottom: 0.75rem;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
  }

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

  .lead-widget__dialog {
    width: 100%;
    max-height: 100svh;
    border-radius: 0;
  }

  .lead-widget__form {
    gap: 0.8rem;
    padding: 1rem;
  }

}
