/**
 * Form 1174 moves the legal row after the submit button for tab order.
 * These rules keep the same visual placement that the old sibling selectors produced.
 *
 * Marketo also prints a row for every hidden tracking field and for fields it
 * has not shown yet (.mktoPlaceholder, often with a whitespace text node so
 * :empty does not match). Each of those rows keeps a margin, so the privacy
 * line sits far below the last visible field. 6sense marks shortened fields
 * with _6si_sff_filled and hides the row, but theme rules set display:flex
 * on .mktoFormRow with higher specificity, so that margin remains too.
 * Collapse a row only when it has no visible control and no privacy copy.
 */

form.mktoForm > .mktoFormRow:not(:has(
  .mktoHtmlText,
  spanhelvetica,
  .mktoCheckboxList,
  .mktoRadioList,
  .mktoField:not([type="hidden"]):not(._6si_sff_filled)
)) {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
}

/* Side-by-side forms: legal stays on the left, button on the right. */
@media (min-width: 992px) {
  form.mktoForm.ironclad-legal-after-button > .mktoButtonRow:has(+ .mktoFormRow .mktoHtmlText),
  form.mktoForm.ironclad-legal-after-button > .mktoButtonRow:has(+ .mktoFormRow spanhelvetica) {
    float: right;
    width: 45% !important;
  }

  form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText),
  form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) {
    float: left;
    clear: none;
    width: 55%;
    margin-top: 22px;
  }

  .e-stn--short-form-with-media .e-col--bottom-column > div:has(> form.mktoForm) form.mktoForm.ironclad-legal-after-button > .mktoButtonRow:has(+ .mktoFormRow .mktoHtmlText),
  .e-stn--short-form-with-media .e-col--bottom-column > div:has(> form.mktoForm) form.mktoForm.ironclad-legal-after-button > .mktoButtonRow:has(+ .mktoFormRow spanhelvetica),
  .e-stn--wide-video .e-col--bottom-column > div:has(> form.mktoForm) form.mktoForm.ironclad-legal-after-button > .mktoButtonRow:has(+ .mktoFormRow .mktoHtmlText),
  .e-stn--wide-video .e-col--bottom-column > div:has(> form.mktoForm) form.mktoForm.ironclad-legal-after-button > .mktoButtonRow:has(+ .mktoFormRow spanhelvetica),
  .e-stn--banner-without-media .e-col--bottom-column > div form.mktoForm.ironclad-legal-after-button > .mktoButtonRow:has(+ .mktoFormRow .mktoHtmlText),
  .e-stn--banner-without-media .e-col--bottom-column > div form.mktoForm.ironclad-legal-after-button > .mktoButtonRow:has(+ .mktoFormRow spanhelvetica) {
    width: 37% !important;
  }

  .e-stn--short-form-with-media .e-col--bottom-column > div:has(> form.mktoForm) form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText),
  .e-stn--short-form-with-media .e-col--bottom-column > div:has(> form.mktoForm) form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica),
  .e-stn--wide-video .e-col--bottom-column > div:has(> form.mktoForm) form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText),
  .e-stn--wide-video .e-col--bottom-column > div:has(> form.mktoForm) form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica),
  .e-stn--banner-without-media .e-col--bottom-column > div form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText),
  .e-stn--banner-without-media .e-col--bottom-column > div form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) {
    width: 63%;
    margin-top: 20px !important;
  }

  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText) .mktoFormCol,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText) .mktoFieldWrap,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) .mktoFormCol,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) .mktoFieldWrap {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
  }

  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText) .mktoFieldWrap > label,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) .mktoFieldWrap > label {
    display: none !important;
  }

  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText) .mktoHtmlText,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText) .mktoHtmlText p,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText) .mktoHtmlText span,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText) .mktoHtmlText spanhelvetica,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) .mktoHtmlText,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) .mktoHtmlText p,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) .mktoHtmlText span,
  .e-stn--short-form-with-media form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) .mktoHtmlText spanhelvetica {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Sidepop places legal and the button on one grid row. Dense flow fills the hole after the move. */
.e-demo--sidepop:not(.e-demo--sidepop--stacked) form.mktoForm.ironclad-legal-after-button {
  grid-auto-flow: dense;
}

/* Stacked CTAs already paint the button first via flex order. Keep that after the move. */
.e-form--stacked-cta form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText),
.e-form--stacked-cta form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica),
.e-form--guide-stacked-cta form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText),
.e-form--guide-stacked-cta form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica),
.e-form--stacked-cta-fit form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(.mktoHtmlText),
.e-form--stacked-cta-fit form.mktoForm.ironclad-legal-after-button > .mktoButtonRow + .mktoFormRow:has(spanhelvetica) {
  width: 100% !important;
  order: 2;
  float: none !important;
  margin-top: 20px;
  text-align: center;
}

.e-form--stacked-cta form.mktoForm.ironclad-legal-after-button > .mktoButtonRow,
.e-form--guide-stacked-cta form.mktoForm.ironclad-legal-after-button > .mktoButtonRow,
.e-form--stacked-cta-fit form.mktoForm.ironclad-legal-after-button > .mktoButtonRow {
  order: 1;
  float: none !important;
  width: 100% !important;
}
