.fly-content-form {
  display: grid;
  gap: 16px;
}

.fly-content-form label {
  display: grid;
  gap: 7px;
  color: #27272a;
  font-size: 13px;
  font-weight: 600;
}

.fly-content-form input,
.fly-content-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  background: #fff;
  color: #18181b;
  font: inherit;
  box-sizing: border-box;
}

.fly-content-form textarea {
  min-height: 112px;
  resize: vertical;
}

.fly-content-form button {
  width: fit-content;
  min-height: 42px;
  padding: 10px 20px;
  border: 0;
  border-radius: 4px;
  background: #18181b;
  color: #fff;
  font-weight: 700;
}

.form-builder-modal {
  padding: 8px;
}

.form-builder-dialog {
  width: min(1720px, calc(100vw - 16px));
  height: min(900px, calc(100dvh - 16px));
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr) 70px;
  overflow: hidden;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.form-builder-head {
  position: relative;
  display: grid;
  place-items: center;
  color: #71717a;
}

.form-builder-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

.form-builder-head button {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #18181b;
  font-size: 22px;
}

.form-builder-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(410px, 1fr);
  overflow: hidden;
}

.form-builder-preview {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 72px 40px;
  background: #fff;
}

.form-builder-preview > div {
  width: min(500px, 100%);
}

.form-builder-settings {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 45px minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid #e4e4e7;
}

.form-builder-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 25px;
  border-bottom: 1px solid #e4e4e7;
}

.form-builder-tabs button {
  min-width: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #64748b;
  font-size: 13px;
}

.form-builder-tabs button.is-active {
  border-bottom-color: #2563eb;
  color: #2563eb;
}

.form-builder-tabs button:disabled {
  cursor: default;
}

.form-builder-editor {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 30px 25px 110px;
}

.form-builder-copy {
  display: grid;
  gap: 8px;
  margin-bottom: 28px;
}

.form-builder-copy input {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: #3f3f46;
}

.form-builder-title-input {
  font-size: 28px;
  font-weight: 700;
}

.form-builder-description-input {
  font-size: 16px;
}

.form-builder-copy input:focus {
  outline: 0;
  box-shadow: inset 0 -1px #2563eb;
}

.form-settings-panel {
  display: grid;
  gap: 38px;
}

.form-settings-panel section {
  display: grid;
  gap: 18px;
}

.form-settings-panel h3 {
  margin: 0 0 6px;
  color: #3f3f46;
  font-size: 21px;
  font-weight: 400;
}

.form-settings-panel label:not(.form-setting-check) {
  display: grid;
  gap: 7px;
  color: #52525b;
  font-size: 14px;
}

.form-settings-panel input[type="text"],
.form-settings-panel select {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 4px;
  background: #f4f4f5;
  padding: 8px 10px;
  color: #18181b;
  font: inherit;
}

.form-setting-check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #52525b;
  font-size: 14px;
}

.form-setting-check input {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: #3b82f6;
}

.form-field-list {
  display: grid;
  gap: 14px;
}

.form-field-card {
  min-width: 0;
  margin: 0;
  padding: 12px 16px 16px;
  border: 1px solid #bcc7d9;
  border-radius: 6px;
  background: #fff;
}

.form-field-card.is-dragging {
  opacity: 0.45;
}

.form-field-card legend {
  padding: 0 4px;
  color: #64748b;
  font-size: 12px;
}

.form-field-card-head {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 32px 32px 24px;
  align-items: center;
  gap: 8px;
}

.form-field-card-head > input {
  min-width: 0;
  height: 36px;
  border: 0;
  background: transparent;
  color: #3f3f46;
  font-size: 15px;
}

.form-field-card-head > input:focus {
  outline: 0;
  box-shadow: inset 0 -1px #2563eb;
}

.form-field-type-icon,
.form-field-card-head button,
.form-element-palette button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-field-card-head button {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #3f3f46;
}

