body.yx-lead-open {
  overflow: hidden;
}

.yx-lead-overlay[hidden] {
  display: none !important;
}

.yx-lead-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.yx-lead-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(8px);
}

.yx-lead-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 640px);
  max-width: 640px;
  height: min(88dvh, 860px);
  max-height: calc(100dvh - 28px);
  min-height: min(640px, calc(100dvh - 28px));
  overflow: hidden;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 40px 120px -32px rgba(15, 23, 42, 0.45);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.yx-lead-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.96);
}

.yx-lead-dialog__eyebrow {
  margin: 0 0 6px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.yx-lead-dialog__header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 30px;
  line-height: 1.05;
  font-weight: 800;
}

.yx-lead-dialog__close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.yx-lead-dialog__body {
  position: relative;
  padding: 0;
  background: #fff;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.yx-lead-dialog__loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.yx-lead-overlay.is-ready .yx-lead-dialog__loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.yx-lead-dialog__spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(37, 99, 235, 0.16);
  border-top-color: #2563eb;
  animation: yx-lead-spin 0.9s linear infinite;
}

.yx-lead-dialog__loader-text {
  color: #334155;
  font-size: 15px;
  font-weight: 600;
}

.yx-lead-dialog__frame-host {
  min-height: 0;
  height: 100%;
}

.yx-lead-dialog__frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

.yx-lead-dialog__fallback {
  min-height: 46px;
  padding: 10px 18px max(10px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  color: #2563eb;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.yx-lead-dialog__fallback:hover,
.yx-lead-dialog__fallback:focus-visible {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 767px) {
  .yx-lead-overlay {
    align-items: flex-end;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .yx-lead-dialog {
    width: 100%;
    max-width: 430px;
    height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    min-height: 0;
    border-radius: 22px;
  }

  .yx-lead-dialog__header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 16px 14px 12px;
    backdrop-filter: blur(10px);
  }

  .yx-lead-dialog__header h2 {
    font-size: 18px;
    line-height: 1.15;
  }

  .yx-lead-dialog__eyebrow {
    margin-bottom: 4px;
    font-size: 10px;
  }

  .yx-lead-dialog__close {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }

  .yx-lead-dialog__fallback {
    min-height: 48px;
    padding-inline: 14px;
    font-size: 13px;
  }

  .yx-lead-dialog__loader {
    gap: 12px;
    padding: 20px;
  }

  .yx-lead-dialog__loader-text {
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  .yx-lead-dialog__header {
    padding-inline: 12px;
  }
}

@keyframes yx-lead-spin {
  to {
    transform: rotate(360deg);
  }
}
