:root {
  --af-lead-brand: #e60023;
  --af-lead-brand-dark: #bf001d;
  --af-lead-text: #1f2329;
  --af-lead-muted: #5f6f84;
  --af-lead-line: #dfe5ed;
  --af-lead-surface: #ffffff;
  --af-lead-danger: #b42318;
  --af-lead-success: #0f6b38;
}

body.af-lead-widget-open { overflow: hidden; }

.af-lead-widget__toast {
  position: fixed;
  top: 24px;
  left: 50%;
  z-index: 100200;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  transform: translateX(-50%);
  border: 1px solid #b8e2c6;
  border-radius: 8px;
  background: #f0fbf4;
  box-shadow: 0 12px 28px rgba(15, 107, 56, .16);
  color: var(--af-lead-success);
  font-weight: 600;
  line-height: 1.5;
}

.af-lead-widget,
.af-lead-widget * { box-sizing: border-box; }

.af-lead-widget {
  color: var(--af-lead-text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.af-lead-widget--modal {
  position: fixed;
  inset: 0;
  z-index: 100100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.af-lead-widget__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 32, 0.56);
  backdrop-filter: blur(3px);
  animation: af-lead-fade-in 180ms ease-out both;
}

.af-lead-widget__panel {
  position: relative;
  width: min(100%, 560px);
  max-height: calc(100vh - 36px);
  padding: 30px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(222, 228, 237, 0.92);
  border-radius: 8px;
  background: var(--af-lead-surface);
  box-shadow: 0 28px 80px rgba(7, 23, 45, 0.24);
}

.af-lead-widget--modal .af-lead-widget__panel {
  animation: af-lead-panel-in 220ms cubic-bezier(.2, .75, .25, 1) both;
}

.af-lead-widget--inline .af-lead-widget__panel {
  width: 100%;
  max-height: none;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.af-lead-widget__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #f2f4f7;
  color: #667085;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.af-lead-widget__close:hover { color: #1f2937; background: #e9edf2; transform: rotate(3deg); }

.af-lead-widget__header { padding-right: 40px; }
.af-lead-widget--inline .af-lead-widget__header { padding-right: 0; }

.af-lead-widget__eyebrow {
  margin: 0 0 8px;
  color: var(--af-lead-brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.af-lead-widget__title {
  margin: 0;
  color: #18263a;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
}

.af-lead-widget__description { margin: 9px 0 0; color: var(--af-lead-muted); line-height: 1.75; }
.af-lead-widget__form { margin-top: 24px; }
.af-lead-widget__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.af-lead-widget__field--wide { grid-column: 1 / -1; }

.af-lead-widget__field label {
  display: block;
  margin-bottom: 7px;
  color: #344054;
  font-size: 14px;
  font-weight: 600;
}

.af-lead-widget__field label span { margin-left: 3px; color: var(--af-lead-brand); }

.af-lead-widget__field input,
.af-lead-widget__field textarea,
.af-lead-widget__captcha input {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--af-lead-line);
  border-radius: 4px;
  background: #fff;
  color: #27364a;
  font: inherit;
  outline: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.af-lead-widget__field input { height: 44px; padding: 0 13px; }
.af-lead-widget__field textarea { min-height: 82px; padding: 11px 13px; resize: vertical; }

.af-lead-widget__field input:focus,
.af-lead-widget__field textarea:focus,
.af-lead-widget__captcha input:focus {
  border-color: rgba(230, 0, 35, .7);
  box-shadow: 0 0 0 4px rgba(230, 0, 35, .09);
  background: #fff;
}

.af-lead-widget__field input:invalid:not(:placeholder-shown) { border-color: #d92d20; }

.af-lead-widget__captcha {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #f0d3d8;
  border-radius: 8px;
  background: #fff8f9;
}

.af-lead-widget__captcha[hidden] { display: none; }
.af-lead-widget__captcha-title { margin: 0 0 10px; color: #7f1324; font-weight: 700; }
.af-lead-widget__captcha-row { display: grid; grid-template-columns: 118px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.af-lead-widget__captcha img { width: 118px; height: 42px; object-fit: contain; border: 1px solid #e7c5cb; border-radius: 4px; background: #fff; }
.af-lead-widget__captcha input { height: 42px; padding: 0 12px; }

.af-lead-widget__refresh {
  height: 42px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: #8a1a2c;
  font: inherit;
  cursor: pointer;
}

.af-lead-widget__status { min-height: 22px; margin: 14px 0 0; color: var(--af-lead-muted); }
.af-lead-widget__status.is-error { color: var(--af-lead-danger); }
.af-lead-widget__status.is-success { color: var(--af-lead-success); }
.af-lead-widget__status.is-warning { color: #8a4b08; }

.af-lead-widget__actions { display: flex; align-items: center; gap: 16px; margin-top: 10px; }

.af-lead-widget__submit {
  min-width: 148px;
  height: 44px;
  padding: 0 24px;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(135deg, #ff284e 0%, var(--af-lead-brand-dark) 100%);
  box-shadow: 0 12px 28px rgba(230, 0, 35, .2);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.af-lead-widget__submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(230, 0, 35, .27); }
.af-lead-widget__submit:disabled { opacity: .68; cursor: wait; box-shadow: none; }

.af-lead-widget__fallback { display: none; color: #5f6f84; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.af-lead-widget__fallback.is-visible { display: inline; }

.af-lead-widget button:focus-visible,
.af-lead-widget a:focus-visible {
  outline: 3px solid rgba(230, 0, 35, .3);
  outline-offset: 2px;
}

.af-lead-widget__honeypot {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes af-lead-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes af-lead-panel-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 600px) {
  .af-lead-widget--modal { align-items: flex-end; padding: 0; }
  .af-lead-widget--modal .af-lead-widget__panel {
    width: 100%;
    max-height: calc(100vh - 12px);
    padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
  }
  .af-lead-widget__grid { grid-template-columns: 1fr; gap: 13px; }
  .af-lead-widget__field--wide { grid-column: auto; }
  .af-lead-widget__title { font-size: 22px; }
  .af-lead-widget__form { margin-top: 20px; }
  .af-lead-widget__captcha-row { grid-template-columns: 108px minmax(0, 1fr); }
  .af-lead-widget__captcha img { width: 108px; }
  .af-lead-widget__refresh { grid-column: 1 / -1; justify-self: start; height: auto; padding: 2px 0; }
  .af-lead-widget__actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .af-lead-widget__submit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .af-lead-widget *,
  .af-lead-widget *::before,
  .af-lead-widget *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