.form-field-card-head svg,
.form-field-type-icon svg,
.form-element-palette svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form-field-card:not(.is-expanded) [data-form-field-toggle] svg {
  transform: rotate(180deg);
}

.form-field-drag {
  cursor: grab;
}

.form-field-details {
  display: grid;
  gap: 16px;
  padding: 16px 8px 4px;
}

.form-field-details > label,
.form-submit-label {
  display: grid;
  gap: 6px;
  color: #71717a;
  font-size: 14px;
}

.form-field-details input[type="text"],
.form-field-details textarea,
.form-field-details select,
.form-submit-label input {
  width: min(100%, 310px);
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  background: #f4f4f5;
  padding: 8px 10px;
  color: #18181b;
  font: inherit;
}

.form-field-details textarea {
  min-height: 110px;
  resize: vertical;
}

.form-field-details select {
  width: min(100%, 180px);
}

.form-field-details .is-compact input {
  width: 120px;
}

.form-number-detail > span:last-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-number-detail input[type="number"] {
  width: 100px;
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  background: #f4f4f5;
  padding: 8px 10px;
  color: #18181b;
  font: inherit;
}

.form-number-detail em {
  color: #52525b;
  font-style: normal;
}

.form-color-detail input[type="color"] {
  width: 40px;
  height: 38px;
  border: 1px solid #d4d4d8;
  background: #fff;
  padding: 0;
}

.form-field-details .form-required {
  grid-template-columns: 20px 1fr;
  align-items: center;
  justify-self: start;
  color: #52525b;
}

.form-required input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.form-upload-types {
  display: grid;
  justify-items: start;
  gap: 8px;
  color: #71717a;
  font-size: 14px;
}

.form-options-editor {
  display: grid;
  gap: 9px;
}

.form-option-labels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px;
  color: #71717a;
  font-size: 13px;
}

.form-option-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(82px, 1fr) 24px 28px 20px;
  align-items: center;
  gap: 5px;
  min-height: 50px;
  padding: 6px 8px;
  border: 1px solid #d8dee8;
  border-radius: 5px;
  background: #fff;
}

.form-option-row.is-dragging {
  opacity: 0.45;
}

.form-option-row input[type="text"] {
  min-width: 0;
  width: 100%;
  height: 34px;
  border: 0;
  background: transparent;
  padding: 0 6px;
  color: #18181b;
  font-size: 13px;
}

.form-option-row input[type="text"]:focus {
  outline: 1px solid #60a5fa;
}

.form-option-row input[type="radio"] {
  width: 19px;
  height: 19px;
}

.form-option-row button,
.form-option-drag {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #52525b;
}

.form-option-drag {
  width: 20px;
  cursor: grab;
}

.form-option-row svg,
.form-option-other svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form-option-add,
.form-option-other {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 4px;
  background: #e5e7eb;
  color: #18181b;
}

.form-option-other {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
  border: 1px solid #d8dee8;
  background: #fff;
  padding: 0 14px;
}

.form-element-palette {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px 8px;
  margin-top: 16px;
  padding: 20px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.form-element-palette button {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #3f3f46;
  font-size: 11px;
  line-height: 1.2;
}

.form-element-palette button span {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

.form-add-element {
  width: 100%;
  min-height: 46px;
  margin-top: 16px;
  border: 0;
  border-radius: 3px;
  background: #e5e7eb;
  color: #52525b;
  font-size: 15px;
}

.form-submit-label {
  margin-top: 20px;
}

.form-builder-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 20px;
  border-top: 1px solid #f4f4f5;
}

.form-builder-actions button {
  min-width: 110px;
}

.form-control-buttons {
  position: absolute;
  z-index: 4;
  top: 16px;
  right: 16px;
  display: inline-flex;
  gap: 8px;
}

.form-control-buttons button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(0 0 0 / 0.08);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.94);
  color: #18181b;
  box-shadow: 0 6px 18px rgb(15 23 42 / 0.16);
}

.form-control-buttons svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fly-form-intro {
  margin-bottom: 12px;
}

