.form {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1.25rem;
}

.form-group {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.form-group label {
	font-weight: 600;
	color: var(--text);
	color: var(--color-text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
	padding: 0.75rem 0.85rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--card-border);
	background: rgba(8, 12, 19, 0.78);
	background: color-mix(in srgb, var(--color-bg-elevated) 78%, transparent);
	color: var(--text);
	color: var(--color-text-primary);
	transition: border-color 0.15s ease, background 0.2s ease,
		box-shadow 0.2s ease;
}

.form-group textarea {
	resize: vertical;
	min-height: 120px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
	outline: 2px solid var(--brand-2);
	outline: 2px solid var(--color-brand-bright);
	outline-offset: 1px;
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

.form-group--error input,
.form-group--error select,
.form-group--error textarea {
	border-color: rgba(209, 75, 75, 0.6);
	border-color: color-mix(in srgb, var(--color-danger) 60%, transparent);
	box-shadow: 0 0 0 1px rgba(209, 75, 75, 0.3);
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-danger) 30%, transparent);
}

.field-help {
	margin: 0;
	font-size: 0.85rem;
	color: var(--color-text-subtle);
}

.field-error {
	margin: 0;
	font-size: 0.85rem;
	color: var(--danger);
	color: var(--color-danger);
}

.form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: flex-end;
}

.form-fieldset {
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: rgba(21, 27, 35, 0.85);
	background: var(--color-surface-overlay);
	box-shadow: var(--shadow);
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.form-fieldset legend {
	font-weight: 700;
	padding: 0 0.5rem;
	color: var(--text);
	color: var(--color-text-primary);
}

@media (max-width: 640px) {
	.form-actions {
		justify-content: stretch;
	}
}
