.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.field__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.field__hint {
  font-size: var(--text-xs);
  color: var(--color-text-soft);
}

.field__control {
  position: relative;
}

.field__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* Inputs share the row and wrap rather than overflow the panel. */
.field__row > .input {
  flex: 1 1 8rem;
  min-width: 0;
}

.input {
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  font-size: var(--text-md);
  outline: none;
}

.input::placeholder {
  color: var(--color-text-faint);
}

.input:focus,
.input:focus-within {
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}

.input--select {
  flex: 0 0 auto;
  width: auto;
  min-width: 6rem;
  cursor: pointer;
}

/* A unit glued to the right of a number field, e.g. "847 m²" */
.input--suffix {
  display: flex;
  align-items: center;
  gap: var(--space-3xs);
  padding-right: var(--space-sm);
}

.input__field {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
}

.input__suffix {
  color: var(--color-text-faint);
  font-size: var(--text-sm);
}

textarea.input {
  resize: vertical;
}

.autocomplete {
  position: absolute;
  z-index: 20;
  inset-inline: 0;
  top: calc(100% + var(--space-3xs));
  max-height: 15rem;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.autocomplete[hidden] {
  display: none;
}

.autocomplete__item {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-md);
  cursor: pointer;
}

.autocomplete__item:hover,
.autocomplete__item.is-active {
  background-color: var(--color-land-soft);
}

.disclosure {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-sm);
}

.disclosure__summary {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-soft);
  cursor: pointer;
}

.disclosure__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding-top: var(--space-xs);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--text-sm);
  color: var(--color-text-soft);
  cursor: pointer;
}

.checkbox input {
  accent-color: var(--color-primary);
}

/* A labelled input inside a row of several. */
.subfield {
  display: flex;
  flex: 1 1 8rem;
  flex-direction: column;
  gap: var(--space-4xs);
  min-width: 0;
}

.subfield__label {
  color: var(--color-text-soft);
  font-size: var(--text-xs);
}

.rating {
  border: none;
  padding: 0;
}

.rating__legend {
  padding: 0;
  color: var(--color-text-soft);
  font-size: var(--text-xs);
}

.rating__stars {
  /* Anchors the hidden radios below. Without it their containing block is the
     page itself, so giving one focus scrolls the whole view to the top. */
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4xs);
  padding-top: var(--space-4xs);
}

.rating__input,
.rating__none {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.rating__star {
  color: var(--color-border-strong);
  font-size: 1.375rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.1s ease;
}

/* A star lights up when it is the chosen one, or when the chosen one comes
   after it. One rule, in one direction — nothing to out-specify. */
.rating__input:checked + .rating__star,
.rating__star:has(~ .rating__input:checked) {
  color: #f59e0b;
}

/* Hovering previews a value: clear the row, then light up to the pointer. */
.rating__stars:hover .rating__star {
  color: var(--color-border-strong);
}

.rating__stars:hover .rating__star:hover,
.rating__stars:hover .rating__star:has(~ .rating__star:hover) {
  color: #f59e0b;
}

.rating__clear {
  margin-left: var(--space-2xs);
  color: var(--color-text-faint);
  font-size: var(--text-md);
  line-height: 1;
  cursor: pointer;
}

.rating__clear:hover {
  color: var(--color-danger);
}



.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4xs);
  padding-top: var(--space-4xs);
}

.tag-suggestion {
  padding: var(--space-4xs) var(--space-xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background-color: var(--color-surface);
  color: var(--color-text-soft);
  font-size: var(--text-xs);
}

.tag-suggestion:hover {
  border-color: var(--color-border-strong);
}

.tag-suggestion.is-active {
  border-color: var(--color-primary);
  background-color: var(--color-primary);
  color: #fff;
}
