.kb-form-shell {
  margin: 1.125rem auto;
  max-width: 640px;
  width: 100%;
}

.kb-form-shell--wide {
  max-width: 960px;
}

.kb-form-card {
  background: #ffffff;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
  overflow: hidden;
}

.kb-form-card__body {
  padding: clamp(1.25rem, 4vw, 2rem);
}

.kb-form-section {
  margin-top: 1.5rem;
}

.kb-form-section-title {
  color: var(--kb-color-heading-neutral);
  font-size: 1.25rem;
  font-weight: var(--kb-font-weight-extrabold);
  margin-bottom: 1.25rem;
  text-align: center;
}

.kb-form-grid {
  display: grid;
  gap: 0 1.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kb-form-field {
  margin-bottom: 1rem;
}

.kb-form-field--full {
  grid-column: 1 / -1;
}

.kb-form-label {
  color: var(--kb-color-focus-ring);
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

.kb-form-control {
  background: #f7fbff;
  border: 1px solid #d1d9e6;
  border-radius: 8px;
  box-sizing: border-box;
  display: block;
  font: inherit;
  margin: 0 auto;
  min-height: 48px;
  padding: 0.75rem 0.875rem;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: min(100%, 440px);
}

.kb-form-control:focus {
  background: #ffffff;
  border-color: var(--kb-color-focus-ring);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
  outline: 0;
}

.kb-form-control:disabled,
.kb-form-control[readonly] {
  background: #e9ecef;
  cursor: not-allowed;
  opacity: 1;
}

textarea.kb-form-control {
  min-height: 8rem;
  resize: vertical;
  text-align: left;
}

.kb-form-check-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 720px;
}

.kb-form-check {
  align-items: center;
  background: #f7fbff;
  border: 1px solid #d1d9e6;
  border-radius: 8px;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: auto 1fr;
  min-height: 48px;
  padding: 0.75rem 1rem;
}

.kb-form-check-input {
  accent-color: var(--kb-color-focus-ring);
  height: 1.125rem;
  margin: 0;
  width: 1.125rem;
}

.kb-form-check-input:focus-visible {
  outline: 3px solid var(--kb-color-focus-ring);
  outline-offset: 3px;
}

.kb-form-check-label {
  color: var(--kb-color-heading-neutral);
  cursor: pointer;
  font-weight: 600;
  margin: 0;
}

.kb-form-check-errors {
  grid-column: 1 / -1;
  margin-top: 0;
}

.kb-form-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.kb-form-status {
  margin: 1.25rem auto;
  text-align: center;
}

.kb-form-help {
  color: var(--kb-color-text-secondary);
  font-size: 0.875rem;
  margin: 0.5rem auto 0;
  max-width: 440px;
  text-align: left;
}

.kb-form-help ul {
  margin: 0;
  padding-left: 1.25rem;
}

.kb-form-actions--compact {
  margin-top: 0.75rem;
}

.kb-form-list-builder {
  margin: 1rem auto 0;
  max-width: 720px;
}

.kb-form-list-builder .kb-form-control {
  width: 100%;
}

.kb-form-list {
  display: grid;
  gap: 0.625rem;
  margin: 1rem auto 0;
  max-width: 560px;
  padding-left: 2.25rem;
}

.kb-form-list:empty {
  display: none;
}

.kb-form-list__item {
  align-items: center;
  background: #f7fbff;
  border: 1px solid #d1d9e6;
  border-radius: 8px;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0.625rem 0.75rem;
}

.kb-form-list__text {
  overflow-wrap: anywhere;
}

.kb-form-help--center {
  max-width: 720px;
  text-align: center;
}

.kb-form-errors {
  color: var(--kb-color-text-danger);
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0.5rem auto 0;
  max-width: 440px;
  text-align: left;
}

.kb-form-errors .errorlist {
  margin: 0;
  padding-left: 1.25rem;
}

.kb-form-errors--summary {
  background: #fff5f5;
  border: 1px solid #f1aeb5;
  border-radius: 8px;
  margin-top: 1.5rem;
  max-width: 100%;
  padding: 0.875rem 1rem;
}

.kb-form-required {
  color: var(--kb-color-text-danger);
}

@media (max-width: 767.98px) {
  .kb-form-grid,
  .kb-form-check-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .kb-form-card__body {
    padding: 1.25rem 1rem;
  }

  .kb-form-actions .kb-button {
    max-width: 100%;
  }
}