.fly-form-intro h2,
.fly-form-intro p {
  margin: 0;
}

.fly-form-intro h2 {
  color: #3f3f46;
  font-size: 30px;
  font-weight: 700;
}

.fly-form-intro p {
  margin-top: 10px;
  color: #52525b;
}

.fly-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fly-form-actions.is-full {
  display: grid;
  grid-template-columns: 1fr;
}

.fly-content-form .fly-form-actions.is-full button {
  width: 100%;
}

.fly-content-form .fly-form-actions .is-reset {
  border: 1px solid #d4d4d8;
  background: #fff;
  color: #18181b;
}

.fly-form-recaptcha-placeholder {
  min-height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  background: #fafafa;
  color: #71717a;
  font-size: 13px;
}

.fly-form-result {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
}

.fly-content-form > [hidden] {
  display: none !important;
}

.fly-form-result[hidden] {
  display: none !important;
}

.fly-form-result-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgb(9 9 11 / 58%);
  cursor: default;
}

/* Keep the modal controls isolated from the generic form button styling. */
.fly-content-form .fly-form-result-backdrop {
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: rgb(9 9 11 / 58%);
  color: transparent;
  font-weight: 400;
}

.fly-form-result-dialog {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 42px 32px 34px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgb(0 0 0 / 24%);
}

.fly-form-result-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #71717a;
  font: 28px/1 Arial, sans-serif;
}

.fly-content-form .fly-form-result-close {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  color: #71717a;
  font-weight: 400;
}

.fly-form-result-close:hover,
.fly-form-result-close:focus-visible {
  background: #f4f4f5;
  color: #18181b;
}

.fly-form-result-icon {
  width: 58px;
  height: 58px;
  color: #16a34a;
}

.fly-form-result-icon.is-error {
  color: #dc2626;
}

.fly-form-result-icon[hidden] {
  display: none;
}

.fly-form-result-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fly-form-result p {
  margin: 0;
  color: #18181b;
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.25;
}

.fly-content-form select,
.fly-content-form input[type="file"] {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  background: #fff;
  color: #18181b;
  font: inherit;
}

.fly-form-field span b,
.fly-form-switch b b {
  margin-left: 4px;
  color: #ef4444;
}

.fly-form-field small,
.fly-form-media small {
  color: #71717a;
  font-size: 12px;
  font-weight: 400;
}

.fly-form-upload {
  display: grid;
  gap: 9px;
}

.fly-form-upload-label {
  color: #27272a;
  font-size: 13px;
  font-weight: 600;
}

.fly-form-upload-label b {
  margin-left: 4px;
  color: #ef4444;
}

.fly-content-form .fly-form-upload-zone {
  min-height: 120px;
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #27272a;
  cursor: pointer;
  font-size: 15px;
  font-weight: 400;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.fly-content-form .fly-form-upload-zone:hover,
.fly-content-form .fly-form-upload-zone.is-dragging {
  border-color: #3b82f6;
  background: #eff6ff;
}

.fly-content-form .fly-form-upload-input {
  width: 1px;
  min-height: 1px;
  position: absolute;
  overflow: hidden;
  opacity: 0;
  padding: 0;
  border: 0;
}

.fly-form-upload-zone > b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 400;
}

.fly-form-upload-zone svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fly-form-upload-zone > small,
.fly-form-upload > small {
  max-width: 100%;
  color: #71717a;
  font-size: 12px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.fly-form-upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
}

.fly-form-upload-preview:empty {
  display: none;
}

.fly-form-upload-preview img,
.fly-form-upload-preview video {
  width: 100%;
  max-height: 280px;
  display: block;
  object-fit: contain;
}

.fly-form-upload-preview audio {
  width: 100%;
}

