.form { display: flex; flex-direction: column; gap: 14px; }
.form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.form__actions { display: flex; justify-content: flex-end; gap: var(--space-2); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field__label, .field > label, .field > legend { font-size: var(--text-sm); color: var(--muted); padding: 0; }
.field__label-row { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); color: var(--muted); }
.field__hint { font-size: var(--text-sm); color: var(--muted); }
.field__error { font-size: var(--text-sm); color: var(--failed-ink); }

.input, .field input:not([type=checkbox]):not([type=radio]):not([type=submit]), .field select, .field textarea {
  font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius-control);
  padding: 10px 12px; width: 100%; min-width: 0;
}
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border: 1.5px solid var(--accent); padding: 9.5px 11.5px; }
.field--error input, .field--error select, .field--error textarea, .field_with_errors input, .field_with_errors select {
  border: 1.5px solid var(--failed);
}
.field_with_errors { display: contents; }
.input--mono, .field input.input--mono { font-family: var(--font-mono); }

/* Toggle pills: checkboxes shown as pills (activities). */
.pills { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span { display: inline-block; padding: 5px 12px; border-radius: var(--radius-tag); border: 1px solid var(--border); background: var(--panel); }
.pill input:checked + span { background: var(--brand-deep); color: var(--ivory); border-color: var(--brand-deep); }
.pill input:checked + span::after { content: " ✓"; }
.pill input:focus-visible + span { outline: 2px solid var(--accent-ring); outline-offset: 2px; }

/* Segmented control: radio buttons. */
.segmented { display: inline-flex; gap: 2px; background: var(--hairline); padding: 3px; border-radius: var(--radius-control); align-self: flex-start; font-size: 13px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: inline-block; padding: 5px 12px; border-radius: var(--radius-sm); }
.segmented input:checked + span { background: var(--panel); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent-ring); }

/* Notices inside cards and pages (flash, form errors, explanations). */
.notice { padding: 10px 12px; border-radius: var(--radius-control); font-size: 13px; background: var(--panel-sunken); display: flex; flex-direction: column; gap: 4px; }
.notice--alert { background: var(--failed-tint); color: var(--failed-ink); }
.notice--attention { background: var(--attention-tint); color: var(--attention-ink); }
.notice--success { background: var(--agreed-tint); color: var(--agreed-ink); }
.notice a { color: inherit; font-weight: 600; text-decoration: underline; }
.notice ul { padding-left: 1.1em; list-style: disc; }

/* Compact select inside table rows (member roles). */
.select-compact {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px 8px;
}
.field > .field_with_errors > label { font-size: var(--text-sm); color: var(--muted); }

.field--wide { grid-column: 1 / -1; }
