.form { display: grid; gap: var(--s4); }
.field { display: grid; gap: var(--s2); margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { font-weight: var(--weight-body); padding: 0; }
.optional { font-weight: var(--weight-body); color: var(--muted); }
.field-row { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }

/* Every text-like input, typed or not (an <input> without a type is a text box). */
input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"], [type="button"], [type="image"], [type="range"], [type="color"], [type="reset"]), select, textarea {
    width: 100%; font: inherit; font-size: var(--text-base); color: var(--graphite); background: var(--white);
    border: 1px solid var(--field-border); border-radius: var(--radius-control); padding: var(--s2) var(--s3); min-height: var(--control);
}
/* One-line fields are exactly the control height of the scale (the body line height would otherwise add 8px to it). */
input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"], [type="button"], [type="image"], [type="range"], [type="color"], [type="reset"]), select { height: var(--control); padding-top: 0; padding-bottom: 0; }
.filter select { width: auto; min-width: 220px; }
textarea { resize: vertical; min-height: 140px; }
textarea.short { min-height: 88px; }
input:focus, select:focus, textarea:focus { border-color: var(--terracotta); outline: 2px solid var(--terracotta); outline-offset: 0; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--error); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }
.error { color: var(--error); font-weight: var(--weight-strong); font-size: var(--text-sm); margin: 0; }

.choices { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s4); }
.choice { font-weight: var(--weight-body) !important; display: flex; align-items: center; gap: var(--s2); min-height: var(--control); }
.choice input { width: 20px; height: 20px; accent-color: var(--terracotta); }

.alert { border-radius: var(--radius-control); padding: var(--s3) var(--s4); margin: 0; }
.alert-error { background: var(--error-bg); color: var(--error); font-weight: var(--weight-strong); }

.sent { text-align: center; padding: var(--s5) 0; }
.sent-mark { font-size: var(--text-xl); font-weight: var(--weight-strong); color: var(--success); margin-bottom: var(--s2); }

/* Off-screen rather than display:none, which some bots detect and skip. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.spinner { display: none; width: 16px; height: 16px; border: 2px solid rgb(255 255 255 / 40%); border-top-color: var(--white); border-radius: 50%; animation: spin 0.8s linear infinite; }
.htmx-request .spinner, .htmx-request.spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.file-picker { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.file-input { left: 0; top: 0; }
.file-input:focus-visible + label { outline: 3px solid var(--terracotta); outline-offset: 2px; }
.has-error .file-picker label { border-color: var(--error); }
.file-name { color: var(--muted); font-size: var(--text-sm); overflow-wrap: break-word; }
