.services-page-heading {
  align-items: flex-start;
  margin-bottom: 20px;
}

.services-page-heading > div {
  max-width: 760px;
}

.service-editor {
  border: 1px solid var(--line);
}

.service-editor #serviceForm {
  display: grid;
  gap: 18px;
}

.service-editor-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.28);
}

.service-step-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0;
  border-radius: 999px;
  background: var(--workspace-accent-soft);
  color: var(--workspace-accent);
  font-weight: 850;
}

.service-step-content {
  min-width: 0;
}

.service-step-content > h3 {
  margin: 0 0 6px;
}

.service-step-content > .subtle {
  margin: 0 0 16px;
}

.service-step-toggle {
  display: none;
  width: auto;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--workspace-accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.service-location-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.service-location-choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.42);
}

.service-location-choice:has(input:checked) {
  border-color: var(--workspace-accent);
  box-shadow: 0 0 0 1px var(--workspace-accent);
  background: var(--workspace-accent-soft);
}

.service-location-choice input {
  margin-top: 4px;
}

.service-location-choice span,
.service-location-choice strong,
.service-location-choice small {
  display: block;
}

.service-location-choice small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.service-behavior-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-behavior-grid .module-toggle {
  min-height: 100%;
}

.distance-pricing-card,
.service-outcome-preview,
.future-service-controls {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.28);
}

.service-outcome-preview {
  border-style: dashed;
}

.service-outcome-preview h3 {
  margin: 4px 0 8px;
}

.service-outcome-preview p:last-child {
  margin-bottom: 0;
}

.future-service-controls {
  display: block;
}

.service-editor-actions {
  position: sticky;
  bottom: 12px;
  z-index: 8;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.94);
  backdrop-filter: blur(12px);
}

.service-list-card .button-row {
  flex-wrap: wrap;
}

.service-card-actions {
  align-items: flex-start;
  justify-content: flex-end;
}

.service-card-more {
  position: relative;
}

.service-card-more > summary {
  list-style: none;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
}

.service-card-more > summary::-webkit-details-marker {
  display: none;
}

.service-card-more-menu {
  display: grid;
  gap: 8px;
  min-width: 150px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card, #111827);
}

.service-card-more-menu button {
  width: 100%;
  justify-content: flex-start;
}

@media (min-width: 761px) {
  .service-card-more-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
  }
}

@media (max-width: 760px) {
  .service-editor-step {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 10px;
  }

  .service-step-number {
    width: 30px;
    height: 30px;
  }

  .service-step-toggle {
    display: inline-block;
  }

  .service-editor-step.is-collapsed .service-step-content > :not(h3):not(.service-step-toggle) {
    display: none !important;
  }

  .service-location-choices,
  .service-behavior-grid {
    grid-template-columns: 1fr;
  }

  .service-editor-actions {
    bottom: 6px;
  }

  .service-list-card .section-title {
    gap: 12px;
  }

  .service-card-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .service-card-edit {
    width: 100%;
  }

  .service-card-more-menu {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .services-page-heading {
    display: grid;
    gap: 14px;
  }

  .services-page-heading button {
    width: 100%;
  }

  .service-editor-actions {
    grid-template-columns: 1fr;
  }
}

/* Use one clear panel hierarchy so the service editor is easier to scan. */
body:not(.a11y-high-contrast) .service-editor-step,
body:not(.a11y-high-contrast) .distance-pricing-card,
body:not(.a11y-high-contrast) .future-service-controls {
  border-color: color-mix(in srgb, var(--workspace-accent) 20%, var(--line));
  background: var(--workspace-panel-soft);
  box-shadow: none;
}

body:not(.a11y-high-contrast) .service-location-choice {
  border-color: color-mix(in srgb, var(--workspace-accent) 20%, var(--line));
  background: var(--workspace-panel-soft);
}

body:not(.a11y-high-contrast) .service-location-choice:has(input:checked) {
  border-color: var(--workspace-accent);
  background: var(--workspace-accent-soft);
}

body:not(.a11y-high-contrast) .service-outcome-preview {
  border-color: color-mix(in srgb, var(--workspace-accent) 24%, var(--line));
  background: var(--workspace-panel-quiet);
}

body:not(.a11y-high-contrast) .service-editor-actions {
  background: rgba(17, 20, 24, .96);
}

body:not(.a11y-high-contrast) .service-card-more-menu {
  background: var(--workspace-panel-soft);
}