.fly-form-upload-preview img.is-masked {
  width: min(220px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  object-fit: cover;
}

.fly-form-choices {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.fly-form-choices legend {
  margin-bottom: 2px;
  color: #27272a;
  font-size: 13px;
  font-weight: 600;
}

.fly-form-choices > label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

.fly-form-choices input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
}

.fly-content-form .fly-form-choices input[type="radio"],
.fly-content-form .fly-form-choices input[type="checkbox"] {
  appearance: none;
  flex: 0 0 18px;
  height: 18px;
  border: 1px solid var(--fly-form-choice-border, #a1a1aa);
  background: #fff;
  cursor: pointer;
}

.fly-content-form .fly-form-choices input[type="radio"] {
  border-radius: 50%;
}

.fly-content-form .fly-form-choices input[type="radio"]:checked {
  border-color: var(--fly-form-primary, #3b82f6);
  background: var(--fly-form-primary, #3b82f6);
  box-shadow: inset 0 0 0 4px #fff;
}

.fly-content-form .fly-form-choices input[type="checkbox"] {
  display: grid;
  place-items: center;
  border-radius: 3px;
}

.fly-content-form .fly-form-choices input[type="checkbox"]::after {
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg) scale(0);
  transform-origin: center;
}

.fly-content-form .fly-form-choices input[type="checkbox"]:checked {
  border-color: var(--fly-form-primary, #3b82f6);
  background: var(--fly-form-primary, #3b82f6);
}

.fly-content-form .fly-form-choices input[type="checkbox"]:checked::after {
  transform: rotate(45deg) scale(1);
}

.fly-content-form .fly-form-choices input[type="radio"]:focus-visible,
.fly-content-form .fly-form-choices input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--fly-form-primary, #3b82f6);
  outline-offset: 2px;
}

.fly-form-switch {
  display: grid !important;
  grid-template-columns: 42px 1fr !important;
  align-items: center;
  gap: 8px 10px !important;
}

.fly-form-switch > b {
  grid-column: 1 / -1;
  color: #27272a;
  font-weight: 600;
}

.fly-form-switch > input {
  position: absolute;
  opacity: 0;
}

.fly-form-switch > span {
  width: 42px;
  height: 23px;
  position: relative;
  border-radius: 999px;
  background: #d4d4d8;
  cursor: pointer;
  transition: background-color 160ms ease;
}

.fly-form-switch > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease;
}

.fly-form-switch > input:checked + span {
  background: #3b82f6;
}

.fly-form-switch > input:checked + span::after {
  transform: translateX(19px);
}

.fly-form-switch > input:focus-visible + span {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.fly-form-slider {
  display: grid;
  gap: 8px;
}

.fly-form-slider > span:first-child {
  color: #27272a;
  font-weight: 600;
}

.fly-form-slider-limits {
  display: flex;
  justify-content: space-between;
  color: #52525b;
}

.fly-form-slider input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #3b82f6;
  cursor: pointer;
}

.fly-form-slider output {
  justify-self: center;
  color: #18181b;
  font-size: 15px;
}

.fly-form-heading {
  margin: 8px 0 0;
  font-size: 22px;
}

.fly-form-paragraph {
  margin: 0;
  color: #52525b;
}

.fly-form-spacer {
  min-height: 0;
}

.fly-form-separator {
  width: 100%;
  border: 0;
  border-top: 1px solid #d4d4d8;
}

.fly-form-media img,
.fly-form-media video {
  width: 100%;
  max-height: 320px;
  display: block;
  object-fit: contain;
}

.fly-form-media-placeholder {
  min-height: 120px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px dashed #cbd5e1;
  color: #64748b;
}

.fly-form-media-placeholder svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

@media (max-width: 900px) {
  .form-builder-dialog {
    grid-template-rows: 40px minmax(0, 1fr) 62px;
  }

  .form-builder-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 42%) minmax(0, 1fr);
    overflow: hidden;
  }

  .form-builder-preview {
    padding: 28px 20px;
  }

  .form-builder-settings {
    min-height: 0;
    border-top: 1px solid #e4e4e7;
    border-left: 0;
  }

  .form-builder-editor {
    padding: 22px 16px 100px;
  }
}
