/* Forms. No element-wide rules: every control lives in a component class, so a label can never
   again override a choice card's layout (the 2026-10-13 misalignment bug).
   .rh-field = one row in a .rh-group: name on the left, control on the right, both centred. */

.rh-form {
  display: grid;
  gap: var(--rh-space-2);
}

.rh-form-label {
  display: block;
  font-size: var(--rh-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--rh-color-muted);
  margin: var(--rh-space-4) var(--rh-space-1) 0;
}

.rh-form-hint {
  color: var(--rh-color-muted);
  font-size: var(--rh-text-xs);
  margin: 0 var(--rh-space-1);
}

.rh-field {
  position: relative;
  display: grid;
  grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
  align-items: center;
  gap: var(--rh-space-3);
  min-height: 52px;
  padding: var(--rh-space-1) var(--rh-space-4);
  cursor: text;
}

.rh-field[hidden] {
  display: none;
}

.rh-group > * + .rh-field::before,
.rh-group > * + .rh-opt::before,
.rh-group > * + .rh-toggle::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--rh-space-4);
  right: 0;
  height: 1px;
  background: var(--rh-color-border);
  transform: scaleY(0.5);
}

.rh-field-name {
  font-size: 16px;
  color: var(--rh-color-text);
}

.rh-field input,
.rh-field select,
.rh-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--rh-color-text);
  font: 16px / 1.3 var(--rh-font);
  text-align: right;
  padding: 0;
  outline: none;
}

.rh-field select {
  appearance: none;
  -webkit-appearance: none;
  text-align-last: right;
  color: var(--rh-color-link);
  cursor: pointer;
}

.rh-field input::placeholder,
.rh-field textarea::placeholder {
  color: var(--rh-color-chevron);
}

.rh-field input[type="date"],
.rh-field input[type="datetime-local"] {
  color: var(--rh-color-link);
  display: flex;
  justify-content: flex-end;
}

.rh-field input::-webkit-date-and-time-value {
  text-align: right;
}

.rh-field:focus-within {
  background: var(--rh-color-surface-2);
}

/* Stacked: the name above, the control full width (notes, files, long answers). */
.rh-field--stack {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--rh-space-1);
  padding: var(--rh-space-3) var(--rh-space-4);
}

.rh-field--stack .rh-field-name {
  font-size: var(--rh-text-xs);
  color: var(--rh-color-muted);
  font-weight: 600;
}

.rh-field--stack input,
.rh-field--stack select,
.rh-field--stack textarea {
  text-align: left;
  text-align-last: left;
}

.rh-field textarea {
  min-height: 72px;
  resize: vertical;
}

.rh-field input[type="file"] {
  font-size: var(--rh-text-s);
  color: var(--rh-color-muted);
}

.rh-field input[type="file"]::file-selector-button {
  margin-right: var(--rh-space-3);
  padding: 8px 14px;
  border: 0;
  border-radius: var(--rh-radius-s);
  background: var(--rh-color-fill);
  color: var(--rh-color-link);
  font: 600 var(--rh-text-s) var(--rh-font);
  cursor: pointer;
}

/* Who was seen? — avatar cards (radio). */
.rh-who {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: var(--rh-space-2);
}

.rh-who-option {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: var(--rh-space-3) var(--rh-space-1);
  border-radius: var(--rh-radius-m);
  background: var(--rh-color-surface);
  border: 2px solid transparent;
  font-size: var(--rh-text-s);
  font-weight: 600;
  cursor: pointer;
}

.rh-who-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rh-who-option:hover,
.rh-who-option:active {
  border-color: var(--rh-color-border);
}

.rh-who-option:has(input:checked) {
  border-color: var(--rh-color-primary);
  background: var(--rh-color-wait-bg);
}

.rh-who-option:has(input:focus-visible) {
  outline: 2px solid var(--rh-color-link);
  outline-offset: 2px;
}

/* One-of-many options as rows with a ring on the right (radio). */
.rh-opt {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: var(--rh-space-3);
  min-height: 58px;
  padding: var(--rh-space-2) var(--rh-space-4);
  cursor: pointer;
}

.rh-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rh-opt-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.rh-opt-sub {
  display: block;
  color: var(--rh-color-muted);
  font-size: var(--rh-text-xs);
  margin-top: 1px;
}

.rh-opt-ring {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--rh-color-chevron);
  display: grid;
  place-items: center;
}

.rh-opt-ring::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.rh-opt:hover,
.rh-opt:active {
  background: var(--rh-color-surface-2);
}

.rh-opt:has(input:checked) .rh-opt-ring {
  border-color: var(--rh-color-primary);
}

.rh-opt:has(input:checked) .rh-opt-ring::after {
  background: var(--rh-color-primary);
}

.rh-opt:has(input:focus-visible) {
  outline: 2px solid var(--rh-color-link);
  outline-offset: -2px;
}

/* On/off rows (checkbox drawn as a switch). */
.rh-toggle {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--rh-space-3);
  min-height: 52px;
  padding: var(--rh-space-1) var(--rh-space-4);
  font-size: 16px;
  cursor: pointer;
}

.rh-toggle input {
  appearance: none;
  -webkit-appearance: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: var(--rh-radius-pill);
  background: var(--rh-color-fill);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.rh-toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.rh-toggle input:checked {
  background: var(--rh-color-ok);
}

.rh-toggle input:checked::after {
  transform: translateX(20px);
}

/* Quick-set chips under a field (Today / Yesterday). */
.rh-quick {
  display: flex;
  gap: var(--rh-space-2);
  margin: var(--rh-space-2) var(--rh-space-1) 0;
}

.rh-quick button {
  height: 32px;
  padding: 0 var(--rh-space-3);
  border: 0;
  border-radius: var(--rh-radius-pill);
  background: var(--rh-color-surface);
  color: var(--rh-color-link);
  font: 600 var(--rh-text-xs) var(--rh-font);
  cursor: pointer;
}

.rh-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rh-space-2);
  margin-top: var(--rh-space-4);
}

.rh-group + .rh-form,
.rh-form + .rh-group,
.rh-group + form > .rh-group:first-child {
  margin-top: var(--rh-space-3);
}

.rh-group + .rh-form-hint {
  margin-top: var(--rh-space-2);
}
