
#csm-intake-form {
  --csm-primary: #224586; /* CSM brand navy (site --wp--preset--color--accent) \u2014 retune here to match brand */
  --csm-primary-dark: #1a3668;
  --csm-text: #1f2733;
  --csm-muted: #6b7280; /* labels-secondary, footers, step captions */
  --csm-input-text: #1f2733;
  --csm-border: #d3d8e0;
  --csm-error: #c0392b;
  --csm-bg: #fff;
  --csm-card: #fff;
  --csm-track: #e7e9ee;

  display: block;
  max-width: 620px;
  margin: 0 auto;
  color: var(--csm-text);
  line-height: 1.45;
  text-align: left;
}

/* The card is opaque white and self-contained, so its interior always uses the
   light palette regardless of host background \u2014 the auto-detected .csm-if-dark
   class needs no overrides now that the below-card subfooter is gone. */

/* Targeted reset against Divi's usual input/button/paragraph styling.
   !important is deliberate: theme rules for form controls frequently use it,
   and the widget must win those fights to look consistent. */
#csm-intake-form input,
#csm-intake-form select,
#csm-intake-form textarea,
#csm-intake-form button {
  font: inherit !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  min-height: 0 !important;
  box-shadow: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}
#csm-intake-form p,
#csm-intake-form label,
#csm-intake-form fieldset,
#csm-intake-form legend {
  margin: 0;
  padding: 0;
  border: none;
  font-style: normal !important;
  text-decoration: none !important;
}

/* Card */
#csm-intake-form .csm-if-card {
  background: var(--csm-card);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(17, 24, 39, 0.08);
  padding: 32px;
}

/* Numbered stepper */
#csm-intake-form .csm-if-stepper {
  display: flex;
  margin-bottom: 24px;
}
#csm-intake-form .csm-if-node {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
/* Connector line into each node from the previous one. */
#csm-intake-form .csm-if-node::before {
  content: '';
  position: absolute;
  top: 15px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--csm-track);
  z-index: 0;
}
#csm-intake-form .csm-if-node:first-child::before {
  display: none;
}
#csm-intake-form .csm-if-node.is-done::before,
#csm-intake-form .csm-if-node.is-active::before {
  background: var(--csm-primary);
}
#csm-intake-form .csm-if-node-circle {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--csm-track);
  color: var(--csm-muted);
  font-size: 0.9em;
  font-weight: 700;
}
#csm-intake-form .csm-if-node.is-active .csm-if-node-circle,
#csm-intake-form .csm-if-node.is-done .csm-if-node-circle {
  background: var(--csm-primary);
  color: #fff;
}
#csm-intake-form .csm-if-node-label {
  margin-top: 6px;
  font-size: 0.72em;
  font-weight: 600;
  color: var(--csm-muted);
}
#csm-intake-form .csm-if-node.is-active .csm-if-node-label {
  color: var(--csm-text);
}

/* Title + description */
#csm-intake-form .csm-if-title {
  margin: 0 0 6px;
  padding: 0;
  font-size: 1.5em;
  font-weight: 700;
  color: var(--csm-text);
}
#csm-intake-form .csm-if-desc {
  margin: 0 0 20px;
  font-size: 0.95em;
  color: var(--csm-muted);
}

/* Fields */
#csm-intake-form .csm-if-field {
  margin-bottom: 16px;
}
#csm-intake-form .csm-if-label {
  display: block;
  font-weight: 600;
  font-size: 0.95em;
  margin-bottom: 6px;
}
#csm-intake-form .csm-if-input {
  display: block;
  width: 100%;
  padding: 13px 16px !important;
  border: 1px solid var(--csm-border) !important;
  border-radius: 12px !important;
  background: var(--csm-bg) !important;
  color: var(--csm-input-text) !important;
  font-size: 16px !important; /* prevents iOS zoom-on-focus */
}
#csm-intake-form select.csm-if-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  padding-right: 40px !important;
}
#csm-intake-form .csm-if-input:focus {
  outline: 2px solid var(--csm-primary);
  outline-offset: 1px;
  border-color: var(--csm-primary) !important;
}
#csm-intake-form .csm-if-input[aria-invalid='true'] {
  border-color: var(--csm-error) !important;
}
#csm-intake-form textarea.csm-if-input {
  resize: vertical;
}

/* Radio group (retained for completeness; not used by the current steps) */
#csm-intake-form .csm-if-radio-group {
  border: none;
  padding: 0;
  margin: 0;
}
#csm-intake-form .csm-if-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--csm-border);
  border-radius: 12px;
  cursor: pointer;
}
#csm-intake-form .csm-if-radio:has(input:checked) {
  border-color: var(--csm-primary);
  background: rgba(34, 69, 134, 0.06);
}
#csm-intake-form .csm-if-radio input {
  accent-color: var(--csm-primary);
  width: 18px;
  height: 18px;
  flex: none;
}

/* Consent */
#csm-intake-form .csm-if-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.82em;
  line-height: 1.45;
  color: var(--csm-muted);
}
#csm-intake-form .csm-if-consent-text a {
  color: inherit;
  text-decoration: underline;
}
#csm-intake-form .csm-if-checkbox {
  accent-color: var(--csm-primary);
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
}

/* Errors \u2014 visible text, not just red borders */
#csm-intake-form .csm-if-error {
  color: var(--csm-error);
  font-size: 0.85em;
  margin-top: 5px;
}
#csm-intake-form .csm-if-error[hidden] {
  display: none;
}

/* Navigation */
#csm-intake-form .csm-if-nav {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
#csm-intake-form .csm-if-btn {
  appearance: none;
  border: none !important;
  border-radius: 12px !important;
  padding: 14px 28px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: background 0.15s ease;
}
#csm-intake-form .csm-if-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
#csm-intake-form .csm-if-btn-next {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--csm-primary) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(34, 69, 134, 0.28);
}
#csm-intake-form .csm-if-btn-next:hover:not(:disabled) {
  background: var(--csm-primary-dark) !important;
}
#csm-intake-form .csm-if-arrow {
  transition: transform 0.15s ease;
}
#csm-intake-form .csm-if-btn-next:hover:not(:disabled) .csm-if-arrow {
  transform: translateX(3px);
}
#csm-intake-form .csm-if-btn-back {
  background: transparent !important;
  color: var(--csm-text) !important;
  border: 1px solid var(--csm-border) !important;
}

/* Card footer trust line */
#csm-intake-form .csm-if-card-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--csm-track);
  font-size: 0.82em;
  color: var(--csm-muted);
}
#csm-intake-form .csm-if-lock {
  display: inline-flex;
  color: var(--csm-muted);
}

/* Honeypot \u2014 offscreen, not display:none (some bots skip hidden inputs) */
#csm-intake-form .csm-if-hp {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

/* Screen-reader-only live region */
#csm-intake-form .csm-if-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#csm-intake-form .csm-if-btn-next:hover:not(:disabled) .csm-if-arrow {
    transform: none;
}

@media (max-width: 480px) {
  #csm-intake-form .csm-if-card {
    padding: 22px;
  }
  #csm-intake-form .csm-if-node-label {
    font-size: 0.66em;
  }
  #csm-intake-form .csm-if-nav {
    flex-direction: column-reverse;
  }
  #csm-intake-form .csm-if-btn {
    width: 100%;
  }
}