.demand-header {
  margin-bottom: .4rem;
}

.demand-header .tool-header__back {
  margin-bottom: .16rem;
}

.demand-header .eyebrow {
  font-size: .62rem;
  margin-bottom: .12rem;
}

.demand-header h1 {
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  line-height: 1.12;
}

.demand-header > p:last-child {
  font-size: .82rem;
  line-height: 1.35;
  margin-top: .2rem;
}

.demand-layout,
.demand-form,
.demand-results {
  display: grid;
  gap: .7rem;
}

.demand-panel {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #dfe5e8);
  border-radius: 14px;
  display: grid;
  gap: .55rem;
  padding: .75rem;
}

.demand-panel h2 {
  font-size: .92rem;
  line-height: 1.25;
  margin: 0;
}

.demand-panel > p {
  font-size: .84rem;
  line-height: 1.4;
  margin: 0;
}

.demand-grid {
  column-gap: .7rem;
  display: grid;
  row-gap: .5rem;
}

.demand-field {
  display: grid;
  font-size: .8rem;
  font-weight: 650;
  gap: .18rem;
}

.demand-field input,
.demand-field select,
.demand-field textarea,
.demand-panel > textarea {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #cbd5db);
  border-radius: 9px;
  color: inherit;
  font-size: .88rem;
  min-height: 34px;
  padding: .34rem .55rem;
  width: 100%;
}

.demand-field textarea,
.demand-panel > textarea {
  min-height: 60px;
  resize: vertical;
}

.demand-field [aria-invalid="true"] {
  border-color: #b42318;
  box-shadow: 0 0 0 2px #fee4e2;
}

.demand-preferences {
  border-top: 1px solid var(--border, #dfe5e8);
  padding-top: .55rem;
}

.demand-preferences summary {
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.demand-form .form-actions {
  gap: .5rem;
  margin-top: .1rem;
}

.demand-ai-loading {
  align-items: center;
  background: color-mix(in srgb, var(--primary) 7%, var(--surface, #fff));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border, #dfe5e8));
  border-radius: 10px;
  display: grid;
  gap: .65rem;
  grid-template-columns: 64px minmax(0, 1fr);
  padding: .55rem .65rem;
}

.demand-ai-loading[hidden] {
  display: none;
}

.demand-loading-progress {
  --progress-angle: 0deg;
  align-items: center;
  aspect-ratio: 1;
  display: grid;
  isolation: isolate;
  justify-items: center;
  position: relative;
  width: 64px;
}

.demand-loading-progress::before,
.demand-loading-progress::after {
  border-radius: 50%;
  content: "";
  grid-area: 1 / 1;
}

.demand-loading-progress::before {
  background: conic-gradient(var(--primary, #1473e6) var(--progress-angle), color-mix(in srgb, var(--primary, #1473e6) 14%, transparent) 0);
  height: 100%;
  transition: background .18s linear;
  width: 100%;
}

.demand-loading-progress::after {
  background: color-mix(in srgb, var(--surface, #fff) 88%, transparent);
  height: calc(100% - 10px);
  width: calc(100% - 10px);
  z-index: 2;
}

.demand-loading-progress img {
  border-radius: 50%;
  grid-area: 1 / 1;
  height: calc(100% - 12px);
  object-fit: cover;
  opacity: .34;
  width: calc(100% - 12px);
  z-index: 1;
}

.demand-loading-progress__value {
  color: var(--primary, #1473e6);
  font-size: .86rem;
  font-weight: 850;
  grid-area: 1 / 1;
  letter-spacing: -.02em;
  z-index: 3;
}

.demand-ai-loading__copy {
  display: grid;
  gap: .12rem;
}

.demand-ai-loading__copy strong {
  font-size: .84rem;
}

.demand-ai-loading__copy span {
  color: var(--muted, #667085);
  font-size: .78rem;
  line-height: 1.35;
}

.demand-errors {
  background: #fff1f0;
  border-radius: 9px;
  color: #912018;
  padding: .5rem .65rem;
}

.demand-errors p {
  margin: .1rem 0;
}

.provider-grid,
.demand-saved-list {
  display: grid;
  gap: .55rem;
}

.provider-card,
.demand-match,
.saved-demand {
  align-items: center;
  border: 1px solid var(--border, #dfe5e8);
  border-radius: 10px;
  display: grid;
  gap: .35rem;
  padding: .65rem;
}

.provider-card p,
.demand-match p {
  margin: 0;
}

.provider-level {
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  justify-self: start;
  padding: .15rem .42rem;
}

.provider-level--full { background: #dcfae6; color: #067647; }
.provider-level--partial { background: #fef0c7; color: #92400e; }
.provider-level--basic { background: #edf2f7; color: #475467; }

.saved-demand__open {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  padding: 0;
  text-align: left;
}

.demand-check {
  align-items: center;
  display: flex;
  gap: .45rem;
}

.demand-legal {
  color: var(--muted, #667085);
  font-size: .78rem;
  line-height: 1.4;
}

.button--danger { color: #b42318; }
.muted { color: var(--muted, #667085); }

@media (max-width: 599px) {
  .demand-header h1 {
    font-size: 1.35rem;
  }

  .demand-field input,
  .demand-field select,
  .demand-field textarea,
  .demand-panel > textarea {
    min-height: 44px;
  }

  .demand-field textarea,
  .demand-panel > textarea {
    min-height: 72px;
  }

  .demand-ai-loading {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .demand-loading-progress {
    width: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demand-loading-progress img {
    display: none;
  }

  .demand-loading-progress::before {
    transition: none;
  }
}

@media (min-width: 640px) {
  .demand-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .saved-demand {
    grid-template-columns: 1fr auto auto;
  }

  .demand-panel {
    padding: .8rem;
  }
}

@media (min-width: 960px) {
  .demand-layout {
    align-items: start;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr);
  }

  .demand-form,
  .demand-results {
    grid-column: 1;
  }

  .demand-layout > .demand-panel {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 1rem;
  }

  .provider-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
