.custom-plan-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(0 0 0 / 65%);
  backdrop-filter: blur(6px);
  font-family: "PingFang SC", "PingFang SC Regular", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.7;
}

.custom-plan-modal__dialog {
  position: relative;
  width: min(600px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  overflow-y: auto;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 60px rgb(0 0 0 / 35%);
  padding: 40px;
}

.custom-plan-modal__honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.custom-plan-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #7d8187;
  font-size: 18px;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.custom-plan-modal__close:hover { color: #1a1a1a; background: rgb(0 0 0 / 6%); }

.custom-plan-modal__header { padding-right: 32px; }

.custom-plan-modal__header h2,
.custom-plan-modal__success h2 {
  margin: 0;
  color: #1a1a1a;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
}

.custom-plan-modal__header p:last-child,
.custom-plan-modal__success p {
  margin: 10px 0 0;
  color: #3b3f45;
  font-size: 14px;
  line-height: 1.6;
}

.custom-plan-modal__submit-error {
  margin: 20px 0 0;
  padding: 10px 12px;
  border: 1px solid rgb(239 68 68 / 35%);
  border-radius: 8px;
  background: rgb(239 68 68 / 8%);
  color: #ef4444;
  font-size: 13px;
  line-height: 1.5;
}

.custom-plan-modal__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 16px;
  margin-top: 32px;
}

.custom-plan-modal__fields label {
  display: grid;
  gap: 8px;
  color: #3b3f45;
  font-size: 13px;
}

.custom-plan-modal__fields input,
.custom-plan-modal__fields select,
.custom-plan-modal__fields textarea {
  width: 100%;
  border: 1px solid #dadbdf;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: #1a1a1a;
  font: inherit;
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.custom-plan-modal__fields input,
.custom-plan-modal__fields select { height: 40px; padding: 0 14px; }

.custom-plan-modal__fields textarea { display: block; min-height: 104px; padding: 12px 14px 32px; resize: vertical; }

.custom-plan-modal__fields input::placeholder,
.custom-plan-modal__fields textarea::placeholder { color: #7d8187; }

.custom-plan-modal__fields input:focus,
.custom-plan-modal__fields select:focus,
.custom-plan-modal__fields textarea:focus {
  border-color: #3f59ff;
  box-shadow: 0 0 0 2px rgb(63 89 255 / 20%);
}

.custom-plan-modal__fields label { position: relative; }

.custom-plan-modal__fields label em {
  margin-left: 2px;
  color: #7d8187;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
}

.custom-plan-modal__fields label > span[data-required]::after {
  content: "*";
  margin-left: 3px;
  color: #ef4444;
}

.custom-plan-modal__phone-control,
.custom-plan-modal__contact-control {
  display: flex;
  min-width: 0;
  align-items: stretch;
}

.custom-plan-modal__phone-control > span {
  display: inline-flex;
  height: 40px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #dadbdf;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #fff;
  color: #3b3f45;
  font-size: 13px;
}

.custom-plan-modal__phone-control input { border-radius: 0 8px 8px 0; }

.custom-plan-modal__contact-select {
  position: relative;
  width: 92px;
  flex: none;
}

.custom-plan-modal__contact-select select {
  width: 100%;
  appearance: none;
  padding: 0 28px 0 12px;
  border-right: 0;
  border-radius: 8px 0 0 8px;
}

.custom-plan-modal__contact-select svg {
  position: absolute;
  top: 50%;
  right: 10px;
  color: #3b3f45;
  pointer-events: none;
  transform: translateY(-50%);
}

.custom-plan-modal__contact-control input { min-width: 0; border-radius: 0 8px 8px 0; }

.custom-plan-modal__field-error {
  color: #ef4444;
  font-size: 12px;
  line-height: 1.4;
}

.custom-plan-modal__textarea-wrap { position: relative; display: block; min-width: 0; }

.custom-plan-modal__counter {
  position: absolute;
  right: 26px;
  bottom: 12px;
  color: #7d8187;
  font-size: 12px;
  pointer-events: none;
}

.custom-plan-modal__agreement {
  margin: 20px 0 0;
  color: #7d8187;
  font-size: 12px;
  line-height: 1.6;
}

.custom-plan-modal__agreement a { color: #3b3f45; text-decoration: underline; }

.custom-plan-modal__field--full { grid-column: 1 / -1; }

.custom-plan-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
}

.custom-plan-modal__spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: #fff;
  border-radius: 50%;
  animation: custom-plan-spin 700ms linear infinite;
}

@keyframes custom-plan-spin { to { transform: rotate(360deg); } }

.custom-plan-modal__primary,
.custom-plan-modal__secondary {
  min-width: 112px;
  height: 44px;
  padding: 0 24px;
  border-radius: 100px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 160ms ease;
}

.custom-plan-modal__primary {
  border: 1px solid #171719;
  background: #171719;
  color: #fff;
}

.custom-plan-modal__primary:hover:not(:disabled) {
  background: #2a2a2d;
  border-color: #2a2a2d;
}

.custom-plan-modal__primary:disabled { cursor: wait; opacity: 0.65; }

.custom-plan-modal__secondary {
  border: 1px solid #dadbdf;
  background: transparent;
  color: #1a1a1a;
}

.custom-plan-modal__secondary:hover { border-color: #3f59ff; }

.custom-plan-modal__success { padding: 36px 12px 16px; text-align: center; }

.custom-plan-modal__success-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgb(34 197 94 / 14%);
  color: #22c55e;
  font-size: 28px;
}

.custom-plan-modal__success .custom-plan-modal__primary { margin-top: 28px; }

@media (max-width: 680px) {
  .custom-plan-modal { padding: 12px; }
  .custom-plan-modal__dialog { max-height: calc(100vh - 24px); padding: 32px 20px 24px; border-radius: 16px; }
  .custom-plan-modal__fields { grid-template-columns: 1fr; gap: 16px; margin-top: 24px; }
  .custom-plan-modal__field--full { grid-column: auto; }
  .custom-plan-modal__footer {
    position: sticky;
    bottom: -24px;
    z-index: 1;
    margin: 24px -20px -24px;
    padding: 16px 20px;
    background: linear-gradient(to top, #fff 90%, transparent);
  }
  .custom-plan-modal__footer .custom-plan-modal__primary { width: 100%; }
}
